0
\$\begingroup\$

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!

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – brian661 Dec 21 '13 at 15:00
  • \$\begingroup\$ 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? \$\endgroup\$ – brian661 Dec 21 '13 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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