How to Build a 114,000-Line Game with AI: Context Management in Practice
A browser game of 114,000 lines, written entirely with neural networks in three weeks, is a real thing. But the main difficulty turned out not to be whether AI can write code. It was keeping a large project manageable once the codebase had long outgrown any context window. The author lays out his methodology step by step.
AI-processed from Habr AI; edited by Hamidun News
A developer wrote a 114,000-line browser game entirely with neural networks, and finished in three weeks. This is not a showcase of AI power. It is a practical breakdown of a methodology: how to keep a large project manageable once the codebase no longer fits in the context window.
Three weeks and 114,000 lines
A browser game is not a toy project. Writing 114,000 lines of code alone in three weeks is a pace that would be unattainable without neural networks. The author did not use AI as an autocomplete assistant. He used it as a full-fledged generator: he described tasks in natural language, received implementations, iterated on the results and moved on.
But by the midpoint of the work, it was clear that generation speed is not the main problem in a large AI-assisted project. The main problem is manageability. The bigger the codebase, the harder it is to explain to the model what is already implemented, which decisions are settled and what it must absolutely not do. The model does not remember which patterns were chosen two sessions ago. It does not know that a function has already been written in another file.
When the context runs out
The context window is a fundamental limit of a language model working on a large project. Even for the most powerful models it is finite: thousands of lines of code, multiplied by comments and documentation, quickly exceed the available capacity. Once a project grows past a few dozen thousand lines, the model physically cannot hold the entire repository in memory at once.
The consequences are predictable. The AI starts inventing functions that already exist in another file, conflicts with architectural conventions adopted early on, and ignores a naming style introduced a couple of sessions ago. The code compiles, but its internal logic begins to drift apart.
This is not a model bug. It is a structural problem that requires a structural solution on the developer's side.
How to keep the project under control
A few principles that worked in practice:
- Decision documentation outside the code — every architectural decision is recorded in a separate document. Before a new session, the AI receives it as part of the context together with the task.
- Strict modularity — files are deliberately kept small so that each one fits into the context window on its own. No three-thousand-line files.
- Session briefings — every new session starts with a short introduction: what has been done, which conventions are in force and what is being worked on right now.
- Uniform naming conventions — a strict style for functions, variables and modules reduces the risk of collisions that the AI does not notice without an explicit reminder.
- "Blind" reviews — periodically asking the model to explain code it wrote itself. This is a good way to uncover hidden contradictions and logical drift between sessions.
None of these principles is new: all of them are used in team development to coordinate people. With AI they work differently, as a mechanism for managing the model's attention. Not "who is responsible for what," but "what the model knows right now and which of that matters."
What this means
114,000 lines in three weeks is a reproducible methodology, not a one-off feat. AI can write code at industrial scale, but the manageability of a large project still depends on the human. Structure, documentation and deliberate context management are what separate a project that can be continued and developed from a codebase that no one can make sense of anymore, including the model itself.
Build & Ship Production AI Apps with Vibe Coding
Join Zhemal Khamidun's hands-on Vibe Coding Intensive at hamidun.com/vibecoding — master Claude Code, Cursor, and autonomous agentic workflows.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.