Show differencesHistory of post edits
Posted 14 May 2013 - 09:46 PM
I don't see any compelling reason to disallow holding state in systems, with the exception that it is nice if the entire game state can be serialized just by serializing all the entities and their components. If the systems hold important game state, then you need to allow them to participate too.
(I know I keep coming back to the save game scenario. But being able to serialize/deserialize your game state is actually useful for more than just save games. Being able to quickly get back into a certain scenario to debug a particular problem is one example).
Posted 14 May 2013 - 09:39 PM
Well, I hold onto some state in some of my systems. For instance, the render system keeps track of information necessary to map a particular "aspect" component to an instance of a model that is inserted into the render tree. Similarly for the physics system that maps a physics component <--> physics library I'm using. This is mostly transient state (internal bookkeeping for the systems, essentially) that I don't see as belonging in any component (as that would tie a component to a specific renderer).