godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.78k stars 3.07k forks source link

Document that the Godot physics engines aren't deterministic #5202

Open Calinou opened 3 years ago

Calinou commented 3 years ago

Your Godot version: 3.3.3

Issue description: None of the physics engines provided by Godot are deterministic, regardless if you use RigidBody or KinematicBody. This should be documented somewhere because it has implications on networking and replay systems. For instance, you need to store players' transforms in replays instead of players' inputs to avoid random desyncs that would happen otherwise.

See also https://godotengine.org/qa/114615/is-the-godot-engine-reliable-for-counting-frames.

URL to the documentation page (if already existing): Not sure, any suggestions?

mhilbrunner commented 3 years ago

I mean, sure, it would be good to document this - but determinism is something I'd never expected or assume if it wasn't outright stated.

Xrayez commented 3 years ago

There are new physics engines that pop around the corner like Rapier that claim to have deterministic physics. It would be good to document that Godot's physics is not deterministic, but more importantly it would be good to document that Godot does not plan to implement deterministic physics in the future, which I'd say is more important to emphasize (I recall reduz was highly against it last time I asked about it at IRC).

Implementing a physics engine which is deterministic across platforms is a great endeavor and I simply do not think that it's something that Godot developers would be interested to implement at all (doing so would be against Godot's development principles, regardless of community needs), considering that game state synchronization will likely be cheaper to implement once people get low-latency, "ultra-high" speed Internet connection. 🙂

But at the same time, most people I've talked with that implemented deterministic physics (in 2021, Unity) come up with their own game-specific solution. That's a recommendation I'd write in documentation: either use a third-party solution like Rapier, or implement it yourself! Most games that require determinism are highly physics-centered, and use physics as the core gameplay component, so if you work on something like this, then I wouldn't recommend using Godot built-in physics in the first place for those kind of use cases.

URL to the documentation page (if already existing): Not sure, any suggestions?

Adding a section to https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html may be enough.