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

Engine loop scales worse than expected #2

Open
1 of 3 tasks
JSKitty opened this issue Aug 18, 2022 · 2 comments
Open
1 of 3 tasks

Engine loop scales worse than expected #2

JSKitty opened this issue Aug 18, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@JSKitty
Copy link
Owner

JSKitty commented Aug 18, 2022

The engine loop (consisting of both Physics and Rendering) is a fair bit slower than I'd expect with the hardware it runs on, often fully maxing out a CPU core with a decent simulation; I suspect there's a lot of optimisations that could be done to help with this, such as better re-sim protection (perhaps only track 'changed state' particles rather than ALL rendered particles?).

We could also potentially implement a system to 'deactivate' buried particles, since if a particle is surrounded below (y + 1) or either side (x +/-) then it cannot possibly move, yet is still included within full physics computation.

And lastly, which is most effective but highly challenging; we could potentially think about multi-threading the engine, but due to it's high reliance on a singular state (how would we be able to simulate two particles at once on two separate threads without a 'desync' in physics determinism?) this may be fairly hard to do.

Live Task List:

  • Optimise the re-sim protection by only tracking particle state changes.
  • 'Deactivate' still particles (i.e; unable to move) from the physics loop.
  • Introduce multi-threading in some form.
@JSKitty JSKitty added enhancement New feature or request help wanted Extra attention is needed labels Aug 18, 2022
@JSKitty JSKitty self-assigned this Aug 18, 2022
@JSKitty
Copy link
Owner Author

JSKitty commented Aug 18, 2022

I'm currently working on this as I speak (re-sim protection optimisation) and thinking of other scaling solutions, but posting this both as a reminder to myself and to let anyone else contribute if desired. ❤️

@JSKitty
Copy link
Owner Author

JSKitty commented Aug 18, 2022

✔️ Re-sim protection optimised!

It was a ridiculously simple improvement which I somehow glanced over - but this has introduced a huge speed-up for the engine in terms of scaling compared to previous levels, yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant