So I'm currently developing my own protocol on top of the already existing protocol, TCP.
This is what I'm thinking..
When the client connects, it's going to send a packet to the server with the username and password in order for the server to check whether that player exits or not, if it does exist it's going to send back a packet to the client that tried connecting saying "Successful connection". When the client receives this packet it's going to spawn the player into the game world. Once the player has spawned in, it's going to send another packet to the server saying "I'm in" which the server then will interpret as "Okay, a new client has landed in the game world, time to notify all the other already connected clients" so the server sends a packet to all of them in which they can add a new player object to their "internal" list of players.
Here is the issue.. The client that connected has no idea about the already connected clients.. How on earth do I add them to it's internal list of players?
Is this a good structure? What's a good way of notifying the connecting client that there are players already on the server?