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

Remove DOTS in favor of Jobs+Burst. #459

Merged
merged 159 commits into from
Oct 29, 2023
Merged

Remove DOTS in favor of Jobs+Burst. #459

merged 159 commits into from
Oct 29, 2023

Conversation

freezy
Copy link
Owner

@freezy freezy commented Oct 17, 2023

So, DOTS v1.0 came out earlier this year. There are two major things that changed:

  • DOTS worlds must be contained in a sub scene.
  • Conversion is taking place at build time, through bakers.

Dynamically creating a sub scene when importing a table seems impossible. Dynamically adding entities to the sub scene without the hybrid renderer (now "Entities Graphics") also seemed impossible. Baking wouldn't be available when loading a table during runtime.

There are probably workarounds for all of this, but DOTS didn't seem a right fit since quite a while, for the following reasons:

  • All the systems are run from the main thread, and there are a lot of them. Even if they are bursted, there is an overhead launching jobs.
  • We can't really benefit from DOTS' main advantage: Handling insanely many entities efficiently. We usually only have one ball, maybe up to 10 for some games, but nothing was handled in parallel anyway, since we'd have to further split systems, adding more overhead.
  • While the systems are a nice way of organizing code, it comes with additional complexity when orchestrating the exact order of every system.

Enter the post-DOTS era. The physics loop is now one single bursted job. Data is still packed into structs and available through a PhysicsState that is passed to the systems that need access to it. Everything is passed by reference, so data is not copied between functions. This turned out to be very fast:

image
13k colliders at 0.2ms per frame.

vpe-collisions.mp4

60k colliders at 1ms per frame.

This was also the opportunity to replace VPX's octree with a faster and easier to use implementation by bartofzo. Tree creation is also insanely fast, allowing us now to introduce dynamic colliders. This will first be dynamic toggles, with the goal of making them fully dynamic, including velocities.

TODO before merge

  • Update doc
  • Convert and test remaining table projects

freezy and others added 28 commits October 22, 2023 18:41
Kicker mesh data and flipper correction state now use unmanaged data through pointers.
@freezy freezy merged commit 13c9dfe into master Oct 29, 2023
16 checks passed
@freezy freezy deleted the jobs branch October 29, 2023 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants