FactorSmith

Game generation using partially observable markov decision process and multi-agent reasoning.

PythonAI-AgentsHydraPygame

FactorSmith

FactorSmith unifies two complementary approaches: the factored POMDP decomposition from FactorSim for principled context reduction, and the planner–designer–critic agentic pattern from SceneSmith for iterative quality refinement. By embedding SceneSmith's three-agent workflow within each step of FactorSim's factored generation pipeline, FactorSmith synthesizes playable game simulations from natural language descriptions with improved prompt alignment, fewer runtime errors, and higher code quality compared to either approach alone.

Architecture

The pipeline operates in three phases:

1. High-Level Decomposition

The game specification is decomposed into a sequence of modular steps via Chain-of-Thought prompting, where each step describes a self-contained module (e.g., "introduce a ball that falls under gravity").

2. Factored Step Execution

Each step is processed by a series of agentic trios (planner/designer/critic). A State Agent identifies relevant and new state variables, selecting only the contextual subset from the session database. A Decompose Agent splits the step into three MVC components — input logic, state transition, and UI rendering — each handled by its own agentic trio. Within each trio, the designer proposes code, the critic evaluates it via structured scoring rubrics, and the planner orchestrates iterative refinement with checkpoint rollback.

3. Assembly and Validation

All generated functions and state variables are assembled into a complete executable simulation and validated through sanity checks.

All state variables and functions are persisted in a SQLite-backed session database, enabling factored context selection for subsequent steps.

Available Games

pong, snake, pixelcopter, puckworld, waterworld, flappy_bird, breakout, catcher, space_invaders, monster_kong, raycast_maze

Getting Started

Visit the GitHub repository to get started with FactorSmith.