core package
Subpackages
- core.ai package
- Subpackages
- Submodules
- core.ai.action_tracker module
- core.ai.api_index module
- core.ai.chat_manager module
ChatManagerChatManager.MAX_TOOL_STEPSChatManager.clear_history()ChatManager.create_new_session()ChatManager.current_prompt_indexChatManager.delete_session()ChatManager.rename_session()ChatManager.revert_prompt()ChatManager.send_message()ChatManager.send_message_stream()ChatManager.set_callbacks()ChatManager.set_project_path()ChatManager.set_provider()ChatManager.switch_session()
ChatMessage
- core.ai.context_builder module
- core.ai.session_manager module
ChatSessionSessionManagerSessionManager.active_session_idSessionManager.add_message_to_active()SessionManager.clear_active_session()SessionManager.create_session()SessionManager.delete_session()SessionManager.get_active_messages()SessionManager.get_active_session()SessionManager.get_session_list()SessionManager.load()SessionManager.rename_session()SessionManager.save()SessionManager.sessionsSessionManager.set_project_path()SessionManager.switch_session()
- core.ai.tools module
- Module contents
- core.components package
- Submodules
- core.components.animator module
AnimatorComponentAnimatorComponent.consume_trigger()AnimatorComponent.get_current_frame()AnimatorComponent.keep_only_triggers()AnimatorComponent.load_controller()AnimatorComponent.pause()AnimatorComponent.play()AnimatorComponent.reload_controller_if_changed()AnimatorComponent.resume()AnimatorComponent.set_trigger()AnimatorComponent.stop()
- core.components.camera module
- core.components.colliders module
- core.components.http_client module
- core.components.http_request module
HTTPRequestComponentHTTPRequestComponent.METHOD_DELETEHTTPRequestComponent.METHOD_GETHTTPRequestComponent.METHOD_PATCHHTTPRequestComponent.METHOD_POSTHTTPRequestComponent.METHOD_PUTHTTPRequestComponent.is_done()HTTPRequestComponent.is_sending()HTTPRequestComponent.json()HTTPRequestComponent.okHTTPRequestComponent.on_destroy()HTTPRequestComponent.reset()HTTPRequestComponent.send()
- core.components.light module
- core.components.multiplayer module
MultiplayerComponentMultiplayerComponent.MODE_CLIENTMultiplayerComponent.MODE_HOSTMultiplayerComponent.disconnect()MultiplayerComponent.get_local_player()MultiplayerComponent.get_player()MultiplayerComponent.get_player_count()MultiplayerComponent.get_players()MultiplayerComponent.host_game()MultiplayerComponent.is_activeMultiplayerComponent.is_connectedMultiplayerComponent.is_hostMultiplayerComponent.join_game()MultiplayerComponent.kick_player()MultiplayerComponent.local_player_idMultiplayerComponent.on_destroy()MultiplayerComponent.poll()MultiplayerComponent.register_rpc()MultiplayerComponent.request_despawn()MultiplayerComponent.request_spawn()MultiplayerComponent.roomMultiplayerComponent.rpc()MultiplayerComponent.rpc_to()MultiplayerComponent.rpc_to_host()MultiplayerComponent.send_custom()MultiplayerComponent.send_state()MultiplayerComponent.set_ready()MultiplayerComponent.start_game()
- core.components.network_identity module
- core.components.particle_emitter module
ParticleEmitterComponentParticleEmitterComponent.LAYER_BEHINDParticleEmitterComponent.LAYER_FRONTParticleEmitterComponent.SHAPE_CIRCLEParticleEmitterComponent.SHAPE_PIXELParticleEmitterComponent.SHAPE_SQUAREParticleEmitterComponent.explosion()ParticleEmitterComponent.magic()ParticleEmitterComponent.smoke()ParticleEmitterComponent.start()ParticleEmitterComponent.stop()ParticleEmitterComponent.trigger_burst()
- core.components.rigidbody module
Rigidbody2DRigidbody2D.BODY_TYPE_DYNAMICRigidbody2D.BODY_TYPE_KINEMATICRigidbody2D.BODY_TYPE_STATICRigidbody2D.apply_angular_impulse()Rigidbody2D.apply_force()Rigidbody2D.apply_impulse()Rigidbody2D.apply_torque()Rigidbody2D.body_typeRigidbody2D.can_rotateRigidbody2D.clear_forces()Rigidbody2D.elasticityRigidbody2D.force_xRigidbody2D.force_yRigidbody2D.is_dynamicRigidbody2D.is_kinematicRigidbody2D.is_staticRigidbody2D.torqueRigidbody2D.velocity_xRigidbody2D.velocity_y
- core.components.script module
ScriptComponentScriptComponent.call_group()ScriptComponent.cancel_tweens()ScriptComponent.change_scene()ScriptComponent.destroy()ScriptComponent.emit_global_event()ScriptComponent.emit_global_event_immediate()ScriptComponent.emit_local_event()ScriptComponent.emit_local_event_immediate()ScriptComponent.find()ScriptComponent.get_children()ScriptComponent.hide()ScriptComponent.instantiate_prefab()ScriptComponent.process_physics()ScriptComponent.show()ScriptComponent.spawn_prefab()ScriptComponent.start_coroutine()ScriptComponent.stop_coroutines()ScriptComponent.subscribe_to_event()ScriptComponent.tick_coroutines()ScriptComponent.tick_tweens()ScriptComponent.tween()ScriptComponent.unsubscribe_from_event()
- core.components.sound module
- core.components.sprite_renderer module
- core.components.steering module
- core.components.tilemap module
TileLayerTileLayer.array_to_world()TileLayer.ensure_size()TileLayer.expand_to_include()TileLayer.get()TileLayer.get_world()TileLayer.heightTileLayer.nameTileLayer.offset_xTileLayer.offset_yTileLayer.resize_with_offset()TileLayer.set()TileLayer.set_world()TileLayer.tilesTileLayer.visibleTileLayer.widthTileLayer.world_to_array()
TilemapComponentTileset
- core.components.timer module
- core.components.transform module
- core.components.ui module
- core.components.webrtc module
WebRTCComponentWebRTCComponent.add_ice_candidate()WebRTCComponent.close()WebRTCComponent.create_answer()WebRTCComponent.create_offer()WebRTCComponent.is_connected()WebRTCComponent.is_running()WebRTCComponent.on_destroy()WebRTCComponent.poll()WebRTCComponent.send()WebRTCComponent.send_bytes()WebRTCComponent.send_json()WebRTCComponent.set_remote_description()WebRTCComponent.start()
- core.components.websocket module
WebSocketComponentWebSocketComponent.MODE_CLIENTWebSocketComponent.MODE_SERVERWebSocketComponent.broadcast()WebSocketComponent.get_client_count()WebSocketComponent.get_client_ids()WebSocketComponent.get_url()WebSocketComponent.is_running()WebSocketComponent.on_destroy()WebSocketComponent.poll()WebSocketComponent.send()WebSocketComponent.send_json()WebSocketComponent.send_to()WebSocketComponent.start()WebSocketComponent.stop()
- core.components.webview module
- Module contents
AlignmentBehaviorAnimatorComponentAnimatorComponent.consume_trigger()AnimatorComponent.get_current_frame()AnimatorComponent.keep_only_triggers()AnimatorComponent.load_controller()AnimatorComponent.pause()AnimatorComponent.play()AnimatorComponent.reload_controller_if_changed()AnimatorComponent.resume()AnimatorComponent.set_trigger()AnimatorComponent.stop()
ArriveBehaviorBoxCollider2DButtonComponentCameraComponentCheckBoxComponentCircleCollider2DCohesionBehaviorFleeBehaviorGridBoxContainerComponentHBoxContainerComponentHTTPClientComponentHTTPRequestComponentHTTPRequestComponent.METHOD_DELETEHTTPRequestComponent.METHOD_GETHTTPRequestComponent.METHOD_PATCHHTTPRequestComponent.METHOD_POSTHTTPRequestComponent.METHOD_PUTHTTPRequestComponent.errorHTTPRequestComponent.headersHTTPRequestComponent.is_done()HTTPRequestComponent.is_sending()HTTPRequestComponent.json()HTTPRequestComponent.okHTTPRequestComponent.on_destroy()HTTPRequestComponent.reset()HTTPRequestComponent.response_bodyHTTPRequestComponent.response_headersHTTPRequestComponent.send()HTTPRequestComponent.status_code
LightOccluder2DMultiplayerComponentMultiplayerComponent.MODE_CLIENTMultiplayerComponent.MODE_HOSTMultiplayerComponent.disconnect()MultiplayerComponent.get_local_player()MultiplayerComponent.get_player()MultiplayerComponent.get_player_count()MultiplayerComponent.get_players()MultiplayerComponent.host_game()MultiplayerComponent.is_activeMultiplayerComponent.is_connectedMultiplayerComponent.is_hostMultiplayerComponent.join_game()MultiplayerComponent.kick_player()MultiplayerComponent.local_player_idMultiplayerComponent.on_destroy()MultiplayerComponent.poll()MultiplayerComponent.register_rpc()MultiplayerComponent.request_despawn()MultiplayerComponent.request_spawn()MultiplayerComponent.roomMultiplayerComponent.rpc()MultiplayerComponent.rpc_to()MultiplayerComponent.rpc_to_host()MultiplayerComponent.send_custom()MultiplayerComponent.send_state()MultiplayerComponent.set_ready()MultiplayerComponent.start_game()
NetworkIdentityComponentParticleEmitterComponentParticleEmitterComponent.LAYER_BEHINDParticleEmitterComponent.LAYER_FRONTParticleEmitterComponent.SHAPE_CIRCLEParticleEmitterComponent.SHAPE_PIXELParticleEmitterComponent.SHAPE_SQUAREParticleEmitterComponent.explosion()ParticleEmitterComponent.magic()ParticleEmitterComponent.smoke()ParticleEmitterComponent.start()ParticleEmitterComponent.stop()ParticleEmitterComponent.trigger_burst()
PointLight2DPolygonCollider2DProgressBarComponentRigidbody2DRigidbody2D.BODY_TYPE_DYNAMICRigidbody2D.BODY_TYPE_KINEMATICRigidbody2D.BODY_TYPE_STATICRigidbody2D.apply_angular_impulse()Rigidbody2D.apply_force()Rigidbody2D.apply_impulse()Rigidbody2D.apply_torque()Rigidbody2D.body_typeRigidbody2D.can_rotateRigidbody2D.clear_forces()Rigidbody2D.elasticityRigidbody2D.force_xRigidbody2D.force_yRigidbody2D.is_dynamicRigidbody2D.is_kinematicRigidbody2D.is_staticRigidbody2D.torqueRigidbody2D.velocity_xRigidbody2D.velocity_y
ScriptComponentScriptComponent.call_group()ScriptComponent.cancel_tweens()ScriptComponent.change_scene()ScriptComponent.destroy()ScriptComponent.emit_global_event()ScriptComponent.emit_global_event_immediate()ScriptComponent.emit_local_event()ScriptComponent.emit_local_event_immediate()ScriptComponent.find()ScriptComponent.get_children()ScriptComponent.hide()ScriptComponent.instantiate_prefab()ScriptComponent.process_physics()ScriptComponent.show()ScriptComponent.spawn_prefab()ScriptComponent.start_coroutine()ScriptComponent.stop_coroutines()ScriptComponent.subscribe_to_event()ScriptComponent.tick_coroutines()ScriptComponent.tick_tweens()ScriptComponent.tween()ScriptComponent.unsubscribe_from_event()
SeekBehaviorSeparationBehaviorSliderComponentSoundComponentSpotLight2DSpriteRendererSteeringAgentComponentTextInputComponentTextRendererTileLayerTileLayer.array_to_world()TileLayer.ensure_size()TileLayer.expand_to_include()TileLayer.get()TileLayer.get_world()TileLayer.heightTileLayer.nameTileLayer.offset_xTileLayer.offset_yTileLayer.resize_with_offset()TileLayer.set()TileLayer.set_world()TileLayer.tilesTileLayer.visibleTileLayer.widthTileLayer.world_to_array()
TilemapComponentTilesetTimerComponentTransformUIImageRendererVBoxContainerComponentWanderBehaviorWebRTCComponentWebRTCComponent.add_ice_candidate()WebRTCComponent.close()WebRTCComponent.create_answer()WebRTCComponent.create_offer()WebRTCComponent.is_connected()WebRTCComponent.is_running()WebRTCComponent.on_destroy()WebRTCComponent.poll()WebRTCComponent.send()WebRTCComponent.send_bytes()WebRTCComponent.send_json()WebRTCComponent.set_remote_description()WebRTCComponent.start()
WebSocketComponentWebSocketComponent.MODE_CLIENTWebSocketComponent.MODE_SERVERWebSocketComponent.broadcast()WebSocketComponent.get_client_count()WebSocketComponent.get_client_ids()WebSocketComponent.get_url()WebSocketComponent.is_running()WebSocketComponent.on_destroy()WebSocketComponent.poll()WebSocketComponent.send()WebSocketComponent.send_json()WebSocketComponent.send_to()WebSocketComponent.start()WebSocketComponent.stop()
WebviewComponent
- core.multiplayer package
- Submodules
- core.multiplayer.protocol module
MessageTypeMessageType.CUSTOMMessageType.DESPAWN_ENTITYMessageType.DISCONNECTMessageType.GAME_STARTMessageType.JOIN_ACCEPTEDMessageType.JOIN_REJECTEDMessageType.JOIN_REQUESTMessageType.LOBBY_STATEMessageType.OWNERSHIP_TRANSFERMessageType.PINGMessageType.PLAYER_JOINEDMessageType.PLAYER_LEFTMessageType.PLAYER_READYMessageType.PONGMessageType.RPC_CALLMessageType.SPAWN_ENTITYMessageType.STATE_SYNCMessageType.STATE_UPDATE
decode_message()encode_message()
- core.multiplayer.room module
- Module contents
- core.systems package
- Submodules
- core.systems.animation_system module
- core.systems.audio_system module
- core.systems.event_dispatch_system module
- core.systems.lighting_system module
- core.systems.network_system module
- core.systems.particle_system module
- core.systems.physics_system module
- core.systems.render_system module
- core.systems.script_system module
- core.systems.steering_system module
- core.systems.timer_system module
- core.systems.ui_system module
- Module contents
- core.testing package
- Submodules
- core.testing.mock_input module
MockInputProviderMockInputProvider.get_axis()MockInputProvider.get_events()MockInputProvider.get_game_mouse_position()MockInputProvider.get_key()MockInputProvider.get_mouse_button()MockInputProvider.get_mouse_position()MockInputProvider.inject_event()MockInputProvider.press_key()MockInputProvider.press_mouse_button()MockInputProvider.release_key()MockInputProvider.release_mouse_button()MockInputProvider.reset()MockInputProvider.set_axis()MockInputProvider.set_game_mouse_pos()MockInputProvider.set_mouse_pos()MockInputProvider.update()
- Module contents
MockInputProviderMockInputProvider.get_axis()MockInputProvider.get_events()MockInputProvider.get_game_mouse_position()MockInputProvider.get_key()MockInputProvider.get_mouse_button()MockInputProvider.get_mouse_position()MockInputProvider.inject_event()MockInputProvider.press_key()MockInputProvider.press_mouse_button()MockInputProvider.release_key()MockInputProvider.release_mouse_button()MockInputProvider.reset()MockInputProvider.set_axis()MockInputProvider.set_game_mouse_pos()MockInputProvider.set_mouse_pos()MockInputProvider.update()
Submodules
core.animation module
- class core.animation.AnimationClip(name: str)[source]
Bases:
object- static from_data(name: str, data: dict) AnimationClip[source]
- class core.animation.AnimationController[source]
Bases:
object- ROOT_NODE_NAME = 'Root'
- add_transition(from_node: str, to_node: str, conditions: list = None, trigger: str = '', on_finish: bool = False)[source]
- static from_data(data: dict) AnimationController[source]
core.coroutine_manager module
Lightweight coroutine scheduler for user scripts.
User scripts yield special instruction objects to pause execution:
class MyScript:
def on_start(self):
self.start_coroutine(self.spawn_loop())
def spawn_loop(self):
while True:
self.logger.info("spawning")
yield Wait(0.5) # wait 0.5 seconds
yield WaitFrames(2) # wait 2 frames
The ScriptSystem ticks the coroutine manager each frame via
CoroutineManager.tick(dt).
- class core.coroutine_manager.CoroutineManager[source]
Bases:
objectManages a set of running coroutines. Typically one per entity.
- property count: int
core.debug_overlay module
On-screen debug overlay for runtime diagnostics.
Toggle with DebugOverlay.enabled = True or bind to a key in a script.
Displays: - FPS (smoothed) - Entity count - Per-system update timings (if profiling is enabled on the World)
Usage:
from core.debug_overlay import DebugOverlay
# In player or script setup:
DebugOverlay.enabled = True # show overlay
DebugOverlay.show_fps = True
DebugOverlay.show_entity_count = True
DebugOverlay.show_system_timings = True
- class core.debug_overlay.DebugOverlay[source]
Bases:
objectStatic debug overlay drawn on top of the game surface.
- bg_color: tuple = (0, 0, 0, 160)
- color: tuple = (0, 255, 0)
- classmethod draw(surface: Surface)[source]
Draw the overlay onto surface. Call after all game rendering.
- enabled: bool = False
- font_size: int = 14
- position: tuple = (8, 8)
- show_entity_count: bool = True
- show_fps: bool = True
- show_system_timings: bool = True
core.ecs module
- class core.ecs.Entity(name: str = 'GameObject')[source]
Bases:
object- property events: EventSystem
- get_components(component_type: Type[Component]) List[Any][source]
Returns a list of all components matching component_type (including subclasses).
get_component()only returns the exact-type entry. This method walks every attached component and collects those that are instances of component_type, which is useful when an entity may carry several components that share a common base class (e.g. multiple colliders).
- class core.ecs.EntityQuery(world: World)[source]
Bases:
objectFluent query builder for filtering entities in a World.
- in_group(group: str) EntityQuery[source]
Filter to entities belonging to group.
- physics_enabled() EntityQuery[source]
Filter to entities with physics processing enabled.
- visible() EntityQuery[source]
Filter to visible entities only.
- with_component(*component_types) EntityQuery[source]
Filter to entities that have all listed component types.
- with_tag(tag: str) EntityQuery[source]
Filter to entities that have tag.
- class core.ecs.System[source]
Bases:
objectBase class for all systems
- required_components: tuple[type, ...] = ()
- class core.ecs.World[source]
Bases:
objectManages all entities and systems in a scene
- get_entities_with(*component_types: Type[Component]) List[Entity][source]
Returns a list of entities that have all the specified components. Uses cached sets for O(1) lookups per component type.
- get_system(system_type: Type[System])[source]
Return the first system matching the given type, or None.
- get_system_timings() Dict[str, float][source]
Return the latest per-system timing dict (system name → seconds).
- layers: List[str]
- physics_collision_matrix: Dict[str, List[str]]
- physics_group_order: List[str]
- query() EntityQuery[source]
Return a fluent query builder for filtering entities.
- remove_system(system: System) bool[source]
Remove a system from the world. Returns True if removed.
core.event_system module
- class core.event_system.EventSystem[source]
Bases:
objectA simple event system that allows subscribing to and emitting events.
- emit(event_name: str, *args, **kwargs)[source]
Queue an event. It will be dispatched by EventDispatchSystem on the next simulation tick (1-frame latency). :param event_name: Name of the event. :param args: Positional arguments to pass to callbacks. :param kwargs: Keyword arguments to pass to callbacks.
- emit_immediate(event_name: str, *args, **kwargs)[source]
Emit an event and dispatch it synchronously to all current listeners right now, bypassing the queue. Use this when zero-latency delivery is required (e.g. damage events that must be processed in the same frame they are emitted). :param event_name: Name of the event. :param args: Positional arguments to pass to callbacks. :param kwargs: Keyword arguments to pass to callbacks.
core.headless_server module
Headless server runner for AxisPy Engine.
Runs the game loop without any display, rendering, or audio. Only processes physics, scripts, and networking systems. Designed for dedicated game servers on Linux and Windows.
- Usage:
python -m core.headless_server <scene_path> python core/headless_server.py <scene_path>
- core.headless_server.run_headless(scene_path: str, tick_rate: float = 60.0, verbose: bool = False)[source]
Run the engine in headless mode (no display, no rendering, no audio).
- Parameters:
scene_path – Path to the .scn scene file to load.
tick_rate – Server tick rate in Hz (default 60).
verbose – If True, print periodic status info.
core.input module
- class core.input.Input[source]
Bases:
object- JOY_A = 0
- JOY_B = 1
- JOY_BACK = 6
- JOY_L3 = 8
- JOY_LB = 4
- JOY_LEFT_X = 0
- JOY_LEFT_Y = 1
- JOY_LT = 4
- JOY_R3 = 9
- JOY_RB = 5
- JOY_RIGHT_X = 2
- JOY_RIGHT_Y = 3
- JOY_RT = 5
- JOY_START = 7
- JOY_X = 2
- JOY_Y = 3
- classmethod get_game_mouse_position()[source]
Return mouse position mapped to game/design coordinates.
- classmethod get_gesture() TouchGesture[source]
Return the recognized gesture data for the current frame.
- classmethod get_joy_axis(axis: int, instance_id: int = -1) float[source]
Return axis value (-1..1) with deadzone applied.
- classmethod get_joy_button(button: int, instance_id: int = -1) bool[source]
Return True if button is currently pressed.
- classmethod get_joy_button_down(button: int, instance_id: int = -1) bool[source]
Return True if button was just pressed this frame.
- classmethod get_joy_button_up(button: int, instance_id: int = -1) bool[source]
Return True if button was just released this frame.
- classmethod get_joy_hat(hat: int = 0, instance_id: int = -1) tuple[source]
Return D-pad / hat value as (x, y) where x,y are -1, 0, or 1.
- classmethod get_joystick_name(instance_id: int = -1) str[source]
Return joystick name. If instance_id=-1, use first connected.
- classmethod get_touches() dict[int, TouchPoint][source]
Return dict of all currently active touch points {finger_id: TouchPoint}.
- classmethod get_touches_ended() list[TouchPoint][source]
Return list of touches that ended this frame.
- classmethod get_touches_moved() list[TouchPoint][source]
Return list of touches that moved this frame.
- classmethod get_touches_started() list[TouchPoint][source]
Return list of touches that began this frame.
- classmethod set_joystick_deadzone(deadzone: float)[source]
Set the deadzone threshold for joystick axes (default 0.15).
- classmethod set_mouse_mapper(mapper_fn)[source]
Set a function (window_x, window_y) -> (game_x, game_y) or None.
- classmethod set_provider(provider)[source]
Inject a provider object that overrides Input behaviour.
- The provider may implement any subset of:
update(), get_key(key_code), get_mouse_button(index), get_mouse_position(), get_game_mouse_position(), get_events(), get_axis(name).
Missing methods fall through to the default pygame implementation. Pass
Noneto restore the default behaviour.
core.input_map module
Named input action mapping.
Decouples gameplay logic from specific keys/buttons so rebinding is trivial.
Usage:
from core.input_map import InputMap
import pygame
# Register actions (typically at startup or from config)
InputMap.register("jump", [pygame.K_SPACE, pygame.K_w])
InputMap.register("fire", [pygame.K_f])
# Query in scripts
if InputMap.is_pressed("jump"):
...
if InputMap.is_just_pressed("jump"):
...
Actions can also be loaded from project.config via
InputMap.load_from_config(config_dict) where the config contains:
{
"input_actions": {
"jump": [32, 119],
"fire": [102]
}
}
- class core.input_map.InputMap[source]
Bases:
objectStatic action-to-key/button mapping registry.
- classmethod get_action_strength(action: str) float[source]
Return 1.0 if any key in action is pressed, else 0.0.
- classmethod get_all_actions() dict[str, list[int]][source]
Return a copy of all registered actions.
- classmethod get_bindings(action: str) list[int][source]
Return the key codes bound to action, or an empty list.
- classmethod is_just_pressed(action: str) bool[source]
Return True if any key bound to action was pressed this frame.
- classmethod is_just_released(action: str) bool[source]
Return True if any key bound to action was released this frame.
- classmethod is_pressed(action: str) bool[source]
Return True if any key bound to action is currently held down.
- classmethod load_from_config(config: dict)[source]
Load actions from a config dict containing an
input_actionskey.Expected format:
{"input_actions": {"jump": [32, 119], "fire": [102]}}
core.logger module
- class core.logger.LogRecord(timestamp: 'str', level: 'str', level_value: 'int', subsystem: 'str', message: 'str', data: 'dict[str, Any]')[source]
Bases:
object- data: dict[str, Any]
- level: str
- level_value: int
- message: str
- subsystem: str
- timestamp: str
core.object_pool module
Object pool for reusing deactivated entities instead of destroy/create churn.
- class core.object_pool.ObjectPool(world: World, prefill: Dict[str, tuple[Callable[[], Entity], int]] | None = None)[source]
Bases:
objectA per-World pool that recycles entities by a string tag.
Usage from scripts:
pool = ObjectPool(world, prefill={"bullet": (create_bullet, 20)}) bullet = pool.acquire("bullet") # re-use or create pool.release("bullet", bullet) # deactivate and return to pool
Entities returned by
acquireare shown (entity.show()) and have physics re-enabled. Entities passed toreleaseare hidden and have physics disabled so they cost almost nothing while pooled.- acquire(tag: str) Entity | None[source]
Get an entity from the pool, or create one via the registered factory.
- clear(tag: str | None = None)[source]
Destroy all pooled entities. If tag is None, clear every tag.
core.player module
- class core.player.RuntimePlayer(scene_path: str | None = None, web_mode: bool = False)[source]
Bases:
objectEncapsulates the runtime game loop, systems, and scene management.
core.resources module
- class core.resources.ResourceManager[source]
Bases:
object- classmethod build_sprite_atlas_if_needed(force: bool = False, max_size: int = 2048, padding: int = 2) bool[source]
- classmethod portable_path(path: str) str[source]
Normalize a path to always use forward slashes for cross-platform storage.
- classmethod preload_scene_assets(entities) dict[source]
Eagerly load all images, sounds, and fonts referenced by scene entities. Call this at scene load to avoid lazy-load hitches during gameplay. Returns a summary dict with counts of preloaded assets.
- classmethod restore(snap: dict)[source]
Restore a previously captured snapshot, replacing all current state.
- classmethod set_headless(headless: bool = True)[source]
Enable headless mode: skip all image/sound/atlas loading.
- classmethod slice_spritesheet(path: str, frame_width: int, frame_height: int, frame_count: int = 0, margin: int = 0, spacing: int = 0) list[Surface][source]
- classmethod snapshot() dict[source]
Capture the current state of all caches for later restore(). Useful in unit tests to isolate resource side-effects.
core.runtime_launch module
- class core.runtime_launch.LaunchHandle(process: 'subprocess.Popen', command: 'list[str]', scene_path: 'str', report_stdout_path: 'str', report_stderr_path: 'str', _stdout_file: 'Any' = None, _stderr_file: 'Any' = None, use_pipe: 'bool' = False)[source]
Bases:
object- command: list[str]
- process: Popen
- report_stderr_path: str
- report_stdout_path: str
- scene_path: str
- use_pipe: bool = False
- class core.runtime_launch.LaunchProfile(module: 'str' = 'core.player', scene_file_name: 'str' = 'temp_scene.scn', working_directory: 'str' = '', report_directory: 'str' = '', python_executable: 'str' = '', extra_args: 'list[str]' = <factory>, python_path_entries: 'list[str]' = <factory>, env_overrides: 'dict[str, str]'=<factory>)[source]
Bases:
object- env_overrides: dict[str, str]
- extra_args: list[str]
- module: str = 'core.player'
- python_executable: str = ''
- python_path_entries: list[str]
- report_directory: str = ''
- scene_file_name: str = 'temp_scene.scn'
- working_directory: str = ''
- class core.runtime_launch.RuntimeCommandBuilder[source]
Bases:
object- classmethod build_command(profile: LaunchProfile, scene_path: str)[source]
- classmethod launch(profile: LaunchProfile, scene_data: str, use_pipe: bool = False)[source]
core.save_manager module
Runtime save/load system for game state (save slots).
Usage from a user script:
from core.save_manager import SaveManager
class MyScript:
def on_start(self):
# Save the current world state to slot 1
SaveManager.save(self.entity.world, "slot1")
# Load from slot 1 (returns a new Scene)
scene = SaveManager.load("slot1")
# List available saves
saves = SaveManager.list_saves()
# Delete a save
SaveManager.delete("slot1")
Save files are stored under <project_dir>/saves/<slot_name>.sav
as JSON, using the same codec system as SceneSerializer.
- class core.save_manager.SaveManager[source]
Bases:
objectStatic save/load manager for runtime game state.
- classmethod delete(slot_name: str, project_dir: str = '') bool[source]
Delete a save slot file.
- Returns:
True if deleted, False if not found or error.
- classmethod exists(slot_name: str, project_dir: str = '') bool[source]
Check if a save slot exists.
- classmethod list_saves(project_dir: str = '') list[dict][source]
Return info about all save files in the save directory.
- Returns:
List of dicts with
slot,timestamp, andpathkeys, sorted by most recent first.
- classmethod load(slot_name: str, project_dir: str = '')[source]
Load a save file and return a reconstructed Scene.
- Parameters:
slot_name – Name of the save slot.
project_dir – Base project directory.
- Returns:
A Scene object on success, or None on failure.
- classmethod load_extra(slot_name: str, project_dir: str = '') dict | None[source]
Load only the extra_data from a save file without reconstructing the scene.
- Returns:
The extra data dict, or None if not found.
- classmethod save(world, slot_name: str, project_dir: str = '', extra_data: dict | None = None) bool[source]
Serialize the current world state and write it to a save file.
- Parameters:
world – The World instance to save.
slot_name – Name of the save slot (used as filename).
project_dir – Base project directory (for resolving save path).
extra_data – Optional dict of custom game data to include.
- Returns:
True on success, False on failure.
- save_directory: str = 'saves'
core.scene module
core.scene_transition module
Scene transition effects — fade-out / fade-in overlay.
Usage from the player loop:
transition = SceneTransition(duration=0.5, color=(0, 0, 0))
transition.start_out() # fade to black
# ... each frame:
transition.update(frame_dt)
transition.draw(surface)
if transition.is_done():
# swap scene, then:
transition.start_in() # fade from black
core.serializer module
- class core.serializer.SceneSerializer[source]
Bases:
object- static load_animation_clip(path: str) AnimationClip[source]
- static load_animation_controller(path: str) AnimationController[source]
- register_codec(component_type, to_data: Callable[[object], dict], from_data: Callable[[dict], object], component_name: str = None)[source]
Register a codec on this instance only (does not mutate class-level registry).
- classmethod register_component_codec(component_type, to_data: Callable[[object], dict], from_data: Callable[[dict], object], component_name: str = None)[source]
- static save_animation_clip(path: str, clip: AnimationClip)[source]
- static save_animation_controller(path: str, controller: AnimationController)[source]
core.state_machine module
Finite State Machine for entity behavior management.
Usage from a user script:
from core.state_machine import StateMachine, State
class IdleState(State):
def on_enter(self):
print("Entering idle")
def on_update(self, dt):
if some_condition:
self.machine.transition_to("walk")
def on_exit(self):
print("Leaving idle")
class WalkState(State):
def on_enter(self):
print("Starting to walk")
def on_update(self, dt):
if another_condition:
self.machine.transition_to("idle")
def on_exit(self):
print("Stopped walking")
class MyScript:
def on_start(self):
self.state_machine = StateMachine(self.entity)
self.state_machine.add_state("idle", IdleState())
self.state_machine.add_state("walk", WalkState())
self.state_machine.start("idle")
def on_update(self, dt):
self.state_machine.update(dt)
- class core.state_machine.State[source]
Bases:
objectBase class for FSM states. Override the lifecycle methods as needed.
- class core.state_machine.StateMachine(entity=None)[source]
Bases:
objectSimple finite state machine bound to an entity.
States are registered by name and transitions are triggered explicitly via
transition_to(name).- property current_state: str
Name of the currently active state, or empty string.
- property previous_state: str
Name of the previously active state.
core.tween module
Tween/easing system for declarative property animation.
Usage from a user script:
class MyScript:
def on_start(self):
# Animate transform.x to 500 over 1 second with ease_out_cubic
self.tween(self.entity, "transform.x", target=500, duration=1.0,
easing=ease_out_cubic)
# Animate with explicit start value
self.tween(self.entity, "transform.rotation", start=0, target=360,
duration=2.0, easing=ease_in_out_quad, loops=0)
The ScriptSystem ticks the tween manager each frame via
TweenManager.tick(dt).
- class core.tween.TweenManager[source]
Bases:
objectManages a set of active tweens. Typically one per entity or global.
- cancel_all(entity=None)[source]
Cancel tweens. If entity is given, cancel only that entity’s tweens.
- property count: int
- tween(entity, attr_path: str, target: float, start: float | None = None, duration: float = 1.0, easing=None, on_complete=None, loops: int = 0, yoyo: bool = False)[source]
Create and register a new tween.
- Parameters:
entity – The entity whose property to animate.
attr_path – Dotted path to the property, e.g.
"transform.x".target – Target value.
start – Start value. If
None, the current value is read.duration – Animation duration in seconds.
easing – Easing function
(t) -> t. Defaults toease_linear.on_complete – Optional callback invoked when the tween finishes.
loops –
0= play once,-1= infinite,N= repeat N extra times.yoyo – If True, alternates direction on each loop.