Hey guys, first time posting here.

So I just finished the last 10-20 'Intermediate java tutorials' since its relevant to a Networks class project I'm doing at the moment. The project is basically a very simple little multiplayer game.


  • A client types in the address of the server and connects

  • A GUI opens on which there are a number of small shapes of different colors

  • Each shape on the screen corresponds to a different user that is currently connected to the server as well. This also means that the current user has a shape of his own.

  • When the user clicks anywhere on the window, his shape moves to that point. All the other users can also see his movements.

  • User can also press enter to type a message and enter again to send it to the server. This message will be displayed in a chat window at the bottom.



Here's my thinking at the moment:

I make it so that the server is listening on a port for connections. The second a client connects, here's what happens:


  • Server checks to see if their IP address matches any entry in an array of IP addresses

  • If there is no match, they are given a random shape of a random color, and the server takes their IP and stores it in an array. Then the server closes the socket and goes back to listening on that port.




  • If there IS a match, the server reads the Object that the client has sent. It sends that information to all clients.




  • If the client has sent a string saying "END", the server compares that client's IP addresses with the ones in it's array, and deletes it (moving up all the entries after that).



On the client side:


  • Every time the Client clicks somewhere or sends a message, the client sends an Object to the server containing either a String with a message, or coordinates.




  • When the client receives something from the server, it sends it as a parameter to an overloaded method which either updates the positions of the shapes (including the clients own) or updates the chat window with a new message.




  • When the client closes, sends a last message to Server saying "END".



Well that's basically it. I'd appreciate any advice you guys can give me, like certain libraries that i can use to make things simpler. More specifically I'd appreciate advice on the following topics:


  • Is there a better way to store the IP adresses and manage them?

  • How can I make it so the client knows that a certain coordinate update message is for a certain shape?



That last one is confusing me a lot. I was thinking to maybe transfer the shape movement calculations to the server, and then the server keeps transmitting the GUI it's got to the clients, but I have no idea how to go about that.