Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

The game I'm working on is 1 unit per tile. Each player can move their single unit 1 tile at a time (click the unit and then click the tile to move to).

It's in Javascript with Node.js and presently I have it so that everytime the clicks to move to a tile, the check is done client side first that it is acceptable to do then the player starts moving. The command meanwhile is also sent to the server. Assuming the server accepts then there is no issue and the unit moves to the next tile.

The server is receiving this command and sending it out as the tile co-ordinate only.

Now this is working absolutely fine locally but problems will develop when it goes on the net.

Tonight I'm just looking at getting a rough sync of server time. Then my plan to keep sync is as follows: - Send the tile to move to along with the approximate server time the command was sent - Server sends to all clients the tile to move to along with the server time to arrive by

I'm not sure if this will be the best approach though?

I have a problem understanding the following - How would you store the game state at the various server times in order that the server can check that the move was valid - Even if you can do that it will conflict with the other players nearby if they've moved as well (i.e. two units move at the same time to the same tile?)

Perhaps somebody could offer me some suggestions?

Cheers!

share|improve this question
Movement similar to what can be found here: youtube.com/… – Chris Evans Jan 10 '12 at 21:39
1  
For two players moving onto the same tile at the same time, you'll need some way to determine who wins. It can be as simple as whichever command the server receives first. – Blecki Jan 10 '12 at 23:22

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.