javaentitycomponentssystemartemis

The purpose behind the bit data in the Artemis ECS


What is the purpose behind the bit member in the Component Type, and the TypeBit and SystemBit members in the Entity for the Artemis ECS?

These are some screen shots for the git repository of the Artemis ECS that refer to ComponentType and Entity:

For ComponentType

For <code>ComponentType</code>

For Entity For <code>Entity</code>

Here is the link to the git.


Solution

  • Look into https://github.com/gemserk/artemis/blob/master/src/com/artemis/EntityManager.java - at addComponent function. It calls

    e.addTypeBit(type.getBit());
    

    Also removeComponent() calls:

    e.removeTypeBit(type.getBit());
    

    So it's just an id for a component inside entity. The other id is for collecting component types in the EntityManager.

    Anyway, it's a bit old implementation. Take a look at fork called artemis-odb which is greater in performance and actively developed. ComponentType is also refactored.