In an Entity System I am making, there is a central class called
World, which stores all component instances. It's a dictionary-of-arrays, and entity ids are indexes for the arrays.
To access a component of an entity with
id = 3 you would do this:
So, each loop of the game, these arrays would be fed to their respected systems (
movement(world.storage["Position"], world.storage["Velocity"]) ).
Now, I don't see why systems couldn't be implemented just as functions, as I showed. What optimizations can be made by using classes with data and methods (caching)?
Also, these systems would need to iterate over all the entities that exist, doesn't this make entity frameworks much slower than regular inheritance based engines? Why do some people "register" systems to the