System
A System
is an object assigned to app lifecycle and used to
do some work such as dispatching events or manipulating entities.
Systems can be ordered with order
properties
Systems are the backbone of Ceramic's architecture, providing a way to organize game logic into modular, reusable components that integrate with the application lifecycle.
Key features:
- Two-phase update cycle (earlyUpdate and lateUpdate)
- Automatic ordering via earlyUpdateOrder and lateUpdateOrder
- Named systems for easy retrieval
- Automatic registration with app.systems
- Events for update lifecycle hooks
To create a system:
- Extend the System class
- Override earlyUpdate() and/or lateUpdate() methods
- Set appropriate update orders
- The system auto-registers on creation
Example usage:
class PhysicsSystem extends System {
public function new() {
super();
name = "physics";
earlyUpdateOrder = 100;
}
override function earlyUpdate(delta:Float) {
// Update physics simulation
}
}
// Create the system (auto-registers)
var physics = new PhysicsSystem();
// Later, retrieve it by name
var physics = app.systems.get("physics");
Instance Members
name: String
System name. Useful to retrieve a system afterwards
autoUpdate: Bool
When set to true
(default). This system will be updated automatically.
If false
, you'll need to call earlyUpdate()
and lateUpdate()
manually.
earlyUpdateOrder: Float
Order of earlyUpdate execution.
Given two systems, a system with a lower earlyUpdateOrder
value will have
it's earlyUpdate()
method called before another system's earlyUpdate()
method with a higher order
value.
lateUpdateOrder: Float
Order of lateUpdate execution.
Given two systems, a system with a lower lateUpdateOrder
value will have
it's lateUpdate()
method called before another system's lateUpdate()
method with a higher order
value.
destroy(): Void
new(): Void
Private Members
beginEarlyUpdate event
Name | Type |
---|---|
delta |
Float |
endEarlyUpdate event
Name | Type |
---|---|
delta |
Float |
beginLateUpdate event
Name | Type |
---|---|
delta |
Float |
endLateUpdate event
Name | Type |
---|---|
delta |
Float |
Method automatically called right before app's update
event.
Override this method to implement system logic that needs to run
before regular entity updates.
Name | Type | Description |
---|---|---|
delta |
Float | Time elapsed since last frame in seconds |
Method automatically called right after app's update
event.
Override this method to implement system logic that needs to run
after regular entity updates.
Name | Type | Description |
---|---|---|
delta |
Float | Time elapsed since last frame in seconds |
Metadata
Name | Parameters |
---|---|
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:access |
ceramic.Systems |
:allow |
ceramic.Systems |