Core Infrastructure#
Core ECS infrastructure for BAM Engine.
This module provides the fundamental building blocks of the BAM-ECS architecture: roles (components), events (systems), pipelines, relationships, and the registry system.
Key Components#
Role: Base class for agent state components
Event: Base class for economic logic (systems)
Pipeline: Manages event execution order
Relationship: Base class for relationships between roles
Registry: Global lookup for roles, events, and relationships
Decorators#
@role: Simplified syntax for defining roles
@event: Simplified syntax for defining events
@relationship: Simplified syntax for defining relationships
Examples
Import core classes:
>>> from bamengine.core import Role, Event, Pipeline
>>> from bamengine.core import get_role, get_event, list_roles
Use decorators for simplified syntax:
>>> from bamengine.core import role, event
>>> from bamengine.typing import Float
>>>
>>> @role
... class MyRole:
... value: Float
>>>
>>> @event
... class MyEvent:
... def execute(self, sim):
... pass
Access registry:
>>> from bamengine.core import get_role, list_roles
>>> Producer = get_role("Producer")
>>> all_roles = list_roles()
See also
roleRole base class and related functions
eventEvent base class and related functions
relationshipRelationship base class and related functions
pipelinePipeline management
decoratorsDecorator implementations
registryRegistry functions
The bamengine.core module provides the fundamental building blocks of the
BAM-ECS architecture.
Classes#
Role: Base class for agent componentsEvent: Base class for simulation eventsRelationship: Base class for agent relationshipsPipeline: Event execution sequence