-
Notifications
You must be signed in to change notification settings - Fork 114
System
Daan van Yperen edited this page Sep 29, 2015
·
24 revisions
Systems encapsulate game logic, typically operating on a family of entities.
Extend one of the following:
Class | Extend when you want to |
---|---|
int | |
IteratingSystem | Process a subset of entities each tick. |
BaseEntitySystem | Track a subset of entities, write your own sort/iterate yourself. |
IntervalIteratingSystem | Process a subset of entities every x ticks. |
DelayedIteratingSystem | Track cooldown per entity, processing entity when its timer runs out. |
Entity | |
EntityProcessingSystem | Process a subset of entities each tick. |
EntitySystem | Track a subset of entities, write your own sort/iterate yourself. |
IntervalEntityProcessingSystem | Process a subset of entities every x ticks. |
DelayedEntityProcessingSystem | Track cooldown per entity, processing entity when its timer runs out. |
other | |
BaseSystem | A completely customizable system or manager. |
Register with WorldConfiguration#setSystem before passing it to World.
Your registered systems are called in the order added to WorldConfiguration.
Systems can access other systems. Like all odb-native types Systems get injected automatically into your System
.
public MySystem extends ... {
MyOtherSystem myOtherSystem; // automatically injected.
}
See @Wire for details.
Override #initialize()
to initialize your system, not your constructor. Initialize is called after dependency injection.
class MySystem extends BaseSystem {
@Override
public initialize()
{
// custom initialization.
}
}
Override checkProcessing
to return false if you want to skip the system during processing.
You can override inserted
and removed
methods in EntitySystem and derived classes. There you will be notified about entity changes.
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference