I am currently developing a network game based on PhysX.
As the game is to be a fast-paced FPS, I want to implement a lag compensation mechanism similar to some well-known games. To do this, I have to restore a previous PhysX simulation state when receiving a player command and re-execute the simulation with the new data.
The problem is: how can I restore the PhysX simulation state properly?
Naively, my first try was to restore the position and velocities (linear and angular) of the movable actors. This works well for most of the cases, except for the collisions: the simulation result is different the second time, even if nothing has affected the colliding actors.
I suppose that this is due to the fact that some actors may be restored with their positions overlapping, which is an incorrect physics state as described in the PhysX manual.
In the PhysX API, the only solution I see to address this issue is serialization. However, the documentation does not state explicitely if the whole simulation state is restored or not.
Maybe serializing only the scene and restoring it is enough (after my existing position and velocity restoration), or I may have to serialize and restore the scene and its content.
Or there may be another solution that I have not thought of yet.
Has anyone already experienced such kind of issues?
Does anyone has a clue how to force the position of dynamics actors without having some inconsistent states?