I am using
ncollide in a fast-paced multiplayer network game. The server is authoritative, simulating the game and sending the world state to clients periodically in snapshots. Clients perform local prediction of the state of player-owned entities according to local input, so clients maintain their own copies of the
CollisionWorld. In case of a local prediction error (or lag), clients reset the state of objects to the correct state, as received in a snapshot from the server.
After a client has reset its local state to the server’s state, simulation should proceed deterministically on server and client (up to numerical differences, and unless another prediction error occurs). However, I’m not sure if
DefaultNarrowPhase contact point generation will be equivalent on server and client after snapping/resetting the world state. As far as I understand,
IncrementalContactManifoldGenerator for example will keep track of state over multiple time steps. Then, the client’s contact generator might remember some state from the prediction, even after resetting to the server’s state, causing simulations to diverge.
So essentially I am looking for a way to use
ncollide in a way such that contact point generation depends only on the current state, completely disregarding information from previous frames. I would prefer to continue using
CollisionWorld. Would it make sense for me to implement my own
NarrowPhase, which does not keep contact generators over multiple frames, and instead calculates contact points from scratch in every frame?