Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:4thfever Cultivation world simulator Simulator step

From Leeroopedia
Knowledge Sources
Domains Simulation, Game_Engine
Last Updated 2026-10-22 14:00 GMT

Overview

Concrete tool for executing a single simulation step (one in-game month) through a 29-phase pipeline, provided by the Cultivation World Simulator engine.

Description

The Simulator.step method is the entry point for advancing the simulation by one month. It delegates to `SimulationPhaseRunner.run()`, which iterates through 29 registered phases—from perception updates through AI decisions, action execution, combat, death, birth, storytelling, sect wars, and finalization.

The `Simulator` class holds the world reference and a `SectManager`. It reads configuration from `StaticConfigProvider` and the `run_config_snapshot` stored on the world.

Usage

Import and call this method when:

  • Game loop: the server's tick loop calls `step()` each interval when the game is not paused
  • Initialization: `perform_game_initialization` calls `step()` once to generate initial events
  • Testing: tests call `step()` to verify simulation behavior with mock LLM managers

Code Reference

Source Location

Signature

class Simulator:
    def __init__(self, world: World):
        self.world = world
        run_config = getattr(world, "run_config_snapshot", {}) or {}
        self.awakening_rate = float(run_config.get("npc_awakening_rate_per_month", 0.01))
        self.config_provider = StaticConfigProvider.current()
        self.can_interrupt_major = self.config_provider.can_interrupt_major_events()
        self.sect_manager = SectManager(world)

    async def step(self) -> list[Event]:
        """Execute one simulation step (one month) through all phases."""
        return await SimulationPhaseRunner(self).run()

Import

from src.sim.simulator_engine.simulator import Simulator

I/O Contract

Inputs

Name Type Required Description
self.world World Yes World instance with avatars, events, map, month_stamp

Outputs

Name Type Description
return list[Event] Finalized, deduplicated events from all phases; persisted to event_manager

Usage Examples

Run a Simulation Step

from src.sim.simulator_engine.simulator import Simulator

sim = Simulator(world)
events = await sim.step()
print(f"Step produced {len(events)} events; world time: {world.month_stamp}")

Run Multiple Steps

for _ in range(12):  # advance one year
    events = await sim.step()
    for event in events:
        if event.is_major:
            print(f"[Major] {event}")

Related Pages

Implements Principle

Required Environments

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment