How to make a tower defense game with AI (a real Game Boy Advance test)
Also in: Español · Deutsch · Français · Português · Italiano · Nederlands · Svenska · Norsk · Bahasa Indonesia · Türkçe · Polski · Tiếng Việt · Русский · 日本語 · 한국어 · 繁體中文
To make a tower defense game with AI, open Shiny Gen, start a new game on the GBA Engine, and describe it in the Agent tab: the map and the path, how you build towers, each tower and enemy, the waves, money and lives, and how you win. The AI agent builds the game for the Game Boy Advance, plays it and fixes what it finds, and you download the ROM. We did that for this guide. Six messages gave Tower Defense: slimes, beetles and knights walking a winding dirt path from a cave to a castle gate, a cursor to build, sell and upgrade towers, arrow, cannon, frost and lightning towers, coins, ten lives and ten waves, with title, game over and win screens. It took about 23 minutes of agent time and about 135 gems.

The test: six messages, one tower defense game
We started a new game on the GBA engine, typed one detailed prompt, said "continue" three times, asked for one change and said "continue" once more.
| Message | What we typed | Agent time | Gems |
|---|---|---|---|
| 1 | The prompt below | about 14 min | 10 |
| 2 | "continue" | 2 min 22 s | 26 |
| 3 | "continue" | 1 min 20 s | 23.9 |
| 4 | "continue" | 10 s | 2.7 |
| 5 | A lightning tower and upgrades | 3 min 0 s | 40.1 |
| 6 | "continue" | 1 min 41 s | 32.2 |
That is about 23 minutes of agent time and about 135 gems. The first message's line under it was out of view, so its time is our recording's and its 10 gems come from the gem count.
Step by step: the tower defense game we made
1. Start a GBA game
Press +, choose New, pick Custom for a game of your own, then pick GBA Engine on the Choose an engine screen. In a browser, this link opens a new GBA game directly. The Agent tab is where you talk to the AI.
2. Describe the map, the towers and the waves
A tower defense game is a list of rules, so write them all down: the path, how you build, each tower, each enemy, the waves, the money and the lives. We typed:

3. The first message: the map, the path and the first fixes
The agent drew the meadow, the towers and the enemies, wrote the game in three files (the screens, the path and the waves, and the fighting), and built it. The dirt path did not show at first; the agent found that its background picture had been stretched to fit the screen, redrew it at the size it is shown at, and checked the path, the cave and the gate in a screenshot. It placed an arrow tower and a cannon, saw five of six enemies get through, and made the early waves fairer.
The first message then paused, with this note in the app: "The agent has taken 30 steps on this message and is still going (10.0 gems so far)... Free accounts pause every 30 steps. Any purchase removes this pause." Our recording account had not bought anything. Our next message, "continue", carried on.

4. "continue": all ten waves, then harder
With the first "continue" the agent played all ten waves to the win screen, and the game over screen too, then said the waves were too easy:
With the second it made the late waves tougher and played again: with three towers, lives went 10, 9, 5 and 1 over waves 7 to 10 and it lost at wave 10 with over a thousand coins unspent, so winning needs more towers. With the third it tested the frost tower in a fight: hit enemies slowed down for 120 frames.

5. Ask for the next change
The agent added the lightning tower (50 coins; it hits the nearest enemy, then jumps to up to three more) and an upgrade for any tower (30 coins: more range, twice the reload speed and a gold-trimmed look). It tested the chain with three enemies side by side: one shot hit all three. The last "continue" added flickering sparks along each jump, so you can see the chain, and it played to the win screen with four towers and all ten lives left.


6. Play it and download the ROM
The game plays in the editor and from its card: on-screen buttons on a phone, the keyboard or a controller on a computer. The D-pad moves the cursor, A builds on grass beside the path or upgrades a tower, B sells a tower, L and R switch between the four towers, and Start begins a game, sends the next wave early and restarts. Press Share, then Export .gba ROM to download the cartridge. Exporting is included with any purchase. The ROM guide covers emulators and flash carts.
What we learned from the test
- Write every rule down. Path, build, sell, each tower and enemy, waves, coins, lives and the win: each one became a working rule.
- The agent balances by playing. It found the waves too easy, made them harder, and reported the numbers both times. Whether the final balance is right for you is your call; it did not try other tower mixes.
- The art was drawn as code, and stayed simple. The agent said so itself: "simple shapes drawn in code, not detailed pixel art." Shiny Gen also has built-in AI image generation, which spends gems; this test asked for art drawn as code instead.
- Read what is still open. Here: simple art, a bolt drawn as dots rather than a line, and the balance with other tower mixes.
What to put in a tower defense prompt
- The map: where enemies come from, the path, where they must not reach.
- Building: how you choose a spot and a tower, the cost, selling and upgrading.
- Each tower: what it is good at (fast, area, slow, chain).
- Each enemy: fast, tough, flying, and what it gives when defeated.
- The waves: how many, how they grow, and sending the next one early.
- Money and lives, and how you win and lose.
- The look and the sound: the art style, the screens and the music.
Ideas to ask for next
- "Draw the towers and enemies as more detailed 16 x 16 pixel art."
- "Add a second map with two paths that join before the gate."
- "Add a flying enemy that only arrow and lightning towers can hit."
- "Show each tower's range when the cursor is on it."
- "Add a boss knight in wave 10."
FAQ
Can AI make a tower defense game?
Yes. Describe the path, the towers, the enemies, the waves, the money and the lives, and Shiny Gen's agent builds it for the Game Boy Advance and plays it. Ours took six messages, about 23 minutes of agent time and about 135 gems.
Can I make it for the browser instead?
Yes. Pick the Godot engine on the same screen for a tower defense game that runs in the browser and on phones. We made this one for the GBA.
Is it a real .gba ROM?
Yes. It is a Game Boy Advance cartridge image compiled to the machine's own code, and you can download it. We have played GBA ROMs made this way on real hardware through a flash cart, but not this game; any GBA emulator opens it.
Is it free?
Making, playing and sharing games is free. The built-in agent uses gems, and new accounts get free gems. Exporting a game as a file is included with any purchase. See the pricing page.
