xecs.SimulationApp#

class xecs.SimulationApp(num_entities)[source]#

Bases: object

An app which runs as fast as possible.

Methods

add_plugin

Add a plugin.

add_pool

Add a preallocated pool of components.

add_resource

Add a resource.

add_startup_system

Add a startup system.

add_system

Add a system.

run

Run the app continuously.

update

Run the app for a single step.

Parameters:

num_entities (int) –

add_plugin(plugin)[source]#

Add a plugin.

Parameters:

plugin (SimulationAppPlugin) – The plugin.

Return type:

None

add_pool(pool)[source]#

Add a preallocated pool of components.

The pool will be used to hold any components which are spawned during runtime.

Parameters:

pool (ComponentPool[ComponentT]) – The component pool.

Return type:

None

add_resource(resource)[source]#

Add a resource.

Parameters:

resource (Resource) – The resource.

Return type:

None

add_startup_system(system)[source]#

Add a startup system.

Parameters:

system (Callable[[...], Any]) – The system.

Return type:

None

add_system(system, run_condition=None)[source]#

Add a system.

Parameters:
  • system (Callable[[...], Any]) – The system.

  • run_condition (Duration | None) – The time step between runs of the system. If None the system will run every frame.

Return type:

None

run(num_steps, time_step)[source]#

Run the app continuously.

Parameters:
  • num_steps (int) – The number of steps to run.

  • time_step (Duration) – The length of time each step simulates.

Return type:

None

update(time_step)[source]#

Run the app for a single step.

Parameters:

time_step (Duration) – The length of time the step simulates.

Return type:

None