Kneeshaw Developments
Back

The Codex · in development

Three fidelity tiers · seven systems · one C++ engine

A backend.Not a backdrop.

The World Engine is a C++ simulation library compiled as a Godot GDExtension. Cities, factions, and NPCs run as independent agents — at FULL fidelity when you're near, LITE when you're a region away, DORMANT when you're on the other side of the continent. The WorldEventGenerator scans for imbalances and produces quest seeds in real time. Nothing is scripted dressing.

3fidelity tiers7engine systemsC++engine languageGodotfront-end

WorldEventGenerator · always running

FULLLITEDORMANTCHARCOMBPARTMONSQUESTRAVLOCAWEG

Inner ring · FULL fidelity · outer ring · DORMANT

FULLNear player · full behaviour
LITEMid · daily check
DORMANTFar · state-check only

The World Engine

The World Engine is a separate C++ project that exposes its systems to Godot through the GDExtension binding. Game logic lives in the engine; presentation lives in Godot. The split means the engine can run on a server, in tests, or headless for tooling without dragging the renderer along.

The engine owns the canonical simulation. Its responsibilities include:

  • Characters and parties. Every NPC, monster, and player party member is a Character entity with a behaviour tree, inventory, profession, and essence loadout.
  • Cities and markets. Each city tracks population, production, the market object, buy orders, sell flags, and faction membership.
  • Factions and diplomacy. All ten major factions plus minor groups maintain bilateral relations, treaties, active wars, and policy stances.
  • Quests and stories. Procedural and hand-authored quests live on the same data model; the StorySystem advances arcs while the QuestSystem handles individual quest state.
  • Resource nodes and locations. Every harvestable node in the world tracks its own abundance, depletion rate, and respawn timer.
  • Time, travel, weather, events. One canonical world clock; deterministic travel times; a weather model; and a propagation system for events that cross region boundaries.

Simulation tiers (FULL / LITE / DORMANT)

Running a full simulation on every NPC in the world every frame would be ruinous. Instead the engine sorts every character and region into three tiers, and runs each at a different cadence with a different system mix.

FULL tier

Updates · 4x per day

Player party. Adjacent regions. Active boss/elite characters. Anything in combat. Anything on a player-assigned quest.

Full behaviour-tree execution. Real-time pathfinding. Combat resolution. Quest acceptance and completion. Party coordination. Inventory transactions. Active essence ability cooldowns. Real trader market interactions.

  • · Your party walks into Goldport — every NPC in Goldport runs at FULL.
  • · A bandit Dauntless 2 regions away gets pulled to FULL the moment your scout spots them.
  • · A boss-tier Lord in the dwarven Rift is always FULL even if no one's nearby.

LITE tier

Updates · 1x per day

Characters 2+ regions away from any player. Idle background NPCs. Settled regions with no recent activity.

Simplified behaviour. Tasks already in progress complete; new ones don't start. No combat (any combat trigger upgrades to FULL). No new quest acceptance. Travel continues but doesn't re-route. Fatigue recovery is automatic. Cities still produce. Trade still moves on existing routes. Factions still update relations.

  • · A merchant convoy three regions east continues a known route at LITE.
  • · Cities you've never visited still produce food and pay taxes at LITE.
  • · Faction diplomatic relations slowly drift at LITE — but no diplomatic events fire.

DORMANT tier

Updates · Every other day

Characters explicitly in dormant states — sick, sleeping, hibernating, in coma, etc.

Minimal simulation. State check only. Inventory frozen (prevents item duplication). Travel paused. Quests skipped. Faction-major events still propagate. Production still ticks for buildings, because they don't depend on the character being awake.

  • · An NPC recovering from a serious injury at DORMANT until their fatigue clears.
  • · Hibernating beasts in Rendrown territory at DORMANT through winter.
  • · Players' offline party members default to DORMANT when the game is closed for extended periods.

System × tier matrix

Which systems run at which tier. Cells marked "Skipped" do nothing this tier; "Major events" means the system reacts only to faction-level or larger events, ignoring small-scale ones.

SystemFULL
CharacterSystemFull behaviour tree
TravelSystemEvery tick
PartySystemFull coordination
MonsterSystemFull AI
CombatSystemReal-time
QuestSystemFull updates
LocationSystemFull effects
NodeSystemFull resource
CitySystemFull economy
FactionSystemFull diplomacy
EventSystemAll events
EssenceSystemCooldowns active
InventorySystemFull access
TradeSystemActive trading
ProductionSystemFull production

WorldEventGenerator — every imbalance is a quest hook

The WorldEventGenerator is a procedural narrative engine that runs on top of the simulation. Its job is to scan the world state, detect imbalances, and turn them into narrative seeds — small data packets that downstream systems can hatch into stories, quests, or news rumors.

“Every systemic imbalance is a narrative seed waiting to bloom.”

The flow:

CitySystem    ──┐
NodeSystem    ──┼── scan_world_state() ── NarrativeSeeds ──┬── StorySystem    (arcs)
FactionSystem ──┘                                          ├── QuestSystem    (quests)
                                                           └── News / Rumor   (board posts)

Narrative seed types

  • Resource Scarcity

    Trigger
    City resource < 20% of need
    Severity
    Inverse of supply ratio (severity 0.9 at 10% supply)
    Story title
    “[City] Faces [Resource] Shortage”

    Generates: QUEST_COLLECT_RESOURCES, scarcity / survival themes

  • Resource Abundance

    Trigger
    City resource > 200% of need
    Severity
    Scaled by excess amount
    Story title
    “[City] Overflows with [Resource]”

    Generates: Trade opportunities, prosperity stories

  • Node Overuse

    Trigger
    Node abundance < 30%
    Severity
    Inverse of abundance
    Story title
    “Resource Node Depleting”

    Generates: Conservation quests, environmental stories

  • Economic Collapse

    Trigger
    City gold < 1,000 AND population > 100
    Severity
    Inverse of gold ratio
    Story title
    “[City] Economy in Crisis”

    Generates: Economic rescue missions, trade quests

  • Population Crisis

    Trigger
    City population < 50
    Severity
    Inverse of population ratio
    Story title
    “[City] Population Dwindling”

    Generates: Recruitment quests, survival stories

  • Faction Conflict

    Trigger
    Faction relations < threshold
    Severity
    Based on relation value
    Story title
    “Tensions Rise Between [A] and [B]”

    Generates: Diplomatic missions, war stories

Seeds have a cooldown — once a similar seed has fired for a given target (a city, a node, a faction pair), the same seed type won't re-fire until the cooldown expires. This prevents runaway quest spam from the same imbalance.

Stimulus-Reaction — how NPCs notice things

Where the WorldEventGenerator works at world scale, the StimulusSystem works at character scale. Every entity carries a PerceptionProfile — sensory range, attention weighting, memory capacity — and the StimulusSystem broadcasts events that nearby entities perceive based on that profile. Perceived events fire reaction handlers, which queue follow-up behaviour for the character system to act on.

The flow per entity is:perceive → react → remember → communicate.

  • Visual

    Things entities can see — arrivals, departures, combat, depleted nodes, new buildings.

    • · VISUAL_CHARACTER_ARRIVED
    • · VISUAL_CHARACTER_DEPARTED
    • · VISUAL_COMBAT_STARTED
    • · VISUAL_RESOURCE_DEPLETED
    • · VISUAL_BUILDING_CONSTRUCTED
  • Auditory

    Things entities can hear — fighting sounds, alarm bells, celebrations, nearby dialogue.

    • · AUDITORY_COMBAT_SOUNDS
    • · AUDITORY_CELEBRATION
    • · AUDITORY_ALARM
    • · AUDITORY_CONVERSATION
  • Social

    Direct interactions — greetings, insults, trade offers, quest offers, help requests.

    • · SOCIAL_GREETING
    • · SOCIAL_INSULT
    • · SOCIAL_TRADE_OFFER
    • · SOCIAL_QUEST_OFFER
    • · SOCIAL_PARTY_INVITE
    • · SOCIAL_HELP_REQUEST
  • Environmental

    World events — weather changes, natural disasters, resource discoveries.

    • · ENVIRONMENTAL_WEATHER_CHANGE
    • · ENVIRONMENTAL_DISASTER
    • · ENVIRONMENTAL_RESOURCE_DISCOVERED

Manifestation visibility (the bright manifestations that signal emotion in dialogue scenes) routes through this same system — what you see on screen is an entity's perception of another entity's emotional state, dependent on their own PerceptionProfile.

How a player choice actually ripples

Concrete example. You decline a request to escort a relief caravan into a famine-struck region (the request originally generated from a Resource Scarcity seed). What happens afterwards is not scripted:

  1. QuestSystem marks your decline. Quest state expires; reward escrow returns to the originating city.
  2. CitySystem doesn't get the relief food. Resource scarcity stays severity 0.9. Population health degrades.
  3. WorldEventGenerator re-scans on its next tick, sees the scarcity hasn't resolved, and spawns the next-tier seed — Population Crisis if population drops below 50.
  4. FactionSystem updates the local faction's relation with you: refusal of assistance during a crisis is a relations hit, propagating through diplomatic channels.
  5. TradeSystem sees food prices in the region remain elevated. Long-haul traders re-evaluate. New trade routes open. Other Merchant NPCs accept the work you declined.
  6. StimulusSystem broadcasts your refusal as a social event to nearby characters. NPCs who witnessed it adjust their attitude toward you. Some may decline to offer you quests later.

None of these reactions are individually large. The aggregate — over months of in-game time, across multiple decisions — is what makes the world feel responsive. The simulation doesn't punish you for declining a quest; it just refuses to pretend the consequences didn't happen.

Determinism, save scope, and persistence

The simulation is deterministic given the same seed and the same input event stream. The seed is fixed when you start a new game; every choice you make from that point is part of the input stream. Reloading a save replays the simulation to the saved tick, not just the saved state.

A save file therefore captures: the world seed, every player choice, every committed quest result, the current world clock, and a snapshot of all major systems' state at the save instant. Restoring is exact — including the trader who was halfway through a long-haul convoy when you saved.

Save XML serialization details live in the dev docs (XML_Serialization, SAVE_SYSTEM_GAP_ANALYSIS). A player-facing save-scope summary will live on the FAQ page once that ships.

Where to read next

Source: World-Engine — SIMULATION_TIER_DESIGN, WORLD_EVENT_GENERATOR, STIMULUS_REACTION_SYSTEM, DYNAMIC_MARKET_SYSTEM.