Building a game with AI is easier when you configure a loop
How I plan, prototype and build browser games without writing the code myself.
I always wanted to build games. But the animations and the art around them sounded daunting. I felt I did not know enough. Then the AI era came and I gave it a second try.
In this article I will go over what it takes to build a browser game with AI. I will also show how you can try building one yourself without writing the code.
There are two loops in this story. The player loop is what the player goes through. The build loop is what the agent runs to make the game. You design the first one and set up the second.
If the proof of concept is not feasible and fun, go back to the idea. Only then move on to the plan and the build loop.
Before you start
I use Claude or Codex for development, ChatGPT for images, and Grok when I want a short video. You do not need all of these to test an idea. Start with an agent that can build your game and open it in a browser.
If you use Claude, follow the current Claude Code and Chrome setup instructions. The browser connection matters because the agent needs to see and test what it builds.
Design the player loop
Every game has a loop. The player plays a level, gets better, and moves to the next one. The game stays familiar, so even as the difficulty rises, the player can still solve it and keep climbing.
So the first thing you need is a plan for the game and a design for that loop. This has nothing to do with code. It is about how you think players will want to play and climb the ladder. It is a purely creative job, and every person can design their own loop.
To test your loop, answer three questions in one line each:
- What does the player do in the first ten seconds?
- What makes the second level different from the first?
- Why would someone come back tomorrow?
If you cannot answer these, the problem is the idea, not the tools. Fix it before you build anything.
I am using "player loop" for the experience here. It is different from the technical game loop that updates and draws the game each frame.
Visualization
With a clear player loop, you are ready to see the game. This step gives you clarity on how the game should look. Honestly, it also tells you whether the idea is interesting enough. For this I use two things:
- An image generator like ChatGPT. It helps me visualize the scene with different images.
- A video generator like Grok. It turns those images into a short clip of play.
The aim here is to find an angle that looks interesting. Do not aim for perfection. A few images are enough to start, and the video is optional.
This step has saved me real time. I once generated a short clip of a river game and did not like the top-down look. It felt flat. So I switched to a first-person view before writing a single line of code. Changing a video prompt takes a minute. Changing a built game takes hours.
Build a rough POC
This can happen alongside visualization. If you are unsure the game is feasible, do it now. Ask your agent to build a proof of concept. Do not spend time on graphics. Do not cover every condition. The only idea is to test whether this makes sense.
I have used this to kill ideas early. I tried a webcam version of one of my games and it just did not work. I dropped it and shipped the keyboard and touch version instead. That was a cheap lesson because I found out at the POC stage, not after weeks of polish.
Takeaway: at the end of this stage you should know two things.
- The game is feasible.
- The player loop is interesting.
Game development
Congratulations. You have reached the stage where you can start development. Here is how I do it.
1. Draft a plan. Write a concise but reasonably detailed plan of how the game works, what the levels are, and how each level plays. Do not make it too detailed, because you will not want to read it. Do not make it too shallow either. If most things are ambiguous, you will get surprises at the end of a three hour coding session.
2. Split the plan into independent tasks. Once you have reviewed the plan, ask your agent to break it into tasks that do not depend on each other. For example, building the game itself is usually one task. Generating images and sound is another. These can run in parallel, provided they are not changing the same files.
3. Run the build with an agent that can use the browser. I use Claude or Codex with browser access. Interestingly, I can focus on the game rather than reading every line of code. But I still need to explain what I want and check what comes back.
Why browser access matters
Browser access is what turns a one-shot build into a build loop. In my workflow, it does three jobs.
- It helps build the harness. The harness is the place where the game gets opened and played, and where issues are sent back to the coding agent. This is the feedback loop. The agent plays the game, sees what is wrong, and fixes it.
- It can help bring assets into the build. Where the tools and permissions allow it, the agent can use image and video services and bring the results back. I do not have to copy every file around myself.
- It tests through the interface. It can click through the game, take screenshots, and read the console for errors. Bugs I would have missed can show up before I play it.
This needs to be configured. Installing an extension does not mean the agent can see the running game or test everything. Check that it can open the build and actually interact with it.
The build loop in practice
This is the build loop. The agent can do much of the work between checks, and you are mostly the person who decides what "good" looks like.
- Build. The agent builds the next version from the plan.
- Play. The agent opens the game in the browser and plays it.
- Observe. It takes screenshots and reads errors.
- Report. It writes down what is broken or does not match the plan.
- Fix. It changes the game and goes back to step 2.
The loop repeats until the agent finds nothing left to fix. Then you play the build.
You step in at two important points. You review the plan at the start. You play the build yourself at the end. In between, the loop helps find and fix problems. If the controls or the feel are wrong, step in earlier.
Tips that saved me time
- Make one thing at a time. One level, one mechanic, one change per round. Big changes make it hard to see what broke.
- Judge it by playing it. A game can pass every test and still feel bad. Your own hands on the keyboard are the real test.
- Be specific when something feels off. "The corridor view and the map do not agree" is a better note than "it feels wrong".
- Keep the look separate from the logic. You can regenerate art later without touching how the game plays.
- Test where people will play. If you say it works on a phone, try the controls on a real phone too.
- Ship small. A small game you actually finish beats a big game you never ship.
Try it yourself this week
- Write your player loop in five lines.
- Generate three images of one scene.
- If the camera angle is hard to judge, turn the best one into a short clip.
- Ask an agent to build a rough POC. No graphics.
- If it is fun, write the plan, split the tasks, and start the loop.
You do not need to write every line of code yourself. You need a clear idea of how the game should feel, and a build loop that keeps checking it. You may still need help with debugging or deployment. That is another reason to start small.
I built my games this way. You can play them on the home page. If you want your game hosted on this site, hit me up at udit@slayfit.fun.
If you try this, tell me what you build. I would love to play it. You can also share a playable link and the part you want feedback on in r/buildingwebgames. I started it so we can talk about what our games lack and how to improve them.
Note: A finished game does not mean a popular game. I am still trying to find out how to make one popular. I will publish an article when I understand how to do it.