Class ECSSystem


  • public abstract class ECSSystem
    extends Object
    Abstract class that all systems should inherit from

    Defines four required components:

    1. The list of entities that have all the components required for this system
    2. The BitSet of component registrations required for this system
    3. The init() function, where logic that needs to be run once is performed
    4. The update(dt) function, where logic that needs to be run regularly is performed. dt is the delta time in millseconds
    Additionally, the object constructor should define the actual values of the BitSet.

    Additional functions can be implemented as required.

    • Field Detail

      • registrationSet

        protected BitSet registrationSet
    • Constructor Detail

      • ECSSystem

        public ECSSystem()
    • Method Detail

      • getRegistrationSet

        public BitSet getRegistrationSet()
      • init

        public abstract void init()
                           throws Exception
        Functionality that should be run only once. Implement additional parameterised init() functions as required.

        This is distinct from the constructor as this may be run as required any time between the construction and update(dt). It is not intended to set the actual bits of registrationSet in this function; that should be performed in the constructor.

        Throws:
        Exception - can return exceptions to the main program if an issue occurred.
      • update

        public abstract void update​(double dt)
        Functionality that is expected to be called regularly Intended as a template only; may be superficially implemented. Implement additional parameterised update() functions as required.
        Parameters:
        dt - delta-time; the change in time in milliseconds since this function was last run