Engine API¶
This page points you to the main engine entry points.
ArepyEngineis the main object that owns shared services and worlds.SystemPipelinehelps organize the order in which systems run.SystemStatestores the state object used by stateful systems.
Start here if you want to...¶
- open a window and boot the engine with
ArepyEngine(...) - create or switch scenes with
create_world(...)andset_current_world(...) - expose shared services such as rendering, input, audio, assets, and events
- understand when engine hooks and world hooks run during a frame
Main concepts¶
ArepyEngine¶
ArepyEngine owns the application-level services and the runtime loop.
The most important calls are:
engine = ArepyEngine(title="My Game")
world = engine.create_world("main")
engine.set_current_world("main")
engine.run()
Engine resources are global. They are visible from every world and include objects such as Display, Renderer2D, Renderer3D, Input, AudioDevice, AssetStore, and EventManager.
Worlds managed by the engine¶
When you create a world through the engine, that world receives access to the engine's global resources and can also define local resources of its own.
That makes this pattern possible:
class DialogueState:
def __init__(self) -> None:
self.current_line = 0
world = engine.create_world("dialogue")
world.add_resource(DialogueState())
Inside systems registered on that world, DialogueState resolves locally, while services such as Renderer2D still come from the engine.
Engine hooks vs world hooks¶
ArepyEngine still exposes its own hooks:
on_startup()on_update()on_render()on_shutdown()
In addition, each world can register:
world.on_startupworld.on_updateworld.on_renderworld.on_shutdown
Use engine hooks for app-wide behavior. Use world hooks for scene-specific setup, teardown, or small pieces of orchestration that belong to one world.
Good companion pages¶
Generated reference¶
Where to keep reading¶
- For the full module layout, browse the generated module reference in
API Reference. - For a friendlier walkthrough, start with the guide pages about engine lifecycle and resources.