etherealengine icon indicating copy to clipboard operation
etherealengine copied to clipboard

[EPIC]: Parallelize the ECS

Open speigg opened this issue 2 years ago â€ĸ 0 comments

We have attempted to put physics in a worker in the past, and ran into several problems. I think with the cleaner codebase and abstractions we have now, this should be easier for us to figure out.

  1. Particle System - Since the particle system is more isolated and decoupled from other systems (we don't need to know the results of the particle simulation beyond rendering them), this is probably the easiest place to start.

  2. Physics - The physics system is a bit tricker, since we access the underlying rapier objects in a few places, but should also be doable.

  3. Entire Simulation Pipeline ? - This seems possible, but might be more difficult. If we use Shared Array Buffers, we should be able to easily update the ECS from multiple threads, but we should be very careful about how that is managed. ALSO, we'd have to find a way to sync engine state (if we need it in the worker)—a bit more annoying than SharedArrayBuffer, but should be doable, in theory.

https://surma.dev/things/is-postmessage-slow/

https://surma.dev/things/actormodel/

speigg avatar Apr 22 '23 00:04 speigg