Unattended GUI-Automation Trading Bots

Bots that read the game screen and deliver purchased in-game items to customers, running unattended for hours in production. Contract work for BloxPlaza.com; ongoing.

Status: ongoing contract role (2023–present) as Automation Engineer at BloxPlaza.com, an e-commerce business selling in-game items. Small team; I wrote most of the core, about 15,700 committed lines across 6 repositories (Python, JavaScript/Node.js, Lua).

What it does

The games have no programmatic interface for trading, so delivery has to happen through the game client itself. I designed and built GUI-automation bots that read the game screen and deliver purchased items to customers inside the game automatically. The system runs unattended for hours in production.

Platform

Customers order through claimSite; the Node.js trade server holds bot and customer state machines and assigns customers to trading bots; bots built on BaseBot read the game screen and drive its GUI to deliver items, and send alerts on error.
Customers order through claimSite. The trade server tracks every bot and customer as an explicit state machine and assigns customers to idle bots. Bots built on BaseBot deliver the items through the game's own screen and GUI.
  • BaseBot: a shared bot core, with game-specific trading bots on top (Adopt Me, TTD, and an AI-driven bot).
  • Trade server (Node.js): coordinates bots and customers.
  • claimSite: the web backend for bots, clients, mail and claims.

Design

  • Explicit state machines. Bots are IDLE or PROCESSING_TRADE; customers are WAITING, TRADING, WAITING_BOT_CHANGE, COMPLETED or OUT_OF_STOCK.
  • Safe assignment. The server offers a waiting customer only to idle, non-scanning bots that have not already served them. Orders are split across bots by live stock, and both states switch before the trade starts, so no two bots can claim the same customer.
  • No hanging orders. Items no bot stocks get an out-of-stock message instead of leaving the customer waiting.
  • Controlled shared state. A shared lock lets keep-alive and shutdown act only when a bot is idle. Errors send an alert with a screenshot and reset the bot cleanly.

The hardest bug

An early version crashed reliably at the 23-minute mark. I traced it to a race: two asynchronous event handlers could call the Windows screenshot API at the same moment through separate screenshot objects. I put screen capture behind a single lock, then designed the rest of the system so shared state is touched only under explicit control. That discipline is what lets it run for hours without supervision.

← Research