The rewind simulation is inconsistent #49
-
Sorry for my poor English, please ask me what state of synchronization should be required for rewind. At present, I use BepuInt version in Unity and server simultaneously, and the synchronization method I use is Rocket Alliance's full prediction scheme, everything is normal when there is no rewind, but once the rewind happens after physical simulation, There will be errors on the client side and the server side, and my rewind is just a re-simulation of the input. May I ask if there is a solution, or what part of me has a problem? I would be grateful if you could answer me。 This is my simulation code: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
The simulation has internal state which affects the result, like broad phase tree topology, constraint order, and solver accumulated impulses. Positioning objects at an earlier pose/velocity does not reset the other internal state. A couple of options:
There's no super easy and cheap solution, unfortunately. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your quick reply, and you are right. According to your second suggestion, I found that the execution sequence of each Tick foreach is different (applying pulse and recording snapshot). After I fixed the execution sequence of foreach, this problem was solved, and my FixedUpdate was 24Tick. Space is 120Tick, in order to optimize the network delay, I added the function of variable speed, but dt in space.update (dt) will not change. At first, I thought it was the problem here, but now everything seems to be smooth, and the local prediction will be 100% successful when the other party does not operate, which makes me very happy. Physical network synchronization is an interesting thing, thank you for your help to me, wish your physics engine can develop better and better, and finally wish you a happy life. 😀 |
Beta Was this translation helpful? Give feedback.
The inertia tensor is just the rotated local inertia tensor. If it doesn't match, it's because either something changed the local inertia tensor, or (more likely) the orientation doesn't match.
I don't mean to resimulate from the first frame, but rather to rebuild the simulation using the most recent state. Rebuilding the simulation means that all internal state differences accumulated over updates are wiped out.
To phrase it another way, imagine 3 cases: