EntitySystem flat table of Components, why not of Entities?

https://jmonkeyengine.github.io/wiki/jme3/contributions/entitysystem/detailed.html

any real good reason to be a flat table of Components, instead of
HashMap<Long,Entity> (long is the entity Id)

and each entity have its own
HashMap<Class<Component>,Component>

the flat table of components appears to be over-simplification, or has a real good reason for that?

Each component might be stored or cached differently. An “Entity” is just a view of some subset of components.

it doesn’t save you anything because you’d still have to shuffle everything around to make the Entity views… only now you’d have to load a WHOLE entity from disk just to do it. You’d lose the flexibility of having some components in persistence, some in RAM, some on server X, some on server Y, etc…

1 Like

good to know these things!
1st steps on Zay-ES and I am liking it a lot,
it is also much more readable than the mess I was creating,
thx!

1 Like