cscorley / bevy_ggrs_rapier_example

MIT License
45 stars 4 forks source link

swap to ggrs built-in desync detection #26

Closed cscorley closed 8 months ago

cscorley commented 1 year ago

After the Bevy 0.10 update, we can swap this example to use the new built-in desync detection in GGRS.

Pros:

Cons:

However, I think this con is completely mitigated because we already have to save off the physics state into a dedicated resource anyhow, and that is Reflect(Hash) since it is just one big Vec. This uses bevy's ahash, which is deterministic on the same platform, but not sure about cross platform yet. Would still need to figure out if that is true or not.

cscorley commented 1 year ago

as an alternative, matchbox also now has a nice side socket for other messages that could be useful to send over the hashes instead of globbing them onto the input

cscorley commented 1 year ago

I think it is plausible for this to not have the same hash cross platform yet due to ahash. I have not been able to test to confirm this, but I think this will be the case just going by documentation and reading the bevy source around this. I think we'd have to patch bevy to have an even more deterministic hasher for it's reflect_hash

cscorley commented 1 year ago

I tried to implement this. I think there are serious issues with the GGRS desync detection that require specific implementation workarounds. It sends unconfirmed frames and uses them to validate. I think it needs to be re-written with the concepts we have here.

cscorley commented 8 months ago

Good news, this was fixed in https://github.com/gschup/ggrs/pull/64

cscorley commented 8 months ago

We should be able to avoid platform specific hashing issues by supplying our own hasher to the plugin now via the .checksum_resource::<PhysicsRollbackState>(HASHER) option. Very exciting! But would want to confirm this is the case first.