Skip to content

Building Games with AI

Andy Colosimo edited this page Jun 12, 2026 · 1 revision

Building Xaya Games with AI

If you use an AI coding assistant, this wiki ships a ready-made Agent Skill that teaches it how to build a simple on-chain Xaya game correctly on the first try: the verified contract addresses, the XayaX bridge flags, the GSP build recipe, the move format, and the pitfalls that otherwise cost hours (version checks, ZMQ addressing, Docker subnet traps, RPC semantics). Skills follow the open Agent Skills format used by Claude Code and other tools.

Why a skill?

We tested this: an AI agent asked to plan a new Xaya game without the skill produced a mostly-reasonable plan but invented bridge flags that don't exist, could only state the contract addresses with "moderate confidence", refused to commit to the registration fee, got waitforchange semantics wrong, and chose a build path that recompiles all of libxayagame from source. With the skill, the same task produces a plan built on values verified live against Polygon mainnet.

Everything in the skill is consistent with this wiki — it's essentially the Mover tutorial and GSP concepts distilled into a form an AI assistant can apply to your game.

Installing the skill

The skill lives in this wiki's repository under skills/building-xaya-games/ (two files: SKILL.md and REFERENCE.md).

For Claude Code, copy it into your personal skills directory:

git clone https://github.com/xaya/xaya_tutorials.wiki.git
mkdir -p ~/.claude/skills
cp -r xaya_tutorials.wiki/skills/building-xaya-games ~/.claude/skills/

Restart your session, and the skill is picked up automatically whenever you ask for anything Xaya-related. Other agent tools that support the Agent Skills format can load the same folder.

What it covers

  • Verified constants: XayaAccounts, WCHI, and policy contract addresses on Polygon; the public RPC endpoint; the flat 1 WCHI registration fee.
  • The build recipe: scaffolding a new game from the official mover example, the Chain::POLYGON patch, the fast Docker build against the xaya/libxayagame base image, and the exact XayaX + GSP runtime flags.
  • Working code templates: the verified Dockerfile, docker-compose (with the pinned subnet), and Node.js scripts for registering names and sending moves.
  • Pitfalls: the version-check patch, JSON-RPC protocol 2, ZMQ service-name addressing, Docker subnet pinning, defensive move parsing, and correct waitforchange behavior.
  • A verification checklist: the exact log lines and RPC outputs of a healthy GSP.

Scope

The skill covers simple on-chain games — the architecture this wiki teaches, where every move is a Polygon transaction. It deliberately does not cover game channels (off-chain real-time play); a channels-focused skill will ship alongside the full channels tutorial when it lands.

Using it well

Give your assistant a clear game design (id, move format, state shape, rules) and let it scaffold from the mover example — for instance:

Using the building-xaya-games skill, create a new Xaya game with game id gr: players claim cells on an infinite 2D grid with moves like {"c":[x,y]}; the first claimer owns the cell. Scaffold the GSP from the mover example, build it for Polygon, and show me how to test it.

The assistant should produce a project matching the structure of examples/mover-polygon/ in this wiki's repository — and you can always cross-check anything it does against the Mover tutorial, since both are derived from the same verified run.

Clone this wiki locally