# Hang on! Coding a Game with AI

By [Nye's Digital Lab](https://paragraph.com/@nyewarburton.eth), 2024-12-18

---

**_TLDR:_** I wanted to see what coding a game with AI was like.

_Hold on,_ **_it's pretty nuts._**

* * *

**My Prototype:**

[![]({{DOMAIN}}/editor/youtube/play.png)](https://www.youtube.com/watch?v=zcdcqx9PpVw)

**_Prototstar_**\* Prototype built in Phaser.js using Windsurf IDE/Cascade Agent, powered by Codium and Claude Sonet 3.5 from Anthropic.\*

* * *

### Contents:

*   _Can I build a game with AI?_
    
*   _Coding with Windsurf_
    
*   _From Concepting to Functional Prototype_
    
*   _Reality Check_
    
*   _Lessons Learned_
    

* * *

### Can I build a game with AI?

Classes ended and I turned my attention to some play time. Everyone is considering the _why and how of_ **_AI._** I decided to make a game with it - something playable and fun, **a real working prototype.**

I wanted to use AI to create _gameplay, logic, and code._ Not just prompting for haphazard code, but reflecting the ideas I wanted to create and test. I've been making all sorts of game prototypes using Claude's programming ability. It's amazing how 20 minutes of chatting can produce a simple 3D scene.

But to make a game you need something more robust - a project I could edit in an IDE with proper structure and architecture. So I started imagining a top-down space shooter and began a holiday AI-enhanced dev process.

![Early experiments. Using Generative Code to create a procedural platformer in Phaser.js/Typescript.](https://storage.googleapis.com/papyrus_images/d5a6d030372a8369e1e07104508d833d.png)

Early experiments. Using Generative Code to create a procedural platformer in Phaser.js/Typescript.

Coding with Windsurf
--------------------

I stumbled on Windsurf, an IDE that elevates AI from a simple code generator to "a true development partner." Through its _“Codium” system_ and _“Cascade” agent_, it creates an environment where AI actively participates in development, generating code and file structures in real-time within the IDE itself.

In English, it **"autocompletes" your code** while you prompt it on the side margin. At the way back it’s powered by Claude Sonnet 3.5, which is what I use for text generation and prototypes.

[https://codeium.com/windsurf](https://codeium.com/windsurf)

When you find your rhythm with Windsurf, it actually does feel like catching a ride – the AI writes code for individual files, making strategic guesses about what to do next.

![A "firetruck" prototype made for my youngest.  Windsurf, Codium/Claude using PyGame and Python. ](https://storage.googleapis.com/papyrus_images/6ee09eafb9b2a1cb2b7dc1b87d05c386.png)

A "firetruck" prototype made for my youngest. Windsurf, Codium/Claude using PyGame and Python.

For example - I might have said something like :

> "_Use the arrow keys to create a truck controller. Have the truck be drive-able, with forward arrow accelerating to a maximum speed, and the side arrows rotating the direction."_

It would “think” with those little dots going back and forth…

Then, tell me it would build a movement controller, develop a state machine, and then build the physics. **And it did it!** You could watch it explain what it was working on, and like magic, watch the code being developed and commented. The most fun was when it said things like:

> **“Ah, I see the problem. Let’s fix it in the file.”**

The feel of the game play was sometimes spot-on. **_Sometimes it was a disaster._** It's important to have something in mind or be willing to let it take its own direction. Sometimes it really is like holding on and being pulled along **_almost out of control._**

Unlike traditional tools that require copying and pasting code snippets, this integrated approach takes a more improvisational path with calculated-risk prompt asking. The refinement and continuous communication **_with an AI that rapidly forgets_** dependencies is the real challenge.

![A concept for a space game called "Protostar" - Miro Board to aggregate references and AI generated images from Leonardo.ai](https://storage.googleapis.com/papyrus_images/38216ccd586a415b38d65901624368a0.png)

A concept for a space game called "Protostar" - Miro Board to aggregate references and AI generated images from Leonardo.ai

From Concept to Functional Prototype
------------------------------------

To imagine **Protostar** - I gave myself a design period with Miro first. Using [Leonardo.ai](https://leonardo.ai/) for images and consulting [with Claude often](https://claude.ai/), I developed concepts about space, aliens, **and fun.**

I spent about 90 minutes crafting a detailed prompt with Claude, which became my design document - outlining everything from entity specifications to movement systems and screen layout.

![After about 90 minutes conversing with Claude, I had a "battletested" starter prompt to build the Protostar prototype.](https://storage.googleapis.com/papyrus_images/1eee4141e23aa33bce1600c4a573943e.png)

After about 90 minutes conversing with Claude, I had a "battletested" starter prompt to build the Protostar prototype.

What happened next was remarkable.

Within hours, I had a **working prototype that exceeded expectations.** The game featured _three planets orbiting a sun, a sophisticated energy management system based on solar values, and even a basic dialogue tree for alien interactions._ The speed at which game mechanics came together was mind-blowing. This kind of prototype **_would typically take weeks to develop._**

However, this rapid development created **significant _technical debt._** The AI would sometimes rewrite entire sections of code, potentially breaking existing functionality. Version control became essential - when every prompt could go off the rails, **you need the ability to roll back.**

I kept a running document with entities, prompts, numbers, and thoughts. For example, the ship's power supply was **1000** one moment, then rewritten to **100** when updating the UI! I would personally write comments in addition to the the code, and would parse through it after changes. The better I knew the code, the more specific I could be about **what shouldn't be touched.**

Control came through _clear communication_ and _well-documented prompts_, not endless small fixes. It's about communicating the larger system and giving enough detail for individual components to be functional.

* * *

![I developed the space sim Protostar in Windsurf, an IDE with a coding agent I collaborated with.](https://storage.googleapis.com/papyrus_images/01b364a0d1835565095aaa230244f7ae.png)

I developed the space sim Protostar in Windsurf, an IDE with a coding agent I collaborated with.

The Reality Check
-----------------

Emboldened by early successes, I attempted to port the project to Rust using the Bevy game engine. **_What?!?_** --- This was just irrational mania. Why would I possibly do that, except that with this new found coding ability, I just **could.**

This was dumb – my complete unfamiliarity with Rust created a learning curve that even AI couldn't smooth out. I was over my skis. This experience highlighted an important truth:

* * *

**AI is a powerful tool, but it can't replace fundamental programming knowledge and experience.**

* * *

Lessons Learned
---------------

This experiment revealed several key insights:

1.  AI excels at **rapid prototyping,** allowing quick transformation of ideas **into playable demos**
    
2.  It moves **incredibly fast** - you need to stay aware and in control
    
3.  Understanding game development fundamentals _still remains crucial_ - **y_ay!_**
    
4.  **Version control isn't optional** - it's essential with unpredictable AI generations
    
5.  AI still struggles with _system-level architecture_ and _bug detection_
    

While we're not yet at AI fully automating game development, we're entering an era where AI tools can significantly enhance a developer's capabilities. The future might see the emergence of **a new kind of game developer** – a generalist who can leverage AI to handle multiple aspects simultaneously. ( [I wrote about it here.](https://mirror.xyz/nyewarburton.eth/ar0_uFRGMpPxAb5owkhTPEMKbkYPGHspzV-ofYjKD4I) )

![Goodbye Protostar Bad Guy Robot. Off to the prototype bin for you!](https://storage.googleapis.com/papyrus_images/b734f5fe1e484ced8df1cab513ef0cdb.jpg)

Goodbye Protostar Bad Guy Robot. Off to the prototype bin for you!

The journey of building **Protostar** has shown that while AI might not be ready to take over game development entirely, it's already transforming how we approach the process. As a prototype to play with AI coding, **Protostar** served its purpose. But more importantly, it showed me that things once beyond my technical ability are now within reach. I have placed the Github of the code below if you wish to take a look at it!

All of this is going to get weirder for sure! All we can do is **hang on.**

* * *

**Nye Warburton** is a systems designer who builds generative experiments in [the 9th dimension.](https://9th-dimension.github.io/) This essay post was made with the assistance of Perplexity, Llama3, Claude Sonnet, and Stable Diffusion. More info: [https://nyewarburton.com](https://nyewarburton.com)

* * *

**Protostar Prototype Github:**

[https://github.com/9th-Dimension/Protostar](https://github.com/9th-Dimension/Protostar)

**_I make mention of the following tools and models in this piece:_**

_Windsurf / Codium_

[https://codeium.com/windsurf](https://codeium.com/windsurf)

_Claude Sonnet 3.5 - Anthropic_

[https://claude.ai](https://claude.ai)

_Leonardo.ai / Stable Diffusion_

[https://leonardo.ai/](https://leonardo.ai/)

_Phaser.js / Typescript_

[https://phaser.io/](https://phaser.io/)

_Rust_

[https://www.rust-lang.org/](https://www.rust-lang.org/)

_Bevy Game Engine_

[https://bevyengine.org/](https://bevyengine.org/)

_Miro_

[https://miro.com/](https://miro.com/)

Obsidian

[https://obsidian.md/](https://obsidian.md/)

* * *

* * *

---

*Originally published on [Nye's Digital Lab](https://paragraph.com/@nyewarburton.eth/hang-on-coding-a-game-with-ai)*
