godot_rapier3d icon indicating copy to clipboard operation
godot_rapier3d copied to clipboard

Are we able to enable determinism?

Open ValorZard opened this issue 4 years ago • 2 comments

Hello! I'm quite interested in working on a rollback netcode project using Rapier, since it has a deterministic component. Godot's own physics are not great for this, but apparently according to this person, they were able to get a similar effect by controlling Box2D. https://github.com/godotengine/godot-proposals/issues/2821#issuecomment-854124881 I was wondering if a similar effect could be enabled with this, especially if the determinism feature flag could be enabled.

ValorZard avatar Jun 22 '21 09:06 ValorZard

To enable determinism you just need to replace the "simd-nightly" feature with "enhanced-determinism" in rapier3d/Cargo.toml.

For complete determinism serde-serialize or cloning the Space state may be necessary though simply saving & restoring state using GDScript may also be sufficient. It is likely that not all necessary info for full determinism is visible to the GDScript side though.

Manual stepping should be as simple as exposing the existing step method in Godot.

Demindiro avatar Jun 22 '21 14:06 Demindiro

Thank you for the quick response! It would be really cool if we could get determinism working with godot, as it would allow for lockstep networking and rollback netcode solutions to both work. Right now, most rollback solutions rely on sending state, which isn't as efficent.

ValorZard avatar Jun 22 '21 20:06 ValorZard