Updating Coordinates to All Clients
Hey all. I was just wondering if someone could give me an outline, or a VERY general explanation of how i should organize this. What I am doing is whenever a client connects to my server (via an applet) they will be able to move a box around with the arrow keys, and they will be able to see everyones boxes that are connected to the server. I'm also not sure whether to use TCP or UDP for this. I'm not sure which is more efficient for a project like this.
I am not asking anyone to program anything for me, I understand how themechanics of my game are going to work, and i've already built a single player version, except slightly more complicated with a rotating image. I also understand how Sockets, and ServerSockets, and all that stuff works as well. The thing i really need help with is structure and organization of my networked program.
1) Structure
2) TCP vs UDP
I'm looking for something along the lines of this.
--
Server
*Accepts connections
*Sends connection to a World Object
Client
*Tries to connect to the Server
*Runs the listeners and moves character
*Sends position to server (or something, this is where i'm having trouble, how to update the positions of all my characters)
*Receives others positions(?)
World
*Receives connections and coordinates and relays them to other clients.(?)
*Keeps world attributes to send to other clients(?)
-
How might one go about tranferring a set of numbers to all clients connected to a server. If in the server i have an ArrayList of sockets to send them to?
Thanks so much for reading this, and i would really appreciate a reply!
Message was edited by:
PaRlOaGn

