Core Modules¶
Tengine’s core functionality is organized into several key modules, each playing an important role in the ECS system. Below is an overview of each of these core modules.
- class tengine.core.world.World[source]¶
Bases:
objectWorld represents the simulation environment containing entities and systems.
- entities¶
A list of entities in the world.
- Type:
list
- systems¶
A list of systems that are responsible for updating entities.
- Type:
list
- add_plugin(plugin: Plugin)[source]¶
Adds a plugin to the world.
- Parameters:
plugin (Plugin) – A plugin to be added to the world.
- add_resource(resource: Resource)[source]¶
Adds a resource to the world.
- Parameters:
resource (Resource) – A resource to be added to the world.
- add_system(system: System)[source]¶
Adds a system to the world.
- Parameters:
system (System) – A system to be added to the world.
- mainloop()[source]¶
Main loop of the world. This method runs indefinitely, updating the world at each iteration
- class tengine.core.entity.Entity(components: list[Component])[source]¶
Bases:
objectEntity represents a single object in the simulation world. It can have multiple components that define its behavior and properties. .. attribute:: id
Unique identifier for the entity.
- type:
int
- components¶
A list of components associated with the entity.
- Type:
list
- class tengine.core.component.Bundle[source]¶
Bases:
objectA bundle is a collection of components that can be added to an entity. Bundles are used to group related components together for easier management and organization.
- class tengine.core.component.Component[source]¶
Bases:
objectBase class for all components in the simulation. Components are used to define the properties and behaviors of entities. Each component should inherit from this class.
- class tengine.core.system.System[source]¶
Bases:
objectSystem is an abstract base class that defines the interface for all systems in the simulation. Each system is responsible for updating a specific aspect of the entities in the world.
- abstractmethod startup(entities: list[Entity], resources: Resources) bool[source]¶
Initializes the system with the given entities and world information. :param entities: A list of entities to be initialized. :type entities: list[Entity] :param resources: The resources available to the system. :type resources: Resources
- abstractmethod update(entities: list[Entity], resources: Resources) bool[source]¶
Updates the system with the given entities and world information. :param entities: A list of entities to be updated. :type entities: list[Entity] :param resources: The resources available to the system. :type resources: Resources