Show HN: I AI-coded a tower defense game and documented the whole process
64 comments
·July 4, 2025twalkz
I'm really enjoying reading over the prompts used for development: (https://github.com/maciej-trebacz/tower-of-time-game/blob/ma...)
A lot of posts about "vibe coding success stories" would have you believe that with the right mix of MCPs, some complex claude code orchestration flow that uses 20 agents in parallel, and a bunch of LLM-generated rules files you can one-shot a game like this with the prompt "create a tower defense game where you rewind time. No security holes. No bugs."
But the prompts used for this project match my experience of what works best with AI-coding: a strong and thorough idea of what you want, broken up into hundreds of smaller problems, with specific architectural steers on the really critical pieces.
stavros
I tried to build a simple static HTML game for the board game Just One, where you get a text box, type a word in, and it's shown full screen on the phone. There's a bug where, when you type, the text box jumps around, and none of the four LLMs I tried managed to fix it, no matter how much I prompted them. I don't know how you guys manage to one-shot entire games when I can't even stop a text box from jumping around the screen :(
M4v3R
Browser text entry on mobile phones is notoriously hard to get right and some bugs are literally unfixable [1]. I'm a frontend developer in my day job and I struggled with this even before AI was a thing. I think you just accidentally picked one of the hardest tasks for the AI to do for you.
[1] Example: https://www.reddit.com/r/webdev/comments/xaksu6/on_ios_safar...
stavros
Huh, that's actually my exact bug. I didn't realize this was so hard, thank you.
gametorch
> what works best with AI-coding: a strong and thorough idea of what you want, broken up into hundreds of smaller problems, with specific architectural steers on the really critical pieces
This has worked extremely well for me.
garciasn
I have been working on an end-to-end modeling solution for my day job and I'm doing it entirely w/Claude.
I am on full-rework iteration three, learning as I go on what works best, and this is definitely the way. I'm going to be making a presentation to my team about how to use AI to accelerate and extend their day-to-day for things like this and here's my general outline:
1. Tell the LLM your overall goal and have it craft a thoughtful product plan from start to finish.
2. Take that plan and tell it to break each of the parts into many different parts that are well-planned and thoroughly documented, and then tell it to give you a plan on how to best execute it with LLMs.
3. Then go piece by piece, refining as you go.
The tool sets up an environment, gets the data from the warehouse, models it, and visualizes it in great detail. It took me about 22 hours of total time and roughly 2 hours of active time.
It's beautiful, fast, and fully featured. I am honestly BLOWN AWAY by what it did and I can't wait to see what others on my team do w/this. We could have all done the setup, data ingestion, and modeling, no question; the visualization platform it built for me we absolutely could NOT have done w/the expertise we have on staff--but the time it took? The first three pieces probably were a few days of time, but the last part, I have no idea. Weeks? Months?
Amazing.
stavros
I wrote a whole PRD for this very simple idea, but still the bug persisted, even though I started from scratch four times. Granted, some had different bugs.
fragmede
CSS is the devil and I fully admit to burning many hours of dev time, mine without an LLM, an LLM by itself, and a combination of the two together to iron out similar layout nonsense for a game I was helping a friend with. In the end, what solved it was breaking things into hierarchical react components and adding divs by hand and using the chrome dev tools inspector, and good old fashioned human brain power to solve it. The other one was translating a python script to rust. I let the LLM run me around in circles, but what finally did it was using Google to find a different library to use, and then to tell the LLM to use that library instead.
stavros
I didn't realize this was so hard, thanks. I expected to be simple positioning issues, but the LLMs all found it impossible.
Here's the game, BTW (requires multiple people in the same location): https://home.stavros.io/justone/
fallinditch
> what works best with AI-coding: a strong and thorough idea of what you want, broken up into hundreds of smaller problems
A technique that works well for me is to get the AI to one-shot the basic functionality or gameplay, and then build on top of that with many iterations.
The one-shot should be immediately impressive, if not then ditch it and try again with an amended prompt until you get something good to build on.
alganet
I think indie games could be a really good use case for coding AIs. Low stakes, fun-oriented, sounds like a match.
The first commit[0] seems to have a lot of code, but no `PROMPTS.md` yet.
For example, `EnergySystem.ts` is already present on this first commit, but later appears in the `PROMPTS.md` in a way that suggests it was made from scratch by the AI.
Can you elaborate a bit more on this part of the repository history?
[0]: https://github.com/maciej-trebacz/tower-of-time-game/commit/...
mgdev
This is awesome. I've been in software for 20+ years now as well.
One thing I've noticed is many (most?) people in our cohort are very skeptical of AI coding (or simply aren't paying attention).
I recently developed a large-ish app (~34k SLOC) primarily using AI. My impression is the leverage you get out of it is exponentially proportional to the quality of your instructions, the structure of your interactions, and the amount of attention you pay to the outputs (e.g. for course-correction).
"Just like every other tool!"
The difference is the specific leverage is 10x any other "10x" tool I've encountered so far. So, just like every tool, only more so.
I think what most skeptics miss is that we shouldn't treat these as external things. If you attempt to wholly delegate some task with a poorly-specified description of the intended outcome, you're gonna have a bad time. There may be a day when these things can read our minds, but it's not today. What it CAN do is help you clarify your thinking, teach you new things, and blast through some of the drudgery. To get max leverage, we need to integrate them into our own cognitive loops.
cgriswald
This post was interesting to me because I also have a lot of programming experience but other than hunt the wumpus high school I haven’t programmed a game and recently started using AI to help with a new game.
AI has become three things for me:
(1) A learning tool. What it is really great at is understanding my questions when I don’t have the proper terminology. Because of this it can give me a starting point for answers. It is also really fantastic for exposing me to unknown unknowns; probably the most important thing it does for me.
(2) A tool to do boring or tedious things that I can do but slow me down. I’ve found it good enough at a variety of things like commenting code, writing a config file (that I usually edit), or other text-based adventures.
(3) Search. Just like (1), because it understands what I’m actually after, it is irrelevant if I know what a thing is actually called. I also let it filter things for me, make recommendations, etc.
I think you can let it think for you, but… why would you? It’s not as smart as you. It’s just faster and knows more things. It’s like an FPU for the CPU of your brain.
qsort
I commented on this before, I'm in this weird "opinion arbitrage" spot where I'm relatively skeptical by HN standards but I'm actually pushing for more usage at work. Hell, I'm typing this while I wait for Claude to be done.
The reason for my skepticism is the delta between what they're being sold as and what they actually do. All AI solutions, including agents (especially agents!), are effectively worse-than-worthless without guidance from someone experienced. There's very little that's "autonomous" about them, in fact.
The very guy who coined the term "vibe coding" went on stage effectively saying we're putting the carriage before the horse!
Omitting the important caveat that while they are fantastic tools they need to be restrained a lot is effectively lying.
zacharycohn
My stance has long been that LLMs are currently worse than the evangelists are claiming they are, but are significantly better than the detractors and skeptics think they are.
Like most things, the truth is somewhere in the middle. But unlike many things, they are changing and advancing rapidly, so it's current state is not the resting state.
kordlessagain
My opinion is that it's about the tools you use. Bad tools, bad agentic behavior.
sitkack
Better spoons, better food.
majormajor
> The difference is the specific leverage is 10x any other "10x" tool I've encountered so far. So, just like every tool, only more so.
One of the best comparisons to me is languages.
The old "lisp [or whatever] lets us do more, faster" idea, but with a fun twist where if you can reduce the code you write but still end up with generated code in a fast, high-performance language, without the extra work you would have to do to go add type annotations or whatnot everywhere for SBCL.
But with a gotcha that you are gonna have to do a lot of double-checking on some of the less-easily/obviously-verified parts of the generated code for certain type of work.
And of course highly-expressive languages have resulted in no small number of messy, unmaintainable codebases being built by people without well-specified advance plans. So we're gonna see a lot of those, still.
BUT to me the real, even bigger win - because I spend less time writing 100% new code than integrating old and new, or trying to improve old code/make it suit new purposes, is supercharged debugging. A debugger is a huge improvement over print statements everywhere for many types of things. A machine that you can copy-paste a block of code into, and say "the output looks like [this] instead of like [that], what's going on" and get a fresh set of eyes to quickly give you some generally-good suggestions is a huge improvement over the status quo for a lot of other things as well. Especially the type of things that are hard to attach a debugger to (sql, "infrastructure as code", build scripts, etc, just to start).
AnotherGoodName
I've come to this same conclusion pretty strongly in the past few months in particular. I actually had negative comments on my experience with AI previously.
For all the talk of AI hitting a ceiling the latest tools have improved greatly. I'm literally doing things in hours that'd previously take weeks with little issue. I do of course have to think about the prompts and break it down to a fine grained level and i also have the AI integrated well with the IDE.
The biggest wins are the times you hit a new framework/library. Traditionally you'd go through the 'search for code samples on usage of new library/language/framework -> work those samples into a form that accomplishes your task' cycle. AI is much better for this to the extent it even often surprises me. "Oh the library has a more straightforward way to accomplish X than i thought!".
For those who are still skeptical it's time to try it again.
skaisbzbsn
> I do of course have to think about the prompts and break it down to a fine grained level
This is where I’ve found usefulness falling off. Code is much more succinct and exact than English. I was never slowed down by how fast I could type (and maybe some are? I’ve watched people finger type and use the mouse excessively) but by how fast I could understand the existing systems. By the time I could write an expressive prompt in English I might as well have made the changes myself.
I’ve found it enormously useful as google on steroids or as a translator (which many changes that require code often end up being).
aprilthird2021
> I'm literally doing things in hours that'd previously take weeks with little issue.
What's an example of this? Some of the ones I see most are: converting legacy code to something modern, building a greenfield app or feature in an unfamiliar language / framework / space.
But at work I don't have these types of jobs, and I want to get this productivity speed up, but right now I'm stuck at it helps a lot but not turning weeks of work into hours, so trying to get there
AnotherGoodName
I recently had a need to create educational animations. These were programmatically created using the Manim library in Python.
I'm a mobile dev by trade. The best interaction i had recently was with Python and the Manim library specifically which are not my area of expertise. This was a series of "Create an animation that shows X with a graph of the result over variables Y". AI gave a one shot successful results with good coding practices for all of this. I could have spent a week coming up to speed on that library and re-remembering all the Python syntax or i could have fought against doing it at all but instead, one hour of prompting, "here it is boss, done".
I had similar results doing some updates to the app itself too fwiw. Android dev has a lot of boilerplate. "Create a new screen to show a list of images in a recycler view". Everyone who's done Android knows the boilerplate involved in what i just stated. Again 1 shot results. Unlike the above this is something i know how to do well, i just didn't want to type 100's of lines of boilerplate.
jpcom
Which IDE are you using?
AnotherGoodName
The jetbrains collection which now have claud built in with a subscription option.
danielbln
In addition, there is a learning curve and a skill ceiling that is deceptively higher than people think. Also, running Claude Opus in some tight agentic harness will give very different results than asking GPT-4o in the browser and copy/pasting stuff around.
M4v3R
> the leverage you get out of it is exponentially proportional to the quality of your instructions, the structure of your interactions, and the amount of attention you pay to the outputs
Couldn't say it better myself. I think many people get discouraged when they don't get good results without realizing that for good results you need to learn how to interact with these AI agents, it's a skill that you can improve by using them a lot. Also some AI tools are just better than others for certain use cases, you need to find one that works best with what you're doing.
When it finally clicks for you and you realize how much value you can extract from these tools there's literally no coming back.
roenxi
> One thing I've noticed is many (most?) people in our cohort are very skeptical of AI coding (or simply aren't paying attention).
I'd hope most devs are using AI heavily when coding, the last 6 months seem to have reached a level of competence in raw programming skill somewhere around mid- or senior- level with hilarious variance between brilliance and idiocy.
I think you might be seeing the most vocal programmers are terrified for their future prospects and there isn't much room to reason with them so they're let alone.
colinmilhaupt
Thanks for sharing! This aligns with a workflow I've been converging on incorporating traceability and transparency into LLM-augmented workflows[1]. One of the big benefits I've realized is sharing and committing prompts gives significantly more insight into the original problem set out to be solved by the developer, and then it additionally shows how it morphed over time or what new challenges arose. Cool project!
doddpronter
That's pretty impressive and super motivating. Love that you documented the prompts. From my experience "vibe coding" can either speed you up or slow you down. As long as you are using succinct and clear instructions and know how to review code quickly, as well as understand the architecture you can really speed up the process
skybrian
This is the first I've heard of Augment Code. What does it do? Why did you pick that tool, versus alternatives? How well did it work for you? Do you recommend it?
virgil_disgr4ce
I'd also like to hear about this—did OP use Augment Code in Cursor? How does that work/what exactly does that get you? Do you pay for both?
M4v3R
I've heard about Augment Code on X and what piqued my interest was their "context engine" which is a fancy way of saying they have a way of navigating big codebases and providing enough context for their LLM to execute your query. It worked really well on a medium-sized codebase in my day job where other agents would fail.
It's a VS Code extension so I'm using it inside Cursor and depending on a task I would either use Cursor's Agent mode (for simpler, more constrained tasks) or Augment Code's (for tasks that span multiple files and are more vague and/or require more steps to finish).
There are downsides though - it's more expensive than Cursor ($50 vs $20 per month) and it can be unreliable - I'm frequently getting errors/timeouts that require hitting "Try again" manually, which is frustrating. I might switch to Claude Code after my plan runs out because I've heard many good things about it recently.
Brajeshwar
Yours is beautiful; the code is too. I'm sure you had a lot more hand than just using AI.
I stopped coding a long time ago. Recently, after a few friends insisted on trying out AI-Assistance codes and I tinkered. And all I came up was a Bubble Wrap popper, and a silencer. :-)
jslakro
I didn't find any mention to the costs spent on Claude
M4v3R
I've mentioned this in other replies, but I actually didn't pay for Claude directly, only via Cursor with their $20/mo subscription.
smusamashah
How much time did it take start to finish?
edgarneto
This is a pretty cool game! I love the twists of rewinding time and playing with the keyboard. It would look pretty cool on Reddit, with a level builder. Redditors could build levels to challenge each other and see who can reach a highscore on each of the UGC levels. Check out Flappy Goose and Build It on Reddit to see some examples.
M4v3R
Thanks! The game actually supports gamepads too but I didn't have enough time to put in proper instructions for that.
freehorse
A bug in the intro: in the first round in the first playthrough my turret destroyed one of the critter and the other reached the tower. There was no other prompt or anything happening in the game after that and had to restart. The next time, the turret did not destroy any critter, the prompt to use backspace appeared and the game progressed normally.
M4v3R
Interesting, I actually had the turret destroy one of the enemies several time but it didn't prevent the tutorial message from showing up. I'll look into it though, thanks for the report!
laurent_du
Very cool and I wish it lasted longer.
I'm a software developer with 20+ years of experience but during this time I never programmed any games, but I really wanted to for the longest time. With the advent of AI coding agents I thought that this is the best time to try and so I've learned a bit of Phaser.js (a Javascript based game engine) and entered Beginner's Jam Summer 2025 - a game jam for beginners in the game dev industry that allows AI coding. After around 25-30 hours (working mainly after my full-time day job) I managed to submit the game I called "Tower of Time" (the theme of the jam was "Time Travel").
You can play it in your browser here: https://m4v3k.itch.io/tower-of-time
The goal of this project for me was first and foremost to see if AI coding is good enough to help me with creating something that's actually fun to play and to my delight is turns out the answer is yes! I decided to document the whole process for myself and others to learn from my mistakes, so both the code AND all the prompts I used are published on GitHub (see submission link). The art assets are largely taken from itch.io artists who shared them for free, with some slight touch ups. Sounds came from freesound.org.
I've also streamed parts of the process, you can watch me working on the final stretch and submitting the finished game (warning, it's 5+ hours long):
https://www.twitch.tv/videos/2503428478
During this process I've learned a lot and I want to use this knowledge in my next project that will hopefully be more ambitious. If you have any comments or questions I'm here to answer!