Civilization V Harness (Linux)
v2.20.1Play Sid Meier's Civilization V (native Linux) as a human seat, by the game's own rules.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
reference
What things do, in two books. book="rules" (the default): the rule book of this very game, read once from its database (mods and DLC included) and cached -- every unit, building, wonder, project, process, promotion, social policy and ideology tenet, technology, belief, resource, terrain, feature, improvement, specialist and unit action, with its numbers. book="playbook": how to play through these tools (the turn loop, batches, blockers, diplomacy, the house rules, the action table). Read-only, usable while it is not my turn. Use it to learn what a choice means; use state fo…
| Parameter | Type | Description |
|---|---|---|
book | string | 'rules' (default): what everything in this game does; 'playbook': how to play through these tools |
find | rules: keep only the headings and the lines containing this word (a section too long for one reply: promotions, buildings) | |
section | one section: a rule-book heading (terrain, units, buildings, ...) or a playbook topic; left out, the book's index |
turn
The clock: my seat's turn loop, one action per call. Actions: status -- whose turn it is, the `gate` (answer it before anything else), what blocks the end. Read-only. briefing -- my turn in one read: decisions with their `actions` rows, changes, board, threats, notes. finish -- run `actions` as a batch, end my turn, wait until it is mine again, return the new turn. end -- end the turn only, no wait. wait -- block until it is my turn again. Arguments by action: since, limit and detail belong to briefing (since='turn' after a context reset; detail='digest' is the event digest alone); a…
| Parameter | Type | Description |
|---|---|---|
action * | string | status | briefing | finish | end | wait |
actions | finish only: order rows to run before the turn ends, [{tool, args}] as the reads hand them back | |
args | finish / end only, by name: skip_quiet_turns (a count: keep ending turns, up to N more, while nothing needs you), wake_on (words that stop a quiet run), autosave (default true), force (take the turn o… | |
detail | string | briefing: 'compact' (default) or 'digest' (the event digest alone) |
limit | briefing: rows per list of changes and notes (default 8) | |
notes | string | finish: which notebook notes ride on the reply, 'new' (default) or 'all' |
since | string | briefing: 'previous' (default) compares with my last briefing, 'turn' with the last turn end (after a context reset) |
timeout_seconds | finish / wait: seconds to wait for my turn before answering with the state so far (default 600) |
state
Read the game as my seat sees it: the empire, units, cities, civs and city-states, the map, the league, spies, the screens, and the choices open to me (research, policies, beliefs, trade routes). Read-only, usable while it is not my turn. Use it before an order (its rows ARE the orders) and after one to verify; use reference for what things do, question for what a popup asks, turn for the turn's own state. How to call: `what` names the object, `view` the part of it (left out: the default view), `id` the one object. Objects and their views: empire: default, demographics notifications: defau…
| Parameter | Type | Description |
|---|---|---|
what * | string | the object: empire, notifications, screen, league, spies, units, unit, cities, city, map, civs, civ, city_state, options, compare |
args | the rest by the old call's name (compare's fields) | |
detail | string | 'summary' or 'full' where a view offers both; map/window: 'threats' (who can strike the plot x, y) or 'ring' (the plots at exactly `radius` from it) |
id | the one object's id (unit, city, civ, city-state or spy; the explorer's unit id for map/frontier and the caravan's for options/trade_routes); a list of unit ids for units/actions | |
item | string | city/production: price this one item |
kind | string | options/beliefs: the belief kind; compare: what to compare |
limit | how many rows a list returns | |
mission | string | unit/targets: the mission whose legal targets to list |
radius | map/window and map/grid: tiles around x, y; unit/tactical: tiles around the unit | |
since | notifications: only those after this turn number | |
view | string | the part of the object, from the list below; the default view when left out |
x | map/window and map/grid: the centre plot, with y | |
y | with x | |
yield_type | string | city/production with item: the yield to price it in |
order
An order to something I own: `to` the target kind, `id` which one, `action` the verb, `args` its arguments by name. It changes the game, and most of it cannot be undone (a disbanded unit, a declared war, a purchase). Not a read: state shows the board and hands back the rows, question / answer settle what a popup asks, turn(action='finish') ends the turn. to: actions -- unit: move, mission, promote, upgrade, disband, trade_route, plunder city: produce, purchase, dequeue, sell_building, buy_plot, specialist, work_plot, governor, status, strike, great_work empire: research, policy, ideology…
| Parameter | Type | Description |
|---|---|---|
action * | string | the verb, by target -- unit: move, mission, promote, upgrade, disband, trade_route, plunder; city: produce, purchase, dequeue, sell_building, buy_plot, specialist, work_plot, governor, status, strike,… |
to * | string | the target kind, something I own |
action_id | a token of my choosing: a retry with the same action_id replays the stored result instead of acting twice | |
args | the action's arguments by name, as the copied row has them; a refusal shows the shape with an example | |
id | which unit, city, civ, city-state or spy; empire and league take none |
question
What the game is asking right now, so answer() can settle it. Read-only; takes nothing. Use it whenever a reply's `gate` is not null or turn(action='status') says discussion_pending; use state for the board and reference for the rules. It shows one of: a decision popup (a tech, a production item, a policy, a promotion, a belief, a ruins reward, a captured city's fate, a Great Person's use, a dig), the leader on screen with their words and the deal on the table, another human seat's proposal waiting on the trade table, or nothing pending. Returns the popup's own read -- the question in words pl…
answer
Answer what the game is asking: settle the one popup, leader screen or deal that question() shows, and nothing else. `choice` is the `answers` row's choice: an item's name (a TECH_, UNIT_, BUILDING_, POLICY_, PROMOTION_, BELIEF_ or goody name; liberate / annex / puppet / raze; a dig's choice number), a popup's or leader screen's button number, or on a leader screen accept / refuse (the deal on the table), leave (close it), accept_friendship. `args` carries the rest the popup needs (a promotion's unit_id, a dig's x and y, a stolen tech's player_id, a religion's beliefs and city). Dispatches on…
| Parameter | Type | Description |
|---|---|---|
choice * | the `answers` row's choice: an item name, a button number, or accept / refuse / leave / accept_friendship | |
action_id | a token of my choosing: a retry with the same action_id replays the stored result | |
args | what the popup needs beyond the choice: unit_id, x and y, player_id, beliefs, city |
notebook
My memory, kept beside the game per seat and surviving a context reset or a restart: free-text notes, assignments (what a unit or city is for) and standing orders (a unit's plan the harness carries out over the coming turns). Use it for what future-me must know; the game itself holds no plan. Notes and assignments move nothing; a standing order does: give_order and resume_order run its first steps NOW (a move spends this turn's movement, a build starts) and carry on at the start of each of my turns. action, with its args -- remember {text, tag?, replace_id?}: write a note (returns it with it…
| Parameter | Type | Description |
|---|---|---|
action * | string | remember | recall | forget | assign | assignments | amend | close | give_order | orders | cancel_order | resume_order |
action_id | a token of my choosing: a retry with the same action_id replays the stored result | |
args | the action's arguments by name: text / tag / replace_id, note_id, role and purpose with unit_ids / city_ids, assignment_id, unit_id and steps, order_id |
batch
Many orders in one call, in order, with the turn left open: actions is a list of {tool, args} rows -- the rows every read hands back (`actions`, `call`): order, answer and notebook rows alike -- each run as that call and answered under `results`. The first refusal stops the rest by default, since the state the later rows were reasoned about is no longer certain (stop_on_refusal=false runs them all); the rows not run come back under `skipped`. force=true takes over this turn's claim when another client of my seat holds it (otherwise the first row is refused with `turn_claim`). Not inside: the t…
| Parameter | Type | Description |
|---|---|---|
actions * | array | the rows to run in order, [{tool, args}], as every read hands them back |
force | boolean | take over this turn's claim when another client of my seat holds it (default false: the first row is then refused with turn_claim) |
stop_on_refusal | boolean | stop at the first refused row (default true); false runs them all |
session
Saves, loads and the seat of this game session: keep a state before a risky turn, open another save, leave a finished game, say which hotseat seat this server plays. It never plays a turn; use turn for that. Side effects: a load replaces the game on screen for everyone on it, and a hotseat game loads paused until turn(action='wait'); the notebook is per game and seat, so it follows a save of the same game and is not touched by a load. action -- save: a quick save of the game on screen into the one quick-save slot (each finished turn's autosave overwrites that slot, so copy a save you want kept…
| Parameter | Type | Description |
|---|---|---|
action * | string | save | load | load_latest | main_menu | seat |
args | load: {filename} (a save's name without the single/ prefix); seat: {seat} (0 or 1) |