-
Notifications
You must be signed in to change notification settings - Fork 115
EntitySystem
A system is typically an implementation that iteratively operates on a group of entities that share common components (typically EntityProcessingSystem), or just general game logic (typically VoidEntitySystem).
Artemis provides several abstract classes to base your Systems on.
- VoidEntitySystem - Game logic that does not require entity matching.
- EntityProcessingSystem - Process entities matching aspect each tick.
- IntervalEntityProcessingSystem - Process entities matching aspect at fixed ms interval.
- DelayedEntityProcessingSystem - Process entities matching aspect at varied ms interval.
If you have an active process you need to model, or If you need to step over entities that match a certain component profile, implement it as an EntityProcessingSystem, VoidEntitySystem, or any of the other systems.
If you need to serve or organize objects and assets (components, entities, fonts, graphics, sounds) for Systems, use managers instead.
Utility methods can be implemented as either managers or void entity systems.
world = new World();
world.setSystem(new MyCustomSystem1());
..
world.setSystem(new MyCustomSystemN());
world.initialize();
Your registered systems are called in whatever order you added them to the world each time you run:
world.setDelta(float delta)
world.process()
Systems are never immediately informed of created, altered or removed entities. Instead the change is delayed until World#process()
is called, or just before the next system runs. Entity state changed performed inside EntitySystem#begin
won't be reflect in the current system until the next time it's processed.
Prior to 0.7.0
, a call to Entity#changedInWorld()
or Entity#addToWorld()
is required to update all the system entity subscription lists. In 0.7.0
, calling Entity#edit()
schedules this update automatically.
Systems can communicate with other systems. Retrieve other systems via @Wire. You can define whatever methods you deem necessary for inter-system communication.
Manually initialize aspects of your system by overriding the Initialize method.
Override checkProcessing
to return false if you want to suspend system processing.
You can override added and removed methods in each system. There you will be notified about entities that were either added into or removed from the system.
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference