Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make contacts deterministic across Worlds #480

Merged
merged 7 commits into from
Aug 23, 2024

Conversation

cBournhonesque
Copy link
Contributor

@cBournhonesque cBournhonesque commented Aug 4, 2024

Objective

We noticed an issue where the Collisions were using the order of Entity directly to sort the pair of entities in a contact.
The issue is that for networking, there is no guarantee that the pair of Entities that are replicated between a Client and a Server world are in the same direction.

Solution

Test

  • tested in lightyear that the simulations are now completely deterministic
  • probably need to test that contact matching works correctly, even if the aabb.min.x of the two entities gets swapped during the contact

@cBournhonesque
Copy link
Contributor Author

Maybe the docs should be improved as well to make clear that:

  • Collisions has the keys in entity order
  • Contacts has the entities in aabb order (and it should probably use aabb.min.y as secondary sorting key?)

@Jondolf Jondolf added C-Bug Something isn't working A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality A-Determinism Relates to consistent behavior across runs or platforms labels Aug 23, 2024
@Jondolf Jondolf merged commit 63580d3 into Jondolf:main Aug 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality A-Determinism Relates to consistent behavior across runs or platforms C-Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Determinism with contacts
3 participants