I am trying to make a small multiplayer game. I got everything to work, the server accepts multiple connections and keeps track of everything that is connected. The local game client has its own player which it controls with A for left and D for right.
Whenever I start the [server] then connect [client 1] to it, it all works fine. The server keeps track of a list of players and sends it to the clients whenever a new one connects. So that all the players are drawn on every client.
However, when I connect to the same [server] with [client 2], it does what it's supposed to do and draws both the players on the screen of [client 2] . But it does not draw the second player on [client 1] even though the player list was sent to every client, [client 1] & [client 2].
When I connect a third client it does the same thing as above but only [client 3] loads all 3 players.
I've tried several ways of programming this but could not get it to work. What am I doing wrong? My code is open-source on github: GitHub Repo
I really appreciate the help!