Making a Simple Web Game in Minutes with AI for My Daughter
Claude Sonnet 3.5 > ChatGPT
AI can generate code, but does it work?
If you keep it simple enough- YES.
MVP in One Prompt
With a game concept from my daughter, I wanted to use the new Claude Sonnet 3.5 model and it’s Artifacts feature to create a game.
I got a working MVP in one prompt.
Which is pretty amazing.
Here is the prompt that gave me the prototype:
You are an expert web game developer using Javascript and HTML.
I want to make a game for my daughter.
It will be a 2D side scroller where the player is a unicorn that has to jump over obstacles like water and small rocks.
The player can press space bar to jump. And then can tap space bar in the air to "fly" higher but each space bar tap only sends you half has high as the jump or the previous tap (so you don't fly off the screen and reach max height in 3 or 4 taps)
The space bar will decrement an energy bar, each tap takes 20% energy but it refills slowly over time.
There will be apples over the land that restore energy.
After running for 30 seconds, the unicorn will make it to some finish line and the level will end.
I have a png for unicorn and apple, and eventually for ground, water, and obstacle, but for now just use shapes.
Claude Helped Me Debug
At one point my grass was not rendering.
Through a few iterations with Claude, it gave me some debugging code and various steps to try.
We went in circles for a few prompts until I gave it the full output of my browser console to which it fixed the issue right away.
My Unfair Advantage
I’m an engineer.
I mostly knew what questions to ask, how to break the problem down into baby steps, and how to wire everything together.
I still wrote ZERO lines of code to get this game working.
The key to using AI for code generation today is to break your problem down as small as you can.
And it helps to know what questions to ask as you iterate and follow up.
Rough Edges
It was tedious copy-pasting various code changes from Claude into my expanding JavaScript file.
Managing game assets is still a pain. Even with DALL-E to generate them, it required manually background removal, resizing, and organization.
I initially began with the wrong question - asking what game engine to use. This led me down a path AI was not well equipped to handle: using a game engine library.
AI excels right now at very common programming problems.
A 2D platformer in a custom game engine? Fail.
A 2D web based platformer in JavaScript and HTML? Success.
Engineers Are Still Needed
Dare I say, will always be needed?
AI raises the baseline skill level and eliminates tedious.
But humans will always be needed at the frontiers.
AI just allows us to go faster and democratizes access to basic coding.
I believe we are entering a golden age of human creativity.
Let’s learn to use AI as we free up time to be more human.
I’ve started playing on YouTube and actually made a quick demo of this.
Let me know what I could do better as noob to video. Thanks!