cruntrix
BUILDTUTORIAL

How to build a browser game with AI: a beginner's guide

You can describe a game in plain English and have an AI write a playable version in an afternoon. What to use, how to prompt it, how to test and publish, and the rules that catch people out.

Research-based: specs + published reviews

Illustration of a game controller with the title Build a browser game with AI

In early 2025, the indie developer Pieter Levels built a 3D flight simulator that runs in a web browser in a few hours, using an AI code editor and the three.js library, with no game-development background. It went viral, and “vibe coding” (describing what you want and letting AI write the code) went mainstream with it.

You don’t need to go viral to have fun with this. A small, playable browser game is now a realistic weekend project for a beginner. Here’s how to build a browser game with AI, step by step, and where people usually go wrong.

What you’ll need

Step 1: Pick a tiny game

The most common beginner mistake is asking for too much. “An open-world RPG” will produce a mess; “a one-screen game where you dodge falling rocks” will produce something you can play in ten minutes.

Good first projects have one verb (jump, dodge, shoot, match, steer), one screen, and one way to win or lose. Classics like Snake, Breakout, Flappy Bird or a simple endless runner are ideal, because the AI knows them well and you’ll notice quickly if something’s wrong.

Step 2: Write a one-paragraph brief

Before you prompt, write down what the game is in a few sentences. Then turn it into a prompt that covers:

  1. The game: what the player does and what makes them win or lose.
  2. The controls: keyboard, mouse, touch, or all three.
  3. The tech: “a single HTML file using Phaser 3 from a CDN” (or three.js), so it runs by double-clicking the file.
  4. The screens: a start screen, the game, and a game-over screen with the score and a restart button.
  5. The look: simple coloured shapes are fine for a first version; you can add art later.

For example: “Make a browser game in a single HTML file using Phaser 3 from a CDN. The player moves a paddle left and right with the arrow keys or by dragging on a touchscreen. Rocks fall from the top at increasing speed. Catching gems adds points; getting hit by a rock ends the game. Include a start screen, a score in the corner, and a game-over screen with a restart button. Use simple coloured shapes.”

Step 3: Run it, then fix one thing at a time

Save the code as index.html and open it in your browser. Something will be wrong: that’s normal. Fix it in small steps:

Step 4: Make it feel good

A game that works isn’t the same as a game that’s fun. This is where your judgement matters more than the AI’s. Play it and ask yourself:

Then ask for specific tweaks: “make the rocks fall 20% slower for the first ten seconds”, “add a short screen shake when the player is hit”, “add a sound when a gem is caught, using the Web Audio API”.

Step 5: Test it on a phone

Most casual browser games are played on phones, and a game that runs well on your laptop can stutter or be unplayable on a cheap phone. Put the file online (see the next step) and open it on a real phone. Check that touch controls work, that the game fits the screen in the orientation you designed for, and that it stays smooth.

Step 6: Publish it

A browser game is just files, so you can put it online for free:

The rules that catch people out

Platform What it says about AI and promotion
Poki Encourages thoughtful AI use but says AI content must add value, not replace craft, and warns that games made solely with AI can raise IP ownership issues
CrazyGames No specific AI rule in its public docs, but games must not cross-promote other games or platforms
Steam Requires developers to disclose generative AI used in the game
Playdate (Catalog) Stopped accepting games made with certain kinds of generative AI in 2026

Policies change often, so check each platform’s current developer pages before you submit. Also avoid obvious copies of existing hits: portals commonly reject duplicate or templated games, low-quality builds and anything with unclear copyright.

What AI is good at, and what it isn’t

AI is very good at the mechanical parts: game loops, collisions, scoring, menus, saving high scores, and fixing a bug you describe clearly. It’s much weaker at the parts that make a game worth playing: knowing what’s fun, getting the feel of a jump or a hit right, keeping things fast on old phones, and coming up with an original twist. Left to itself, it reaches for the most common version of everything.

So treat it as a fast, tireless programmer who needs a good designer. The designer is you. If you’re curious how studios are using the same tools, and why many developers are uneasy about it, read how AI is changing game development. And for inspiration, browse these free browser games you can play right now.

FAQ

Do I need to know how to code?

Not to get started, but a little knowledge goes a long way. You'll need to read error messages, describe bugs precisely, and understand roughly how the pieces of a game fit together, or you'll get stuck the first time something breaks.

Do I own a game the AI wrote?

It's a grey area that depends on where you live and how much of the work is yours. Poki warns that games created solely with AI can raise IP ownership issues. The more you design, edit and add yourself, the stronger your position.

Which AI is best for writing games?

Any of the major assistants (ChatGPT, Claude or Gemini) or an AI code editor like Cursor or GitHub Copilot can write a small browser game. What matters more is choosing a well-known library such as Phaser or three.js, which these models have seen a lot of.

SOURCES

Nate ArdenEditor of Cruntrix. Edits every article before it goes up and writes the Build section.