8 ms·
Show HN: I AI-coded a tower defense game and documented the whole process
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 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 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!
- bix6 1y agoExcited to try this when I’m on a computer. Thanks for sharing everything!
- edgarneto 1y agoThis 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 1y agoThanks! The game actually supports gamepads too but I didn't have enough time to put in proper instructions for that.
- hnaccount_rng 1y agoHow many tokens did you use up and what did you pay for them?
- M4v3R 1y agoI can't give you the token count because I didn't really track that (Augment Code does not give you detailed token stats) and I'm not paying per token - I use the Developer plan on Augment Code ($50/mo) and Pro plan on Cursor ($20/mo). Didn't pay for additional usage and I have requests to spare on both of them. As far as stats go from the provider dashboards I see: - 7667 lines of Agent Edits accepted on Cursor - 105 messages (prompts) on Augment Code
- mgdev 1y agoThis 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.
- M4v3R 1y ago> 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.
- imiric 1y agoIt's not about learning how to interact with AI agents. The only required skills for working with these tools are basic reading and writing skills any decent English speaker would have. Knowing how and when to provide additional context and breaking down problems into incremental steps are common workflows within teams, not something novel or unique to LLMs. "Prompt" or "context engineering" is what grifters claim they can teach for a fee. What does make a difference is what has been obvious since the advent of LLMs: domain experts get the most out of them. LLMs can be coaxed into generating almost any thinkable output, as long as they're prompted for it. Only experts will know precisely what to ask for, what not to ask for, and whether or not the output aligns with their expectations. Everyone else is winging it, and their results will always be of inferior quality, until and if these tools improve significantly. What's dubious to me is whether experts really gain much from using LLMs. They're already good at their job. How valuable is it to use a tool that can automate the mechanical parts of what they do, while leaving them with larger tasks like ensuring that the output is actually correct? In the context of programming, it's like pairing up with a junior developer in the driver seat who can type really quickly, but will confidently make mistakes or will blindly agree with anything you say. At a certain point it becomes less frustrating and even faster to type at normal human speeds using boring old tools yourself.
- HNArg024 1y agoGreat game! The rewind time "skill" it's like playing an Edge of Tomorrow game
- laurent_du 1y agoVery cool and I wish it lasted longer.
- deleted 1y ago[deleted]
- freehorse 1y agoA 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 1y agoInteresting, 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!
- freehorse 1y agoYeah I cannot reproduce it in subsequent runs even if this happens, no idea what happened in that.
- Brajeshwar 1y agoYours 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. :-) https://bubble-pop.oinam.com https://bubble-pop.oinam.com https://void.oinam.com https://void.oinam.com
- mordechai9000 1y agoRunning chrome on android and the bubbles aren't popping for me. Count is staying at zero. Are you open to PRs? :-)
- Brajeshwar 1y agoYes Please. Absolutely. Feel free to send in any edits. https://github.com/oinam/bubble-pop https://github.com/oinam/bubble-pop
- lvl155 1y agoPart of me thinks Rockstar delayed the release of GTA 6 because they realized they can polish the game by a significant margin using the latest AI tools.
- skybrian 1y agoThis 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 1y agoI'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 1y agoI'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.
- twalkz 1y agoI'm really enjoying reading over the prompts used for development: (https://github.com/maciej-trebacz/tower-of-time-game/blob/main/PROMPTS.md 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 1y agoI 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 :(
- gametorch 1y ago> 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.
- stavros 1y agoI 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.
- gametorch 1y agoI guess sometimes I have to do some minor debugging myself. But I really haven't encountered what you're experiencing. Early on, I realized that you have to start a new "chat" after so many messages or the LLM will become incoherent. I've found that gpt-4.1 has a much lower threshold for this than o3. Maybe that's affecting your workflow and you're not realizing it?
- ofjcihen 1y agoWhy does this and the follow up comments feel like a sneaky ad for this “Augment Code” tool?
- deleted 1y ago[deleted]
- M4v3R 1y agoYou might want to read a reply I just posted to another commenter about what I dislike about this tool and how I'll probably switch to a different one [0] [0] https://news.ycombinator.com/item?id=44463967#44465304 https://news.ycombinator.com/item?id=44463967#44465304
- nico 1y agoMaybe because it stands out against the other (very well known) tools mentioned in the readme I came back here specifically to ask about Augment Code, after going to their website and not really understanding what it is
- thegrim33 1y agoAfter scanning through the video, the first 20 minutes is a guy doing coding with no AI involved. He's manually designing a level in a pre-made level editor. He's manually writing code in a pre-made IDE. He's not having AI code. At the 20 minute mark, he decides to ask the AI a question. He wants it to figure out how to prevent a menu from showing when it shouldn't. It takes him 57 seconds to type/communicate this to the AI. He then basically just sits there for over 60 seconds while the AI analyzes the relevant code and figures it out, slowly outputting progress along the way. After a full two minutes into this "AI assistance" process, the AI finally tells him to just call a "canBuildAtCurrentPosition" method when a button is pressed, which is a method that already exists, to switch on whether the menu should be shown or not. The AI also then tries to do something with running the game to test if that change works, even though in the context he provided he told it to never try to run it, so he has to forcefully stop the AI from continuing to spend more time running, and he has to edit a context file to be even more explicit about how the AI should not do that. He's frustrated, saying "how many times do I have to tell it to not do that". So, his first use of AI in 20 minutes of coding, is an over two minute long process, for the AI to tell him to just call a method that already existed when a button is pressed. A single line change. A change which you could trivially do in < 5 seconds if you were just aware of what code existed in your project. About what I expected.
- deleted 1y ago[deleted]
- M4v3R 1y agoCongratulations, you've managed to spot all the pain/weak points of the whole ~30 hour process without ever noticing all the good points. It takes a special type of skill to do so :). > About what I expected. But then again, you opened the video already with an expectation to see failure, so of course you found it.
- rybosome 1y agoOne could find a 5-minute slice of any highly successful project I’ve worked on where my actions look foolish and my tools look broken. Isolating your analysis of this to a single unflattering interaction is intellectually dishonest; you have a bone to pick.
- malochak 1y agoI couldn't stop playing this game, very engaging :) Thanks!
- doddpronter 1y agoThat'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
- jslakro 1y agoI didn't find any mention to the costs spent on Claude
- M4v3R 1y agoI've mentioned this in other replies, but I actually didn't pay for Claude directly, only via Cursor with their $20/mo subscription.
- iaw 1y agoI'm using Claude for my side projects. The pricing tiers are Free (for Sonnet 3.5), $20/m for Opus 4, $100/m for max (5x usage limit as $20) and then a $200 tier above that at another 5x I believe. The usage limits reset every 6 hours.
- smusamashah 1y agoHow much time did it take start to finish?
- M4v3R 1y agoIt took about a week working on it on and off in my spare time. I'd say probably 25-30 hours total.
- colinmilhaupt 1y agoThanks 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! [1]https://colinmilhaupt.com/posts/responsible-llm-use/ https://colinmilhaupt.com/posts/responsible-llm-use/
- alganet 1y agoI 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/81608aa14b9bce29130963d434046063264f54ec https://github.com/maciej-trebacz/tower-of-time-game/commit/...
- M4v3R 1y agoBecause this was a game jam entry with one week deadline I was going pretty fast and didn't bother to use source control for the first 2-3 days of work, hence the huge initial commit. I also weren't writing down prompts as I went, only after the game was finished I went back in my chat history in the tools I used and copied all the prompts to the `PROMPTS.md` file. If you want to follow the history of this project as it was created the best way would be to read the prompts file from top to bottom. For example the EnergySystem.ts file was created right after I was done with enemy pathfinding, spawing and tower shooting and it was created from scratch by the AI using the prompt "I want to implement an Energy subsystem where..."
- alganet 1y agoThanks for clarifying! Also, good catch in using the chat history to reconstruct the first phases of work. I believe it can be a fun experiment for others to try to reproduce it from scratch using the prompts and image assets only.
- danielbln 1y agoYou can easily let the LLM take over committing. "create atomic conventional commits until the git workspace is clean". I have a Claude Code session open just for commiting the state once I have a piece of work complete and working.
- tills13 1y ago[flagged]
- nichochar 1y agoIsn't creativity always impressive if done well? Code is a medium, painting is a medium, piano is a medium, and prompting is a medium. This sounds a little bitter.
- tills13 1y agoPrompting is telling someone or something else to do something for you. Is management creative? The most creative aspect of this is the idea. The rest is boring.
- minimaxir 1y agoBeing precise with language and defining specifications based on domain knowledge is generally creative. The better analogy is product design rather than product management.
- jedberg 1y agoDid you actually try the game? It has a pretty unique gameplay element to it. I'd say that's where they passion and creativity comes in.
- M4v3R 1y agoPlease tell me - how exactly you think is typing English prose into a box different vs typing a bunch of english keywords and symbols in the exact correct order into a box? To me these are both conceptually the same. But typing English to me is an order of magnitude faster than typing code, especially in a domain that's new to me (like game dev). > What did _you_ do? How were _you_ creative? Where in this project is _your_ passion? My passion is, and was never in the act of typing code. It was put in creating something that's useful or, in this case - fun. It's the end product that matters to me. I've put a lot of thinking into how exactly each element should work, look and behave. Then I verbalized all this thinking and created prompts that got turned into code, which resulted in a game that's apparently fun for people to play. And that's it. Thank you for taking time to check my project.
- EwanG 1y agoCurious if anyone here has tried rosebud.ai for something similar. I looked into it, and it did appear to break it down into steps, but can't really produce anything that runs without upgrading to a paid tier.
- shironandonon_ 1y agoThanks for the read! I too have over 20 years in tech and have been going back and forth with Gemini-cli to gamify some tools for integration testing some Enterprise applications and it’s amazing what can be done with Gemini alongside usage of MCP servers. I am finding positive results if I approach problems in chunks and provide clarity in prompt instructions. The AI will make mistakes and sometimes get caught up in loops for some problems (like application routing.. lol) but I am happy to step in and effectively pair program with the AI when issues are present. I notice too that it has never been a better time to enforce things like how Duplication Is Evil because otherwise the AI may make a change in one area and forget that it has similar changes to make in another file. This applies both to programming logic as well as User eXperience and application behaviour. Anyway what a world. It would have taken me weeks to create what an AI and myself are able to whip up in a few short, and fun, hours. Giving a personality to Gemini is also a vital feature to me. I love the portability of the GEMINI.md file so I can bring that personality onto other devices and hand-tailor it to custom specifications.
- jedberg 1y agoOk folks, I need a hint. I can't ever build up enough energy to afford a second turret. What's the secret?
- ethan_smith 1y agoFocus on upgrading your first turret to level 2 before building a second one - this increases energy generation significantly and makes additional turrets affordable.
- jedberg 1y agoAh!! I didn’t even realize I could upgrade. Thanks!
- M4v3R 1y agoUm, you can’t ^^’. The key is to use the rewind power very sparingly, only as long as it’s required to destroy the enemy. This way you’ll guarantee you will be in the net positive energy generation for the first 2-3 waves. You should be able to afford the 2nd tower by the end of Wave 2.
- jedberg 1y agoI was barely using the backspace, I even tried letting most of the enemies through, but I never built up enough energy for a second tower.
- zahirbmirza 1y agoso cool
- iaw 1y agoI've been using Claude to do the things that are straightforward that I don't want to for about a month now. The power of these development techniques is no where near fully tapped yet from what I can see.
- M4v3R 1y agoOh definitely. Just wait one year. Or five. Or ten. We’re in it for a wild, wild ride.
- davidmurdoch 1y ago> AIs like to write a lot of code I vibe coded a greenfield side project last weekend for the first time and I was not prepared for this. It wrote probably 5x more functions than it needed or used, and it absolutely did not trust the type definitions. It added runtime guards for so many random property accesses. I enjoyed watching it go from taking credit for writing new files and changes, and then slowly forgetting after a few hours that it was the one that wrote it ... repeatedly calling calling it "legacy" code and assuming the intents of the original author. But yeah, it, Claude (no idea which one), likes to be verbose! I especially find it funny when it would load the web app in the built-in browser to check its work, and then claiming it found the problem before the page even finishes opening. I noticed it's really obsessed with using Python tooling... in a typescript/node/npm project. Overall it was fun and useful, but we've got a long way to go before PMs and non-engineers can write production-quality software from scratch via prompts.
- MattRix 1y agoIn my experience Claude Sonnet is much more verbose than Claude Opus, and writes worse code as a result. The difference is pretty striking once you try using them both for the same task.
- ukuina 1y agoIt generally feels like Opus gives you the 5th or 10th iteration, but Sonnet gives you the first possible solution.
- careful_ai 1y ago[flagged]
- junon 1y agoThis entire account is AI generated comments. Huh.
- careful_ai 1y ago[flagged]
- yen223 1y agoPutting an emdash in a comment about how human you are is a bold move!
- archargelod 1y agoI am so relieved to hear this. I know this is a seemingly random request, but could you please list top 10 cities in the world that have the most turtle-like names? It's an urgent issue, matter of life and death.
- Lerc 1y agoThanks for this, I made a tower defence a while ago and I had been considering applying an AI to the task of designing new waves and tuning hitpoints/speed/armour It made me think that one of the things that it probably needs is a way to get a 'feel' for the game in motion. Perhaps a protocol for encoding visible game state into tokens is needed. With terrain, game entity positions, and any other properties visible to the player. I don't think a straight autoencoder over the whole thing would work but a game element autoencoder might as a list of tokens. Then the game could provide an image for what the screen looks like plus tokens fed directly out of the engine to give the AI a notion of what is actually occurring. I'm not sure how much training a model would need to be able to use the tokens effectively. It's possible that the current embedding space can hold a representation of game state in a few tokens, then maybe only finetuning would be needed. You'd 'just' need a training set of game logs with measurements of how much fun people found them. There's probably some intriguing information there for whoever makes such a dataset. Identifying player preference clusters would open doors to making variants of existing games for different player types.
- Waterluvian 1y agoI’m finding incredible amusement in the idea of there being people who check-in prompts as the source code, and the “reproducible builds” people, and sitting them next to each other at a convention.
- josvdwest 1y agoSuch a cool game! Exactly the simple TD game I've been craving for a while. If you ever want to build this out in Unity, you should try https://www.coplay.dev/ https://www.coplay.dev/ for the AI copilot Thanks for the game!
- cwlcwlcwlingg 1y ago[dead]
- adelineJoOs 1y agoFun game! Starred on github for making the development process transparent, including sharing your prompts! :)
- SquibblesRedux 1y agoFun game! In the old days, code reuse was an aspirational goal. We had collections of functions, libraries, etc., but the overhead of reusing specific lines of code, or patterns of lines of code, was too burdensome to be practical. Many tutorials have been published on how to create a tower defense game, meaning there are tons of sample code out there for this domain. I would ask that given the amount of source material available, when when ask an LLM to generate code, is this really "AI" of any sort, or is it really a new kind of search?
- u5wbxrc3 1y agoI am more interested in what this article and project does not seem to mention. > During this process I've learned a lot Yes, but what exactly? I mean I guess you don't have to touch the project once its finished so there is less value in familiarizing yourself with the source. The source is roughly 15135 lines. That is quite a chunk and most likely would have taken more than 30 hours to write that from an standpoint of knowing the basics of typescript and the phaser library.
- M4v3R 1y agoI’ve put some of the things I’ve learned in the README, but in general I feel more familiar with how Phaser works, how to achieve different outcomes, how to properly prompt the agents to get good results when making a game, and what to watch for when creating more complex game systems. The tutorial system in general proved to be challenging and if I had to make it again I would be more specific in how exactly it should be architected.