dominion-dev/dominion-ecs-java

QUESTION: Is it possible to work with entities with more than 6 components?

langurmonkey opened this issue · 2 comments

Right now, the Dominion.findEntitiesWith() method accepts up to 6 component types. The returned Results object maps the types for each component by position and allows for their retrieval. Is there a mechanism in place to enable finding and working with entities with more than 6 components? Is this something that will come at a later stage?

Hi Langur,
the short answer is yes.

The long answer is yes, but you will still unpack max 6 components, as I plan to add the new method on the Results and it will accept more components type without any limit.
In this way, you will be able to refine your entity search with any number of component types but you will still get unpacked max 6 components.

Why?

  • Getting even more components means lower performance (cache line size is limited)
  • Having a single system that needs to unpack so many components is a clear sign that it is taking on too many responsibilities.

The updated Results API maybe:

(new) -> andWith
excludeWith -> andWithout
withState -> andWithState

Awesome, cheers!