I’m trying to put together how the various components of the Entities package fits together. My understanding is that a World “owns” a bunch of systems and the systems get access to the world through the Entity Manager. Now traditionally one would expect it simple to reason about world updates as just triggering an update per world, but my understanding is that it’s not quite the intent.
In a single world setup the update loop simply builds up the structure of the loop and then steps the various systems according to that structure. At a high level firstly being the InitializationSystemGroup → SimulationSystemGroup → PresentationSystemGroup. Now this is nice and simple to reason about, but in a multi-world setup things get slightly more complicated.
I have not yet found a reason why I would want to use a multi-world setup as of yet and that might just be why this is puzzling me. There’s potential for two worlds to share the same system type, but I’m unsure what the update loop’s resulting structure would imply with a setup like this. Adding concepts like the Physics package then further complicates things as one Entities World looks like it can have multiple Physics worlds (note that the Physics worlds isn’t an Entities world, but rather a very specialised structure that serves the physics engine). From what I can gather it does seem like one Physics world can’t be used across multiple Entities Worlds, but I could be misunderstanding this concept as well.
Now finally my goal is to just get some guidance and clarification on the types of things to take into account that would necessitate a multi-world setup as well as how the systems associated with another world would best be managed from the perspective of the update loop. Ultimately the only real use I see for multi-world setups is to allow easily bootstrapping some data in another world that you don’t want to have present immediately and are able to bootstrap while the rest of the simulation is running and then just copying the resulting data in bulk to the main world.
The primary purpose of Worlds is to provide full & complete isolation of all data.
Thus one physics world being used by the same Entity World is not a use case we had in mind.
There are plenty ways in which data can be processed with filtering using shared components on only a part of the world or in chunks etc. Splitting things into multiple worlds is not a recommended approach for that.
A good use case of multiple worlds is for example:
Server & client seperation. Clearly you wouldn’t want to share physics worlds here
Deterministic simulation. For deterministic simulation, it is required to seperate the deterministic part from presentation / rendering / UI. Complete isolation is the primary purpose here
Running multiple totally isolated worlds on a server
Preparing data to be streamed in before it becomes visible to the simulation code
Thanks @Joachim_Ante_1 for the reply. This actually gives quite a bit of insight for me into the idea of multi-world setups. I hadn’t considered having a smaller deterministic solution that would have it’s data copied into the the world as a use-case.
We now Use DOTS for server logic but using separate worlds dont looks like usable approach because we have about 50 systems and for 1000 worlds we will have 50 000 systems and 1000 EntityManagers. Most of the time will be consumed by those redundant systems.
Is there plan to have one set of systems for multiple worlds?
How creating multiple world can help on server? Can you elaborate please?
I dont see a problem with having 1000 entity managers per se.
If you have only < 100 entities in each world, then yes thats probably not the most efficient setup.
Doing isolation yourself all in one world might scale better when the entity count is very small.
I was thinking about:
Timeslicing 10 worlds or so per core for a simple FPS game
Async simulation. Eg. card games, turn based games. Which really only have to update when the user finishes a turn. Explicitly running the simulation of one world, only when the turn ended on the server is very easy to do with the multiple world setup.