System

Inherits: Node

A System is used to make the things in your Game go.

Description

A System will process entities that contain, or do not contain, a certain type of Component.

For example, say your game needs to be able to move an Entity across the scene. You would need some kind of Component that stores the direction and speed of an Entity, let’s call it “Velocity”. To move the Entity, we would create a System that would only run over Entities that have the “velocity” Component, and then calculate the velocity.

You might then create another System that uses Entities that have a “velocity” Component to move them to the next position in the Scene based on the Velocity that was previously calculated, and so on.

You can make your System as simple or complicated as needed, but we have found that breaking up your game into smaller, logical domains or behaviors makes development of your game easier, without any type of large performance hit.

Note

In some cases it does not make much sense to use a System. If you are, for example, creating a bullet-hell type of game, it might be more efficient to use the standard Godot processing loop to move those. However, the Collision Checking and Spawner for the Bullets might be created with a System. The Framework is flexible enough to let you decide the best place to use it.

Note

We suggest that you check out the simple example project to get a better understanding of how everything works together. It should help you understand where a System fits into the Framework.

Methods

void on_init ()
void on_ready ()
void on_before_add ()
void on_after_add ()
void on_before_remove ()
void on_after_remove ()

Property Descriptions

Lets you enable the entity by setting this to True. When an Entity is not enabled when its setting is False, it will not be included during System updates.

A very simple comma separated list of Component names to be processed when the updated.

The syntax is

{component} any Component matching this name
!{component} any Component not matching this name

In the example below, the System will process all Entities that have a Velocity and Move Component, but not an Enemy component.

velocity, move, !enemy

You can treat each comma as an AND statement for each Component. So another way to read the above is

**velocity** and *movement** and not **enemy**

Method Descriptions

  • void on_init ()

The framework provides this in place of the _init() call.

  • void on_ready ()

The framework provides this in place of the _ready() virtual call.

  • void on_before_add ()

The framework will make this virtual call just before the System is registered.

  • void on_after_add ()

The framework will make this virtual call just after the System has been registered.

  • void on_after_remove ()

The framework will make this virtual call just after the System is removed.

  • void on_before_remove ()

The framework will make this virtual call just before the System is removed.