Principle:AIScientists Dev WorldSeed World Population
| Knowledge Sources | |
|---|---|
| Domains | Simulation, Configuration |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
A process that converts declarative entity definitions from a validated scene configuration into live runtime `Entity` objects stored in a `StateStore`, establishing the initial physical world state before agents are registered or ticks begin.
Description
World population is the bridge between configuration and simulation. A scene config declares entities (spaces, resources, objects, concepts) as `EntityConfig` Pydantic models with flat properties. The populator transforms these into `Entity` dataclass instances — extracting constraints from properties, deep-copying initial state, and adding each entity to the in-memory `StateStore`.
Critically, population handles world entities only. Agents are registered separately via `WorldEngine.register_agent()`, which creates both the entity and the agent profile. This separation ensures the same registration path is used for preset agents (from YAML) and external agents (from HTTP `/register`).
Usage
Use this principle when initializing a new world from a scene config. It runs automatically inside `WorldEngine.__init__()` after the config is loaded and validated. Never call `populate()` directly in production code — always go through `WorldEngine`.
Theoretical Basis
The population step follows a declarative-to-runtime transformation pattern:
# Abstract transformation (NOT real implementation)
for entity_cfg in config.entities:
props = copy.deepcopy(entity_cfg.properties)
constraints = props.pop("constraints", {})
entity = Entity(id=entity_cfg.id, type=entity_cfg.type,
_data=props, _constraints=constraints)
store.add(entity)
The deep copy ensures that the runtime state is isolated from the config schema — mutations during simulation never leak back into the config. Constraints are separated from data properties so the engine can enforce them without polluting the entity's observable state.