Server and Client syncronization - worldscapes/engine GitHub Wiki

Problem

How to synchronize server world state and client world state.

When Client world state is created

Next tick after new client connected server sends entire server-side state to client via network. This state should be taken as initial client state.

This allows clients to reconnect at any moment.

How Client world state is updated

Every Server simulation tick Server world state is updated.

Update is calculated by Engine automatically by Merge layer. To manage this process User defines which Entities should be passed to Client and kept synchronized.

Client simulation restrictions

Since some Entities are updated by Server, their changes can be overriden. It's fine when doing things like Extrapolation and so on.

Some Entities are just Client-side, so they can be freely managed by Client. This includes Cameras or some helper Entities and Resources.

To mark Entities special NetworkAutority and LocalAutority components are used. It allows User Rules to flexibly pick different Entity types to work with them.