Play the RTS against the computer

Play a skirmish against the in-sim AI, or seat it in a networked lobby

The RTS has a computer opponent. It plays inside the simulation on every node, from an authored profile, and it sees only what its side sees. This guide starts a single-player match, sets up a skirmish, puts the computer in a networked lobby, and lets an LLM operator play a side.

Play a single-player match

  1. Open RTS from the apps menu.
  2. Choose Single player.

You play the first faction against the computer on the second faction, with the normal profile, on the 32 × 32 board. No network and no peer is needed.

Set up a skirmish

  1. Open RTS from the apps menu.
  2. Choose Skirmish.
  3. Pick Your faction, the AI faction, the AI profile and the Map.
  4. Choose Start.

The builtin content has three profiles:

Profile What it does
easy Thinks once every two seconds. Keeps 5 gatherers and 1 production structure. Attacks with 24 supply, not before about 75 seconds. Casts no abilities and changes no modes.
normal Thinks once a second. Keeps 8 gatherers and 2 production structures. Attacks with 16 supply, not before about 50 seconds.
hard Thinks twice a second. Keeps 12 gatherers and 3 production structures. Attacks with 12 supply, not before about 30 seconds.

The profiles are content data (ai_profiles: in the content bundle), so a new bundle can add its own.

What the computer does

Each think, the computer:

  1. Sends its army against an enemy that comes near one of its structures.
  2. Attacks when its army reaches the profile's supply: the nearest enemy structure that it sees, else an enemy start position.
  3. Puts a unit in a long-range mode when enemies are in that range, and casts its units' abilities on enemies in range.
  4. Puts idle gatherers on the nearest resource node, three on ore for each one on gas.
  5. Adds supply, production structures and gatherers up to the profile's targets.
  6. Trains the most expensive fighter that it can pay for, from every idle producer.
  7. Buys the attack upgrade when it has resources to spare.

It trains only its own faction's units. It reacts only to enemies that its side sees, and a cloaked enemy only when a detector of its side is near. It knows the map and the start positions, as a human does.

Put the computer in a networked lobby

In the RTS Lobby, the host can seat the computer:

  1. On an open seat, pick a profile.
  2. Choose Add computer.
  3. Optional: change its faction and team on its seat card.

A computer seat is always ready. To remove it, choose Remove on its seat card. A networked match still needs two nodes: a lone player against the computer plays a skirmish instead.

The computer runs inside the simulation of every node, so nothing about it crosses the network, and a replay of the match replays the computer too.

Let an LLM operator play

An OPAL operator plays a side through two tasks:

  • rts.query-state with owner and fog: true reads what that side sees: units, resource nodes (nodes), the roster with each type's capabilities, and the seats the computer plays (ai_seats).
  • rts.issue-command gives orders: gather with a node id in target, train, build, attackmove and the rest. The order enters the same command stream as the mouse.

Two more tasks help:

  • rts.ai.profiles lists the profiles.
  • rts.soak plays the computer against itself in two private simulations and reports the first turn on which they disagree. Use it to check a content change for a desync.

The host of a lobby seats the computer with rts.match.ai, such as {"seat": 1, "profile": "normal"}, and removes it with "profile": "none".

Topics
howto rts game ai single-player
See also