Chaos Async not deterministic enough for network prediction?

The problem

I’m trying to make a networked physics based game so I studied the async physics in UE5, for the premise of being almost deterministic so maybe it could be used to make client side prediction reliable.

I tried reusing a portion of the Network Prediction plugin (just the async part, which is completely separate from the rest) to see if a client could stay in sync with the server.

The results were not great…
Enabling np2.debug and np2.logCorrections, it appears to be corrections almost every frame!
Now, I still don’t know for sure if it’s a bug in the plugin’s code (maybe it’s comparing the wrong frames?) or Chaos’s async not being deterministic enough.

I ran another test to check the determinism of the async physics by positioning a handful of cones at different orientations and letting them fall on a steeped floor with some obstacles.
I ran the simulation dozens of times and the cones always ended up in different positions…

What to do?

So the question is… Is it really possible to make client side prediction using Chaos? If not then what can I do to have complete server authority with lag compensation?

I heard that Rocket League used Bullet physics engine for their network prediction solution, if anyone has done this or has more information I’d love to know.

You can definitely do client side prediction with Chaos. The trick is that you need to make sure that Chaos is running in deterministic mode by calling FPBDRigidsSolver::SetIsDeterministic or enabling rewind capture (which I assume you’ll want since you’re doing rollback). It’s possible that you also have a some kind of bug in your code that’s causing corrections.

I’ve been working on a plugin to do client side prediction with Chaos as well, and in my experience Chaos is 100% deterministic between the authority and the auto proxy, at least on the same machine. Chaos doesn’t currently account for floating point errors, so you will have some deviation on different architectures. If you’re curious you can check out the code (still big WIP): GitHub - BlueSpud/ClientPrediction at v0.2

The v0.2 branch is using async physics. You’re free to use the plugin in your own project (even commercially), but I might make breaking changes and it isn’t as full-featured as Network Prediction.

Good luck!

2 Likes

Hi, just wanted to check in with you on how the progress on this plugin has been as the github link doesnt seem to be working