-
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?
-
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.
-
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