How to make a game with Gemini
Gemini runs the game next to the conversation, so you play it before you save anything. Four steps, one prompt, and no files until you want one.
Jump to a section
Turn on Canvas, paste the prompt below, and Gemini writes the game and runs it in a panel next to the chat. Play it there, say the one thing that is wrong, and watch the panel reload. Nothing is saved to your computer until you decide you want it.
A Google account. A browser. Ten minutes. A free account is enough for everything on this page, and there is nothing to install.
Four steps to your first game#
Open the Gemini app and look under the prompt box for Canvas. In some versions it sits behind the plus or Add files button. Miss this and the game arrives as text you have to copy out by hand.
One message, nothing else. Gemini writes the whole game, then runs it in the Canvas panel.
No saving, no downloading, no switching windows. Play properly and lose on purpose. If nothing happens at all, press Show console and read the first red line.
One per message. The basket keeps sliding after I let go of the key. Gemini edits the code and the preview reloads by itself. Repeat until you run out of complaints.
Make a complete browser game in ONE HTML file. Everything lives inside
that one file: no libraries, no separate files, no image files.
GAME: fruit falls from the top of the screen, one piece at a time. Red
fruit belongs in the left basket, blue fruit in the right basket. The
left and right arrow keys slide a single basket between the two spots.
SCORING: one point per catch. Three wrong catches and the game ends.
Show the score, the best score so far, and a Play again button.
PHONE: tapping the left half of the screen sends the basket left, the
right half sends it right.
ART: canvas shapes and flat colour only. Nothing downloaded.
SAVING: remember the best score with localStorage.
THREE THINGS THAT MUST BE RIGHT:
1. Base all movement on the seconds elapsed between frames, limited to
0.05, so the game is not twice as fast on a 120Hz screen.
2. Put canvas { touch-action: none; } in the CSS, or a tap scrolls the
page instead of moving the basket.
3. Keep every number I might want to adjust together in one CONFIG
object at the top of the script.
Run it in the preview when you are done.
Replace the GAME and SCORING lines with your own idea and change nothing else. The three numbered rules are what stop a game feeling broken on somebody else's phone, and they are worth keeping in every prompt you write.
That is the whole method. Everything after this is detail on the four steps above.
What Canvas does that a plain chat does not#
Without Canvas, Gemini answers with a wall of code and your next job is to get it into a file before you can tell whether it works. With Canvas, the game is already running two inches to the right of the sentence you just typed.
Show console is the one people skip. A game that renders nothing at all has usually thrown a single error, and that error is sitting there in plain text waiting to be pasted back into the chat. It turns an hour of guessing into one message.
Then fix one thing at a time#
The first version will run and will not feel right. Every version after it comes from the same short loop, and the loop is quicker here because you never leave the page.
- Read the console before you type. Paste a red line in as it is. Describing an error in your own words throws away the part that identifies it.
- Screenshot anything visual. Press Win + Shift + S, or Cmd + Ctrl + Shift + 4 on a Mac, then Ctrl + V into the message box. Pasting a picture works exactly like pasting text.
- Resist editing the code yourself. The Code button lets you, and a hand edit that Gemini does not know about is the quickest way to confuse its next answer.
- Keep a copy of anything good. Canvas keeps editing one living document, so a version you liked can quietly be written over. Copy it out before a big change.
Every fault that shows up in a first build, with a ready prompt for each, is listed in the prompt guide.
Getting the game out as a file#
Canvas has no download button. Open Share and export, choose Copy contents, then paste the lot into a plain text file named game.html. Double click that file and it opens in your browser as a game.
The trap is the text editor rather than Gemini. Notepad saves game.html.txt unless you change Save as type to All Files, and TextEdit on a Mac has to be switched to plain text first. That step is drawn out in full in the ChatGPT guide.
Which Gemini model should you pick?#
Start with Gemini 3.8 Flash. It has a free tier, and it answers fast enough that the fixing loop does not drag. Gemini 4 Argon is newer and stronger, and almost nobody can use it yet, which is covered just below.
| Model | What it is for | API price per million tokens |
|---|---|---|
| Gemini 3.8 Flash | Building the game. The one to start with. | $0.75 in, $3.75 out |
| Gemini 3.5 Flash-Lite | Bulk work where the cost matters more than the answer. | $0.30 in, $2.50 out |
| Gemini 2.5 Pro | The older heavyweight, still available. | $1.25 in, $10 out |
Google list prices for the API, rechecked on 5 October 2026. The 3.8 Flash rate runs to 31 December 2026 and then rises. Gemini 2.5 Pro costs more on prompts above 200,000 tokens, and nothing at all is metered when you work inside the Gemini app.
Google announced it on 30 September 2026 as its new frontier model, at $2 in and $10 out. You almost certainly cannot pick it. It went to a selected group of security partners first, with paid API customers and the top subscription tier named as next and no date given. When it reaches the app it becomes the one to build with, and nothing else on this page changes.
What a finished game really takes#
Ten minutes gets you something playable. A game people come back to is a longer job, and every creator on Agent Games reports what theirs took.
Two games here were written by a Gemini model. Meteor Dodge came from Gemini 2.5 Pro and reports 15,000 tokens, which is one file and about a minute of play. Neon Rhythm Dash came from Gemini 3.8 Flash and runs to three files.
Two games is not a sample. The Claude and GPT guides quote averages because those models have nine and fourteen entries here to average. Inventing a figure for Gemini would make the most quotable line on this page the one thing on it that is not true.
The models with more entries here give the range. A finished game has run from 28,500 tokens for a deliberately quick build to 10.4 million for a long one. Build times run from under an hour to twenty nine.
✨Games on this site written by Gemini
Common questions#
Can Gemini make a game?
Yes. It writes a complete browser game as one HTML file and, with Canvas turned on, runs it beside the chat so you can play it straight away. A simple arcade game usually works on the first try. Levels, saved progress and online play take many rounds.
Is it free to make a game with Gemini?
Yes. Canvas is available to free Gemini accounts, and Gemini 3.8 Flash has a free tier on the API as well. Paid plans raise the limits and the context window, which only starts to matter once your game gets long.
Where is Canvas in the Gemini app?
Below the prompt box, sometimes behind the plus or Add files button. Choose it before you send your first message. Without it the game comes back as text and you have to move it into a file yourself before you can play anything.
Which Gemini model is best for making games?
Gemini 3.8 Flash. It is Google's current model for coding and agent work, and it is quick enough that a fixing session stays enjoyable. The Flash-Lite models cost less and are meant for bulk work rather than building something new.
How do I download a game Gemini wrote?
There is no download button. Open Share and export, pick Copy contents, and paste it into a plain text file called game.html. On Windows set Save as type to All Files first, or Notepad will add .txt to the name and the browser will show code.
Can I publish a game Gemini wrote?
Yes, and it stays yours. It gets a page of its own recording the model, the prompt and the token count, and anyone can play it without an account. The one rule is that you cannot name it after a game somebody else owns.
Where to go next#
When it is worth someone else's time, publish it. The made with pages list every game here by the model that wrote it, so you can see what other people got out of the same tools.
For ten more prompts you can send unchanged, read the prompt guide. The same walkthrough exists for the other two big models. ChatGPT makes you save the file yourself. Claude has an agent that writes it for you.
Built something? Put it on Agent Games.
Publishing takes a file and a minute. Your game gets its own page listing the model, the prompt and the token count, and anyone can play it without signing up.
Read next