How to make a game with AI: a browser game, an engine choice and a first prompt
To make a game with AI, pick one small game with a single mechanic, choose a text-based engine such as Phaser that a coding agent can edit as code, describe the controls, goal and losing condition in a prompt, and play every version the agent produces. Add one feature at a time. Publish the finished browser game as a zip file on itch.io or any static host.
What kind of game can AI help you make?
Small ones, and well. A coding agent can write a playable browser game with movement, scoring, enemies and a restart screen in an afternoon, because those parts are well-known patterns. It is much weaker at the things that make a game good: feel, balance, pacing and a reason to come back. That part is still your job, and it takes playing the game many times.
People call this vibe coding games: you describe what you want, run what the agent produces, and steer. The general method is in what vibe coding is and how to vibe code. Games suit it because feedback is immediate. You press play and see whether it is fun.
- Good first games: a one-button runner, a falling-block puzzle, a memory-match card game, a top-down dodge-the-obstacles game, a quiz with a timer, a small clicker.
- Poor first games: online multiplayer, an open world, anything with a skill tree and ten systems, a clone of a famous commercial game. Each needs far more than one prompt.
Pick one mechanic and one way to win or lose. If you cannot describe the game in three sentences, the scope is too big. For more starting points, the game development project ideas page lists small buildable ones, and the gaming category on the board has ideas other people posted.
Which engine or framework should you use?
A coding agent edits text files, so engines whose projects are mostly text suit it best. Engines that live in a visual editor are harder to drive from a prompt, because much of the work happens in menus and scene panels rather than in code. That is a practical judgement, not a rule: agents can write scripts for any of them.
| Option | What it is | Language | Cost and licence | Good for | Watch out for |
|---|---|---|---|---|---|
| Plain HTML, canvas and JavaScript | No framework; the agent writes everything | JavaScript | Free | Tiny games, learning how a game loop works | You reinvent physics, asset loading and input handling |
| Phaser | A 2D HTML5 game framework with WebGL and Canvas rendering | JavaScript or TypeScript | Free, MIT license | Most 2D browser games; a good default | Large library; ask the agent to keep the project small |
| three.js | A JavaScript 3D library, not a full engine | JavaScript | Free, MIT license | 3D scenes and simple 3D games in a browser | You assemble the game systems yourself |
| Godot | A full open-source engine with an editor, which can export to the web | GDScript, C# and others | Free, MIT license per Godot’s license page | Games you may later ship on desktop or mobile | Web export has limits, listed below |
| Unity | A commercial engine with a large editor and asset store | C# | Unity Personal is free for individuals and small organizations with less than 200K USD of revenue and funds raised in the last 12 months, per Unity’s page | Larger 2D or 3D games and mobile releases | Editor-driven; slower to iterate by prompt |
For a first game that people can open from a link, start with Phaser or plain JavaScript. Godot is a good choice if you want to grow into a proper engine. Its documentation lists limits on web export that you should know about before choosing it:
- Since Godot 4.3 you can export for the web on a single thread, which avoids the server headers that multithreaded exports require, but the single-thread export cannot use threads and is less performant.
- Godot says it does not support WebGPU yet, and that Safari has several WebGL 2.0 problems, so it recommends testing on a Chromium-based browser or Firefox.
- Audio cannot start until the player clicks, taps or presses a key, so you need a start screen.
- Web features that need a secure context require HTTPS.
- Saved data in the browser can be lost in private browsing, and low-level networking is not available.
Check the latest versions of whichever you pick, since engines change often.
What should you write before the first prompt?
A game design in one paragraph. If you leave out the rules, the agent invents some, and they will not be the ones you wanted.
- Core loop: what the player does again and again. “Dodge falling rocks and collect coins.”
- Controls: exact keys and touch gestures. “Left and right arrows move; space jumps. On a phone, tap left or right half of the screen.”
- Goal and failure: how you win, how you lose. “Reach 50 coins to win; three hits end the game.”
- Difficulty: how it changes. “Rocks fall faster every ten seconds.”
- Look: placeholder shapes first. Art comes after the game is fun.
- Out of scope: list what you do not want yet, such as sound, menus, saving, levels.
The AI Coding Prompt Builder can turn a description like this into a scoped first-build prompt, and how to write an app build prompt explains why each section is there.
What is a good first prompt for a game?
Create a small browser game called [name] using Phaser and TypeScript. Set up the project with Vite so I can run it with `npm run dev`. Game: [one sentence, e.g. a one-button runner where you jump over obstacles]. Core loop: [what the player does repeatedly]. Controls: [keys] on desktop and [tap] on a phone. Win: [condition]. Lose: [condition]. After either, show a restart button. Difficulty: [how it ramps up]. Rules for the build: - Use colored rectangles and circles as placeholders. No external assets. - Make movement independent of frame rate, using delta time, so it plays the same on a 60 Hz and a 144 Hz screen. - Keep the code in a few small files: one scene for the title screen, one for play, one for game over. - Show the score on screen. Keep the best score in memory only. - Start sound only after the first click or tap. - Do not add multiplayer, accounts, menus or saving. When you finish, tell me the command to start the game, which files you created, and three things you would improve next. Then stop.
Phaser’s own repository documents a project generator you can use instead of asking the agent to set up the files, npm create @phaserjs/game@latest, which offers official templates for several bundlers. Either way, the aim of the first prompt is a game you can run, not a game you like.
Then work in small steps, with one feature per message: add a second obstacle type, make the jump higher when you hold the key, add a high score that persists, add sound effects. After each step, play it for two minutes before you ask for the next.
What goes wrong in AI-made games, and how do you test for it?
| Problem | How to spot it | What to ask the agent |
|---|---|---|
| Speed depends on screen refresh rate | Game feels faster on a high-refresh monitor | Make all movement use delta time |
| Collisions that are too generous or too strict | You die without touching anything, or pass through things | Show collision boxes in a debug mode and shrink them to fit the art |
| Touch controls missing or awkward | Open the game on a phone | Add tap zones and test at both phone orientations |
| No sound until a click | Silent first screen | Start audio from the first click or tap |
| Difficulty spikes or never grows | Play five minutes and note when you got bored | Print the difficulty curve and change one number at a time |
| Restart leaves old state behind | Die and restart three times; look for odd behaviour | Reset every variable in one function |
| Game freezes after minutes | Leave it running for ten minutes | Check for objects that are never removed |
Test on at least one phone and one laptop. Then hand it to someone who has never seen it and say nothing. Watch where they hesitate. That tells you more than any bug list.
What about art and sound?
Do them last. A game with rectangles that is fun beats a beautiful one that is not. When you are ready for art, you have three routes: free or paid asset packs with a licence that allows your use, art you make or commission, or art from an AI image tool.
How do you publish a browser game?
You need a build that runs from a folder of static files. In Vite, that is npm run build, which produces a folder you can upload.
- itch.io. Its HTML5 upload guide says to choose “HTML Game” as the kind of project and upload a ZIP file that contains an index.html file as the entry point. File names are case sensitive and paths should be relative, so the game works once uploaded.
- Your own site. Upload the same folder to any static host. Read the host’s terms if the game earns money; see how to build a website with AI for what free hosts allow.
- Share a link first. Send it to ten people before you post it publicly, and ask what confused them.
Write a one-line description, a screenshot and a list of controls on the page. Games with no instructions are abandoned in seconds.
If the game started from an idea on the board, like Game where you do workout and fight monsters, something like Pushup RPG, you can attach it under “Built this?” on that idea once it is playable. If you have a game idea you will not build, post it on the board: every idea gets a generated build prompt.
Frequently asked questions
Can AI make a game for me?
It can write a small, playable game from a clear description, usually a 2D browser game with simple controls. It cannot judge whether the game is fun. You have to play it, decide what to change and ask for the next step. Larger or multiplayer games need far more planning than one prompt.
What is vibe coding a game?
It means describing the game in plain language and letting an AI coding agent write the code, then playing it and steering with follow-up prompts instead of writing the code yourself. It suits small games with fast feedback. Keep the scope tiny, add one feature per prompt and test after each.
Which engine is best for making a game with AI?
For a first browser game, Phaser or plain JavaScript are easy for an agent to edit because the project is just code. Godot suits games you may later ship on desktop or mobile. Unity is powerful but editor-driven. Choose by where you want to publish, not by the tool’s reputation.
Can I make a game with AI for free?
Often yes. Phaser, three.js and Godot are free and open source under the MIT license, and Unity Personal is free below a revenue and funding threshold. Your costs are the AI coding tool, which may have a free tier, and any art or hosting. Check current prices on the providers’ pages.
How long does it take to make a game with AI?
A very simple playable version can take an afternoon. A game people enjoy for longer takes days or weeks of playing, tuning and fixing. The first prompt is quick, but balance, controls on phones and bugs take time, and an agent cannot do that playtesting for you.
Where can I publish a game I made with AI?
A browser game can go on itch.io as a ZIP file with an index.html, or on any static host. Share it with a few people first and add controls and a description on the page. Check the licences of all assets and the terms of any generator you used.
Created with AI assistance and edited for this site. Examples are illustrative and do not represent customer research. About the publisher.