I'm trying to make a scalable world state model for handling entity updates (ships, projectiles, explosions). Since the majority of the time spent in a state update will be on entity updates, I want to make them highly parallelizable for use in a C# Parallel.Foreach loop. In order to accomplish this, I've gone with an approach where each world state is completely immutable, and entities update by creating clones of themselves with changes applied, which are then placed into the next stored world state. This also makes all collisions order independent, since each entity must look at the current world state and independently decide how it should react to the collision.

External calls to modify the world are queued as actions to perform on the next Update(). Once Update() is called, a new mutable world state is created. All queued actions are retrieved and performed on that new world state, and each entity from the old state creates an updated clone to place in the new state. The update process can generate two kinds of events. Internal events are immediately queued for the next update, while external events are stored and frozen in the world state. The new world state, with the updated entities (also added/removed entities) and any external events that were generated that timestep, gets frozen and goes out to whoever wants to visualize that state (server broadcasts to clients, clients display).
The area highlighted in orange is where I want to parallelize. Here's the update process for each entity in detail:

Entities read the previous world state, themselves, and take any incoming events relevant to them (an explosion nearby, a change in their control state) and produce an immutable clone of themselves. Because nobody is writing any data here (and regular C# iterators are thread-safe for read access), each one of these entity updates could theoretically run on its own thread with no problem. So I want to batch their updates.
I guess my question is, does this seem reasonable? Cloning is expensive, but is it as expensive as the calculations needed for each update (collision detection, timer countdowns, control resolution, applying forces, etc.), so I think the tradeoff is worth it. Do any other games work like this? I couldn't find any FPS examples where immutable states are generated by cloning, but most of what we have to work with (Quake 3, Source SDK) didn't design servers with multicore in mind.
Any advice would be helpful. Thanks!




















