Make a browser game with AI: controls, scoring and phone play in one file
A browser game is a single page that has to load instantly, explain itself in one screen and feel responsive under a thumb as well as a keyboard. Anticode writes the whole game as one HTML, CSS and JavaScript file, with graphics and sound made in code. Here's what a good one needs, how to describe it, and what the sandbox rules out.
The parts every small game needs
Whatever the genre, a finished browser game has the same skeleton. Missing pieces are what make a prototype feel like a prototype:
- A start screen with the title, the controls and one obvious button. Browsers only pass key presses to a page after a click or tap, so the start button also wakes the controls.
- A core loop that's fun within ten seconds: jump, dodge, match, aim. If the first ten seconds are a tutorial, most players won't see the fun part.
- Rising difficulty: speed, density or fewer lives, increasing smoothly rather than in sudden steps.
- Feedback for every action: a sound, a flash, a shake, a score pop. Small effects are the difference between "works" and "feels good".
- Game over and restart in one tap, with the score and the best score shown.
- Pause, and a game that pauses itself when the tab loses focus.
Phone and desktop at once
Most people will open a shared game link on a phone. That changes the design more than any other decision. Keyboard games need touch controls (on-screen buttons, swipe zones or tap-to-jump), the canvas has to scale to the screen without stretching, and nothing important can sit under a thumb. Ask for both input methods explicitly and say which one is primary.
Ask for a canvas that scales to the screen and touch controls on touch screens, and check both on a real phone. When the review service is available, a new app build is also opened in headless Chrome at phone and laptop widths, screenshotted and clicked through, and the screenshots and any errors go back to the model to fix before you see it. That catches the classic failures: a start button off-screen on a small phone, or a script error that leaves a blank canvas.
Describing the game
Lead with the genre and the feeling, then the rules. "An endless runner where a paper boat sails down a gutter in the rain. Tap or press space to hop over leaves and drains. Speed rises every 20 seconds. Calm, rainy sound. Keep the best distance." Naming a famous game as inspiration is fine for describing how it plays; the result is an original design, not a copy of its name, art or levels.
To see what this looks like finished, the template gallery includes Afterglow Run, a synthwave arcade game written by Anticode's model. Using a template copies it into your project with no model call and nothing off your limits, and you can then ask for changes in words: new obstacles, a different palette, slower start.
How the game is built
- Graphics
- Drawn in code with Canvas 2D, WebGL or SVG and CSS. There are no image files from the web, which keeps the game self-contained and the look distinctive.
- Sound
- Made with the Web Audio API: blips, hits and simple music are synthesised in the page rather than loaded.
- Saving
- High scores, unlocked levels and settings are kept in the player's own browser and survive closing the tab.
- Checks
- The code is checked before it's shown or published, with one automatic repair pass if something is caught.
What a sandboxed browser game can't do
Anticode games run with no network of any kind, which rules out a few things people often ask for:
- Online multiplayer. Two players on different devices can't play each other. You can have a computer opponent, or two players on one keyboard or one screen (see two-player games).
- Global leaderboards. Scores are per device. There's no shared high-score table.
- Outside assets. You can't load sprites, music or 3D models from other sites. Everything is generated in code.
- In-game purchases or ads. No payments or ad networks run inside the app.
- Very large games. A single file has a size ceiling, so think arcade game or puzzle rather than an open world.
If you need networked play, accounts or asset pipelines, a game engine such as Godot, Unity or Phaser with your own hosting is the better route. Anticode is a good way to get a polished, shareable small game quickly, or to test whether a mechanic is fun before you commit to an engine; the game prototype page covers that use.
Questions people ask
Can a browser game maker like this make 3D games?
Yes, small ones: the model can use WebGL for 3D scenes drawn in code. Expect simple geometry and stylised looks rather than detailed models, because no 3D files can be loaded.
Does the game work offline?
The game itself needs nothing from the network once loaded. Every published site is also installable as a web app with an offline fallback; test the installed game offline before you rely on it.
Can I put the game on my own domain?
Yes, on paid plans you can connect your own domain. Free sites publish to an anticode.dev address with a small badge.
Can I get the code?
Yes. You can export it as one self-contained HTML file and host it anywhere that serves static files.