Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to build my first online game using unity with photon, the data transfer between server and clients is implemented but I am facing a great problem; How/What should be transferred to synchronise the movement data?

My game has a lobby and may have as many as 20 people online at the same time if I pass the position of every players to server and then server to clients, I believe the server would be overloaded, wouldn't it?

Hence I think an other way is to pass the movement of characters:
1) only when a player presses a movement key, then pass it to server and other clients,
2) if the player releases the key, then pass the position for validation.
It is workable? Will there any inconsistency between the clients?

I Hope someone can give me some advice, Thank you!

share|improve this question
    
    
Make sure to mark the answers that helped you as accepted (click the checkmark next to the answer). –  Byte56 Dec 30 '13 at 16:26
    
oh sorry, i thought i have tick it. –  user3026820 Dec 30 '13 at 16:27
add comment

1 Answer

up vote 0 down vote accepted

No, that's pretty much how it's done: everyone sends their input to the server, the server uses that to update the simulation, and then passes the world back to the client - perhaps an incremental update, or the subset each client sees, and so on.

I have the feeling this topic is more complex than you imagine right now. I've written at length on the topic of client/server multiplayer games here: http://www.gabrielgambetta.com/fast_paced_multiplayer.html It will help you with the problems you'll encounter shortly.

share|improve this answer
    
very good article! i find i have a lot of new things to learn now. Some more question is at part 2, Server reconciliation if a player press the right button down, say for an second, then a lots of requests will be send to the severe, will this make the server overload?As there may be hundred of request for a single players. –  user3026820 Dec 21 '13 at 15:00
    
And the other question is in part 4, if client A shot B, then A should send request to server and serve will reconstruct the world to check if the shot success or not. As i am using Unity, the collision have been done for me, but for the server side, the own things photon provide is just passing data, so it this mean i have to code the collision detection myself in the server? –  user3026820 Dec 21 '13 at 15:11
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.