How Codex plays Factorio: headless Lua state reading plus xdotool GUI control

john_lam · x · 2026-09-11

John Lam shares the full setup behind an agent playing Factorio (via @MiraMira): a Linux VM runs both a headless and a GUI client. The headless one supports Lua scripts for reading game state and planning, while the GUI client records replays and save files, with the agent taking screenshots and interacting via bash('xdotool ...') or Python equivalents. Custom MCP servers existed for distributing work to an agent fleet and managing persistent sessions, but none were needed — stock Codex with no custom MCP servers could do the task.

Related event: John Lam Compares AI Agents' Factorio Progress Over 18 Months(2 posts)→

Original post →

More from coding & agent

coding & agent channel →