How to engineer an AI harness for game development
TL;DR Highlight
Making games deterministic and screenshot-friendly lets AI agents iterate faster
Who Should Read
A developer building a game or asset-heavy project with Claude Code who keeps watching the agent break things
Core Mechanics
- LLMs struggle with games for structural reasons
- Games contain many non-code assets that are opaque to an LLM.
- The author frames this as a context problem, not an inherent trait of games.
- Polluted context ruins agent work
- Every earlier message is resubmitted each turn within a session.
- Bad early content keeps influencing later work, so keep context clean.
- Use one seeded randomness source
- Create a single seeded random source at game start and route all non-deterministic calls through it.
- Agents can then return to the same state from scratch repeatedly.
- Quantify screenshot diffs with odiff
- The author says giving a model two before/after screenshots makes it hard to see the change or progress.
- The free CLI tool odiff outputs a diff image and a value like "85% similar".
- That number can serve as a stable evaluation baseline each turn.
- Build save/load from day one
- How easily you can save and load an exact state measures how close you are to determinism.
- The author calls putting it off until the end a grave mistake.
- Unify every object as one Thing type
- A tree and a dog are compositions of components like mesh and collider, so the code sees them as the same kind of thing.
- With one object type, the AI knows where to change things and save/load gets much easier.
Community Reactions
- Determinism is hard across platforms
- One commenter said fixed randomness and determinism sound great on paper but are confining in practice.
- They said keeping determinism across many platforms is where it gets nasty.
- Thing approach limits larger games
- One commenter said iterating thousands of Things across 30 subsystems cannot fit in frame time.
- They said that is why ECS and SOA exist and need a different kind of harness.
- Screenshot and input automation worked well
- One commenter built an automated testing system that takes screenshots and simulates input, and Claude used it well to make games.
- They wrote a guide in their engine docs.
- Letting the agent instrument the game
- One commenter had Claude Code run a 1997 game on modern hardware, and the first part took 30 minutes.
- It later mapped memory and game logic and built headless parallel runs.
- Forced determinism and architecture are risky
- A commenter who is a game developer said AI pushes everything toward determinism, causing churn, bugs, and rigidity.
- They advised setting core architecture yourself and letting AI write the code.
How to Apply
- Introduce one seeded random source
- Search your project for Random calls and route them through a single seeded random object today.
- Run twice with the same seed and confirm the same state results.
- Build an agent eval loop with odiff
- Compare before/after screenshots with odiff and give the agent the diff image and similarity score.
- State in the instructions to iterate toward higher similarity.
- Add UI and gameplay layer toggles
- When fixing UI, have the agent hide the gameplay layer before taking screenshots.
- This keeps irrelevant visuals from distracting the agent.
- Put save/load in the early design
- In week one of a new project, implement saving and loading of exact state.
- Use it so the agent can experiment repeatedly from the same state.
Try It
# Paste into Claude Code (the article's method turned into a prompt)
You are the agent for my game project. Work by these rules.
1. Find in the code whether all non-deterministic calls use one seeded random source, and report.
2. Check whether a save/load path exists that reproduces the same state from the same seed.
3. Compare before/after screenshots with odiff and judge progress by the similarity value.
4. Make the minimum change each turn and verify immediately.
Goal: {{feature or bug to fix}}
Screenshot command: {{how to take a screenshot}}
Next step: Ask it to convert the list of non-deterministic calls it found into the seeded source.Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques