Skip to content

Glossary

Andrea Catania edited this page Jul 19, 2021 · 16 revisions

This page is a collection of keywords used in Godex.

Entity

An Entity is just a container of components, differently from an Object it doesn't have any behaviour or meaning; it can be anything, and its behaviour is driven by the assigned components.

Under the hood, the entity is just an ID.

Example

external-content duckduckgo com

You could represent the mushrooms power-ups in Mario with the following set of components:

  • PhysicsBody: Used to specify this Entity has a RigidBody.
  • Position: Used to specify that this Entity has a position.
  • GrowPowerup: Used to specify the type of the power-up.

Or the character (Mario) could be done with the following set of components:

  • PhysicsBody: Used to specify this Entity has a RigidBody.
  • Position: Used to specify that this Entity has a position.
  • Character: Used to specify this entity is the character.

Component

The Component is a piece of data that can be attached to an Entity. It can describe a characteristic, a state, an event of an Entity. Usually, taken alone, the components doesn't do much: but the combination of them allow building complex mechanisms easily and easy to maintain.

Example

Example of some components:

  • TransformComponent: Describes the 3D world location.
  • MeshComponent: Describes the associated mesh.
  • Visible: Describes the visibility state.
  • Hit: Event that notify this Entity got hit.

Tag

Called tag or TagComponent it's a Component but without data. It's used to mark and differentiate the Entities:

Example

  • BlueTeam
  • RedTeam
  • Character
  • Enemy

💡 Note that the tag component is not a special component type. The keyword exists just to give more flavour.

Databag

The Databag is a global piece of data, and it's used to store global utility information.

Example

List of some Databags:

  • FrameTime: Databag where the frame delta and the physics_delta is stored.
  • OsDatabag: Where it's stored some info about the OS (timestamp, platform, date).
  • EngineDatabag: Where the engine details are stored.

World

The World contains all the Entities, all the Components, all the Databags. Think about the World, like the container of all the data.

WorldECS

The WorldECS is a Node that wraps the World, so you can easily add it to your main scene. It's a lot similar to the Environment node. It allow to set the Pipelines, configure the Component storage, provides some utilities to easily access the Databags, Components; It allows to easily create new Entities, etc... So this Node is the main entry point for the ECS.

System

The System is just a function that perform some operations on the World data. It manipulates (transform) the Entities, Components, Databags data. The System is defined by the user, and represent a piece of game logic.

Example

List of Systems:

  • TimerSystem: Advances the timers clock till it expire.
  • MoveSystem: Moves the Entity locations.

Query

The Query is used by the Systems to fetch the Components from the world; it returns the Entities that fulfills the request.

void timer_system(Query<TimerSystem> &p_query){}
void move_system(Query<Velocity, TransformComponent> &p_query){}
void heal_system(Query<Health, Heal, Maybe<ExtraHealPowerup>> &p_query){}
void damage_system(Query<Health, Damage, Without<Immunity>> &p_query){}

DynamicQuery

The DynamicQuery is exactly like the Query, with the difference that can be used when you code a script; while the Query can be used when you use C++.

You can read more about those two: https://github.com/GodotECS/godex/wiki/Query

Storage

The Storage is the memory class used to store the components. There are different type of storage, each with a different set of features.

BatchStorage

Exactly like the Storage but allow to store more entries of the same Compnent per Entity. For example, you can have an Entity with more Damage component.

Batch Component

The Batch Component is a component that is using a BatchStorage, so each system can have more entries of those components.

Batch

The Batch is a filter that can be used with the Query to give access to the Components stored in batches.

Event

The Event is a struct that contains some data, and usually it's emitted by one system and received by many systems. Here the full documentation.