How to make a 2D platformer in Godot with AI
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 2D platformer in Godot with AI, open Shiny Gen, start a new game on the Godot Engine, and describe the platformer in the Agent tab: the hero, how running and jumping should feel, the levels, what to collect and avoid, the controls and the look. The AI agent builds it in GDScript, draws the art, plays it and fixes what it finds. We did that for this guide. Six messages gave Frog Hop Forest: a green frog hopping through three forest levels, with running that speeds up and slows down, a jump that goes higher the longer you hold it, coyote time, a double jump from level 2, flies to collect, beetles to stomp, a moving platform and a checkpoint halfway through each level. It took about six and a half minutes of agent time and about 39 gems.

The test: six messages, one platformer
We started a new game on the Godot engine, typed one detailed prompt, then said "continue" three times, asked for one change and said "continue" once more.
| Message | What we typed | Agent time | Gems |
|---|---|---|---|
| 1 | The prompt below | 3 min 49 s | 10 |
| 2 | "continue" | 20 s | 10.5 |
| 3 | "continue" | 7 s | 0.4 |
| 4 | "continue" | 2 s | 0.2 |
| 5 | A moving platform and checkpoints | 1 min 36 s | 12.3 |
| 6 | "continue" | 37 s | 5.5 |
That is about six and a half minutes of agent time and about 39 gems.
Why a platformer on the Godot engine
Shiny Gen's Godot Engine is its own build of Godot, and games are written in real GDScript. A platformer there is not limited to a retro screen: it fills a wide window, the background scrolls in layers, and the movement can be tuned in small steps. For a platformer on a retro console, see our Game Boy Color platformer test.
Step by step: the platformer we made
1. Start a Godot game
Press +, choose New, pick Custom for a game of your own, then pick Godot Engine on the Choose an engine screen. In a browser, this link opens a new Godot game directly. The Agent tab is where you talk to the AI.
2. Describe how it should feel
Name the movement you want in words: how running speeds up, how the jump works, and the small things that make a platformer feel fair. We typed:

3. The first message: three levels, played through
In this session the agent did not write the platformer line by line. The game's code file says it was generated from a short list of settings (levels, hero, run speed, jump strength, coyote time and so on), and the agent's work was to change those settings, draw the frog, the flies and the beetles as pixel art, and edit the code where the settings could not say what we asked: it moved the double jump so it unlocks in level 2. Then it played all three levels with its own test player and checked that level 1 has no double jump; it did not report trying the double jump in level 2. It reported:

4. "continue": the controls you have to check
With the first "continue", the agent looked at the game in play and said what it could not test: the on-screen stick and jump button for phones. The next two "continue" messages added nothing: it said the game was finished and asked us to check the touch controls on a phone.
5. Ask for the next change
The agent turned on moving platforms and checkpoints, then tested a fall just past the checkpoint in level 1: lives went from 3 to 2 and the frog came back at the halfway flag. The moving platform it could not confirm. In its last message:

6. Play it, read the code, share it
Press Play to play it, or open the Code view to read the GDScript. Press Share to send a link. Exporting a game as a file is included with any purchase: the starter pack, any gem pack or a membership. For a Godot game the file is a web export, a zip you can host anywhere; the code runs on Shiny Gen's build of Godot, so stock desktop Godot cannot open it as a project.
The GDScript behind the jump
This is the jump from the game's own code, unchanged. COYOTE = 6 frames of grace after walking off a ledge and JBUF = 7 frames of jump buffering are two of the settings at the top of the file. keys & 4 is the jump button.
# a jump press is remembered for a few frames (the jump buffer)
if ((pf_jbuf > 0) and ((pf_on_ground != 0) or (pf_coyote > 0))):
pf_vy = pf_jump_v
pf_on_ground = 0
pf_coyote = 0
pf_jbuf = 0
...
pf_vy = cl_s16((pf_vy + 1))
if (((keys & 4) == 0) and (pf_vy < 0)):
pf_vy = cl_s16((pf_vy + 2))
...
if (pf_on_ground != 0):
pf_coyote = pf_coyote_n
pf_air_jumps = 1
else:
if (pf_coyote > 0):
pf_coyote = (((pf_coyote - 1)) & 255)
Reading it: the frog can jump while it is on the ground or while the coyote counter is above zero; every frame it falls a little faster; and if you let go of the button while it is still rising, it is pulled down three times as fast, which is what makes a short tap a short hop. Standing on the ground refills the coyote counter, and walking off a ledge counts it down.
The code in this session was generated, so it reads more like a machine's than a tutorial's, and it did not keep our request for clear code with short comments: some comments still describe a fox and fruit. The comment on the first line of the excerpt is ours.
What we learned from the test
- Name the feel. "A jump that goes higher the longer you hold the button" and "coyote time" each became a working rule, and the agent checked the double jump was locked in level 1.
- The art was drawn as pixel art in code. Shiny Gen also has built-in AI image generation, which spends gems; this test asked for art drawn as code instead.
- One word was left behind. The win screen still says "FRUIT" for the flies you collect; the agent did not change it. Ask for it to say flies.
- Read what it did not test: the touch controls on a phone, riding the moving platform and the double jump in level 2. Try them yourself.
- "continue" after a finished game adds little. Two of the six messages cost under half a gem and changed nothing; ask for something specific instead.
What to put in a platformer prompt
- The hero and the levels: who, where, how many.
- The movement: run speed and how it speeds up, the jump (height, holding for higher), coyote time, double jump, and when each unlocks.
- What to collect and avoid, and what defeats an enemy.
- The controls for a keyboard and for a phone.
- The look: the art style and the background layers.
- The screens and sound: title, between levels, win, game over, music.
Ideas to ask for next
- "Make the frog's jump a little floatier at the top."
- "Show a count of flies on screen and say flies on the win screen."
- "Add a level with water where the frog swims slowly."
- "Add a boss beetle at the end of level 3."
- "Add a timer and show the best time for each level."
FAQ
Can AI make a platformer in Godot?
Yes. Describe the hero, the movement and the levels, and Shiny Gen's agent builds it in GDScript, draws the art and plays every level. Ours took six messages, about six and a half minutes of agent time and about 39 gems.
Do I need to know GDScript?
No. You describe the game and the agent writes and tests the code. You can read and edit it in the Code view, and editing it by hand costs nothing.
What are coyote time and a jump buffer?
Coyote time lets you still jump for a moment after walking off a ledge. A jump buffer remembers a jump pressed just before landing. In Frog Hop Forest they are 6 and 7 frames.
Can I open the project in desktop Godot?
No. The code is real GDScript you can read and copy, but it runs on Shiny Gen's own build of Godot, so stock desktop Godot cannot open it as a project. You can export the game for the web; exporting is included with any purchase.
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.
