Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Java 2D Multiplayer

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java 2D Multiplayer

    Hi i am doing a java 2D multiplayergame where im planing to use both TCP/UDP.
    The game is a sidescrolling game where you could move in 2axis and shoot at other players.

    I am using TCP for user events(keyclicks etc) and UDP for server to clients updates.

    I am done with TCP and no im going for the UDP. How do i implement this? . The idé is to
    make a new thread and in the run method i would like to push out diffrent data to the players.
    I know their ip since the TCP enstablishment.
    I cant use the Multicast socket since its pushing the same data to all the clients in the group :/
    And since the world will be pretty big its a waste of time to send all mapdata to each player.


    Can anyone help me with this?


  2. #2
    Junior Member
    Join Date
    Oct 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java 2D Multiplayer

    Hello iMarcus,

    TCP and UDP as far as Java sockets are concerned are quite similar in implementation

    UDP uses Datagram packets to transfer the information (with TCP you would simply use Socket.write())
    The process is described Here, it's quite an in depth look at what is needed, I suppose if you have already implemented a multi-threaded server for TCP it should be a simple implementation of UDP.

    Happy Programming,

    Donny.

  3. #3
    Member
    Join Date
    Mar 2013
    Posts
    31
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Java 2D Multiplayer

    Hello iMarcus,

    i hope u found a solution to ur program......my name is MdeeY......i am new to this forum i just registered......i really need some help with 2d game TCP multiplayer.....the is about Spaceship Multiplayer i want to use TCP client and server to enable two people to control the spaceships from two computers or one computer by running the instance of the server then two instance of the client.......any help will be greatly appreciated

Similar Threads

  1. LWJGL multiplayer server help
    By Brandon_Lengefeld in forum Java Networking
    Replies: 3
    Last Post: September 9th, 2012, 01:06 PM
  2. LWJGL multiplayer server help
    By Brandon_Lengefeld in forum Java Networking
    Replies: 1
    Last Post: September 7th, 2012, 11:24 PM