How I built an AI that plays a game for me: the architecture and what broke

Written by Jeff Pascal · Updated · 7 minute read

In short

  • I love games but no longer have the hours they ask for, so I had Claude Code build a program that plays my character, on my own account, for me.
  • The loop has five steps: capture, understand, decide, act, check. Almost all of it is ordinary code that the AI wrote and fixes. The model does not press each button.
  • The failures taught me the most: predictable tools around an unpredictable model, a person at the points where a mistake costs, and a written log of every decision.

The program that plays my game character got 393 changes in two months, all made with Claude Code at my request, and the most useful thing it taught me has nothing to do with games. If you want an AI to play a game for you, or to run any repeated task, do not let the model press the buttons. Let it build and watch the tools that do. Here is the architecture, what failed along the way, and why I now build business automation the same way.

Why I wanted an AI to play for me

I play an old online role-playing game: monsters, quests, traders, long walks between towns. The fun part is watching the character grow. The hard part is the hours, the same zones and the same routes, day after day.

I wanted the satisfaction without the grind. I did not want a bot bought online that I could not read or change. So I started from an open-source bot (its code is public) that could already play the basics, and had Claude Code build everything that was missing. Claude Code is Anthropic's AI tool that works inside the files on your computer: it reads code, edits it, runs commands and reports back.

One note before anything else: I did this on my own account, for myself. Many online games forbid programs that play for you, and it is your account to lose. If you want to try this, read your game's rules first.

The loop: capture, understand, decide, act, check

Every automation I have built since follows the same five steps.

  1. Capture. The program receives everything the game sends: where the character stands, what is in the bag, which monsters are close. Each message goes into a log, in order. When it needs to read a dialog window, it takes a screenshot of the game with a coordinate grid on top.
  2. Understand. From those messages it rebuilds the state of the game. The walkable map comes from the game's own files, and so does the list of characters in the world and about 12,000 places where monsters appear. It adds what it sees while it plays.
  3. Decide. This is the part that surprises people: almost every decision is plain code, not AI. The program has modes (training, trading, quests) and task scripts that read like a to-do list: wait until 20:00, do 6 trade runs, return to the hunting area, hunt for an hour. Routes come from a classic pathfinding algorithm on the map.
  4. Act. A small control panel that only answers on that computer: go there, take the quest, start, stop. Commands that move the character refuse to run while the automation is busy, unless someone takes control on purpose.
  5. Check. Important events go into one stream: the character died, levelled up, got stuck, disconnected, finished a quest. Every part of the program tags its log lines, so a failure is easy to find.

So where is the AI? In two places. Claude Code wrote and fixed the fixed code, one change at a time, after I said what I wanted. And Claude Code reads the events and the logs, uses the control panel, and tells me what it is doing. The model supervises. The code plays.

To step away from the computer, the in-game chat is forwarded to my phone over Telegram, and I answer from there myself.

The human checkpoints

A few rules came from me and are written into the project's notes:

  • When it does not know, it asks. If the AI does not know where a monster lives, it asks me instead of guessing.
  • It asks before a restart, unless I asked for one.
  • It stops after three tries. If a trade run gets stuck and three attempts to free it fail, the program stops and waits for a person.
  • The shared page cannot move anything. I have a private web page where the AI and I watch the route planner search the map. From it I can change routing rules, never move the character.
  • Everything is written down. The project has 18 decision records (what we chose and why), a daily journal and a symptom, cause, fix table. A fresh AI session picks up from those, not from my memory.

What broke (numbers from the project's own logs)

  • Routes through walls. Over 3 days the program got stuck 345 times, 79% of them on long routes. The planning map flattened upper floors onto the ground and drew paths through walls. The fix: check every leg of a route before accepting it.
  • The bot and the game disagreed. Sometimes the bot thought the character was in one place while the game showed it somewhere else. One real click on the ground made the game resend the true position.
  • One click froze everything. On Windows, a click inside a console window starts a text selection and blocks all output until you press Enter. Several times while I was away, new changes stopped applying. I found the cause, not the AI.
  • The laptop ran out of memory. Eleven leftover build processes took about 1.2 GB and froze the 8 GB laptop. Builds now have a cap.
  • Two listeners on one channel. The game program and another tool of mine read the same Telegram bot. The other tool went quiet for 8 days before I noticed.
  • Restarts replayed the whole log. To rebuild its state after a restart, the program re-read every message of the session: 11,101 messages in 48 seconds early on. A crash in one part used to stop every part after it. Now each part is guarded on its own.

What it taught me about real AI automation

Anthropic's own guide to agents says to find the simplest solution possible and add complexity only when needed. The same guide warns that agents working on their own cost more and can compound errors. That matches what I saw, step by step.

Building small automations like this is how I test where AI helps and where it gets in the way. If you want to try similar experiments with others learning to put AI to work for themselves, come join Team of One, my free WhatsApp community.

  • Deterministic tools around a non-deterministic model. A model rarely answers the same way twice; code does. Let the model write and repair the tools and let the tools do the repetitive work. When something fails, the log shows which step did it.
  • People sit where a mistake is expensive. I do not check every step. I check what cannot be undone and what the program does not know.
  • No journal, no project. The written decisions are the difference between an idea and something I can continue tomorrow.

The same loop at work

I see both worlds every day. In a game, a mistake costs me a trade run. In a business, it costs a customer. Take a quote request that arrives by email:

  1. Capture: the program reads the email and the attachments.
  2. Understand: it pulls out products, quantities and the deadline.
  3. Decide: your price list and discount rules set the price; the model writes the text.
  4. Act: it saves the quote as a draft.
  5. Check: a person reads it and presses send.

I run more than 8,000 servers that serve AI around the clock, and I still do not let an AI email a customer without my approval. For what agents can do in a small company, see AI agents for business.

Want a loop like this for your own work?

The personal AI assistant we are building follows the same plan: it reads, prepares, does the safe steps itself and asks you before anything that matters. The page is not open to everyone yet, but you can become a trial member and we will talk about what it could take off your plate. The project facts above come from its own documentation and journal, read on 21 November 2026.

Questions

Can an AI model play a video game by itself?

It can look at screenshots and click, but that is slow and it does not behave the same way twice. What worked for me was a program with fixed rules doing the playing, and the AI writing, fixing and supervising that program.

Is it allowed to use a bot in an online game?

It depends on the game. Many online games ban programs that play for you in their terms and can close the account. Read the rules of your game first. I run mine on my own account, for myself.

Do I need to know how to code?

Claude Code wrote the code. I still had to know what I wanted, read what it reported and make the calls. Without the habit of checking, a project like this stalls fast.

What does a game bot have to do with business automation?

The same loop runs a quote request or an invoice: read it, pull out the facts, apply your rules, prepare the result, and let a person approve anything that reaches a customer or moves money.

Sources

  1. Anthropic: Building effective agents, 19 December 2024

Free WhatsApp community

Learning AI? Learn it on real work.

In “Team of one” I post what I actually tried on my own work. Most of it is in Romanian, but ask in English any time and we will work it out together.

Join the community