I have Player 1 and Player 2

I am using Json to send and retrieve player data between the client and the server, but when another player logs in, and is in the same map, how would I send that data to both players to update the graphics engine to show there are 2 Players on the map?

About my game

  • it is a 2D RPG tile based game
  • it is 24x15 Tiles
  • it is Real time Action
  • it should interact anywhere between 10-150 ping
  • players interact with each other when in the same map and can see each other moving around
  • the game world is persistent, and is saved when the server shuts down

Right now the server just sends the player Only their information which is inside a Json Object

Here is an example of what I am talking about

If you notice there are 2 separate characters in 2 separate clients, but they are running on the same server. I am trying to get them to show up on both clients, but I don't know how I should accomplish this. Should I send it as an added value in the Json object?

Players Also what is the name of this process so I can look it up and find more info on it?

  • \$\begingroup\$ That's a big question. To help others give the best answers I have a few questions that may help you better define what you need. What kind of RPG is this, turn based or realtime action? How fast is the client supposed to react to user inputs? How much direct interaction do all these players have with each other? Is trading items or resources between players allowed? Is the game world persistent (i.e. saved between times when your server shuts down, and saves character stats and data)? \$\endgroup\$ Commented Oct 12, 2013 at 21:51
  • 1
    \$\begingroup\$ Sorry I assumed everyone knew what I was doing because I have worked on it, but I forgot that no one knows what I am making lol. I made it more detailed @PatrickHughes \$\endgroup\$
    – Loligans
    Commented Oct 12, 2013 at 22:31

1 Answer 1


There are a lot of ways to achieve it. You can achieve it by sending the connected players as an array of players or as an added value in the json object ( player1, player2, .... ) along side with the number of connected players.
Also if you want speed you should not use Json because Json stores objects in a text format thus making the data exchanging between client and server bigger, but it is fine for prototyping.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .