Architecture

A strategy simulation engine running deterministic game logic and probabilistic LLMs in parallel. The backend is a threaded Python/Flask service coordinating game state, agent reasoning, and asynchronous generation without blocking the main render loop.

Civ-AI main campaign hub: Civilization title, Quick Start options, Custom World builder, and a Chronicle log of prior campaigns persisting across sessions Main campaign hub: players select a saved Chronicle (persistent AI-authored campaign history), launch a Quick Start, or build a Custom World. The Chronicle log persists across sessions. Agent leaders remember events, grudges, and alliances from previous runs via the History Compression Engine.

Core Mechanics

  • Agentic AI & Agency: Leaders are persistent AI agents with “Agency Engines” that form complex plans, hold grudges, and react to decisions dynamically based on individual goals and personality vectors.
  • State-Aware Image Generation: An asynchronous pipeline using the Gemini API and Imagen4 maintains visual state: it can take a generated leader and “age” them ten years, or alter their clothing based on economic ruin or prosperity, without losing subject identity. (Utilized via Nano Banana2 for high-speed generation).
  • History Compression Engine: Solves the context window problem by recursively summarizing centuries of gameplay. Turn-level logs become Era-level Chronicles, which become Mythos-level Cultural Traits, allowing agents to recall and act upon events from 500 turns ago.
  • Hybrid Orchestration: Hard game logic (resources, buildings) and probabilistic LLM creative generation are coordinated via a threaded Python backend that keeps both deterministic and stochastic systems in lockstep.