Hey everyone,
I have a really bare bones networking question. Right now I have set up a multithreaded chat server, which a Client can connect to and chat with other clients connected to it, however I want to expand it.
I want the client to be a basic map where the user can move a ball (character). So what I am thinking I can do is just send over the coordinates of the client to the server , and have it mass send it back to all clients and in the client have an arraylist of positions and use a for loop to go through them and paint a ball at those coordinates.
However the problem I am having is, how would I get the server to know Client1 (one of the clients connected) has updated his position and to change it. Im guessing I would need some type of ID for each of the clients that would be registered when they connect to the server. But im not sure how i would do that.
Would I use an ArrayList, or hashmap or something so i can have 2 values for each element (“ClientA”, Point p), or should I just have the Server send the ArrayList of Character Objects over the network and just have the clients draw them?
Sorry if it doesnt make too much sense, im half asking a question half rambling ideas.