I am currently working on my first network-based game. The game is a real-time topdown RPG and uses a client-server architecture.
The basic architecture already works and right now I am trying to figure out what the best way to synchronize the world state might be. I often read that you would have a server loop that will send world state updates every 50ms. That sounds reasonable for continuous variables like positions, but what about one time events like spawning an entity or attacking?
My current idea is the following:
- Every time a player connects, send him the whole world state immediately.
- Every 50ms send an update for positions, life, mana and such things to all clients.
- Handle one time events (entity spawning, attacking) immediately.
I am not sure if that is the right way to do it, but it would definitely be the easiest. The alternative I think would be to store those events and send them together with the current world snapshot, but I am not sure if that would be a good idea. I hope you can shed some light on this issue. Thanks a lot.
Greetings,
Pfaeff