Audamir

part 51

A game record that replays even when the AI changes

Format 1 recorded only the human's decisions, and the AI recalculated the opponents' moves, so every AI change could make all records outdated. Format 2 records the decisions of every seat. What was measured, and what another person's record proves.

· 17 min read

In the article on the record, the analysis and the music a game looked like one line: the settings, the number of the game, the "salt" of the dice and the decisions of the human. Everything else could be calculated, including the moves of the opponents. That rested on a condition the article called a contract with the past: when a rule or the AI changes, the old records can no longer be replayed the same way. Sixteen days later, on 4 November 2026, that condition was dropped for the AI. The game record (format 2) now records the decisions of every seat, and it replays without the AI being asked even once. This article is the detailed continuation of the section "The record: a game on one line".

Why format 1 was not enough

Format 1 carried the settings, the seed, the salt of the dice and the decisions of the human. It said nothing about the moves of the opponents: at every replay, the built-in AI calculated them again from the same position and with the same dice.

Who decides the moves of the opponents: format 1 against format 2Scheme of two records of the same game CT83EA with eight seats. The length of a bar is the number of entries of the seat: 151, 22, 189, 20, 49, 77, 39 and 45. In format 1 the record has only the bar of seat 0, the human player; the seven bars of the AI opponents are only dashed, because the AI computes them again at every replay. In format 2 the record has all the bars; the decisions of the opponents are 441 in all.Format 1 (from 19 Oct)the record has only the decisions of the human playerseat 0151seat 122seat 2189seat 320seat 449seat 577seat 639seat 745the AIcomputes againat eachreplayFormat 2 (from 4 Nov)the record has the decisions of every seatseat 0151seat 122seat 2189seat 320seat 449seat 577seat 639seat 745in the record441 decisionsof the sevenAI opponentshuman playerAI opponentnot in the record
Who decides the opponents' moves. A real game CT83EA (8 players, 35 rounds; a format 2 record, game 0.119.0, counted 6 Nov 2026). The length of a stripe is the number of entries of the seat: 151 (the human), then 22, 189, 20, 49, 77, 39 and 45 (441 in total). Format 1 would store only the first stripe; the original file had 1,368 bytes.

While the AI does not change, this is short and convenient. When it changes, it has three consequences.

  • Every change of the AI is a change of the game. When editing ai.js, personas.js or data/personas.js in a way that could change even one move, the rule from DESIGN §28 applies: raise RULES_VERSION.
  • Raising the number makes everything outdated: the list of records in the game, the #R= links in other people's messages, the picture, the music and the analysis of old games.
  • An AI written by a player cannot be recalculated by anyone else (ARENA §5: a module that keeps its own state and plans). A record that a third party has to verify must carry the decisions.

It happened once for real. On 22 October (DESIGN §43.2) it was found that with equal strength of the targets the AI took the first opponent by seat number; four Supi had a share of wins of 22.4 / 22.9 / 26.9 / 27.8 %. The fix was small, but it required raising RULES_VERSION from 1 to 2, new golden records, a run of the tool on the old tree of the game, and an exception (rulesPlay) that had to be justified with the tools and 150 games, so that all records would not become outdated at once.

How often did such a question arise? From the start of the record (19 October) until 4 November, the sources of the AI were touched by 14 commits in 7 days: judging by their names, mainly the personalities of the opponents, moves and renamings, and an opponent for Tribes. A change of the moves is documented for two of them, from 22 October and from 4 November; for each one it had to be decided whether to raise the number.

AI sources from 19 Oct to 4 Nov 2026: fourteen commits and two version changesTimeline from 19 October to 4 November 2026. Each square is one commit that touched the AI sources: 6 from 20 Oct (opponent personalities), one from 22 Oct (a different choice of target at equal strength, RULES_VERSION raised from 1 to 2), one each from 26 Oct and 2 Nov, three from 29 to 31 Oct (renamings and moves) and two from 4 Nov (format 2 and step R5 with AI.VERSION 2). The orange ones are the two commits with a documented change of moves. Format 1 would have had to handle the second change by raising RULES_VERSION, which would make all 17 records from the measurement outdated, although only two change; format 2 makes nothing outdated.Commits in the AI sources: 14 in 7 days19 OctFormat 1 of the recordfirst commit (game 0.10.0), RULES_VERSION 120 Octopponent personalities: 6 commits in AI sources22 OctAI picks targets differently at equal strength(the Vulture and Kingslayer personalities)RULES_VERSION 1 → 2 and the rulesPlay exception,new golden records and three extra games26 Octthe AI also places dice for the human seat29 – 31 Octrenaming results, moving files and keys(by the commit names, no change to the game)2 Novthe opponent of the original game, for Tribes4 Nov morningFormat 2: a workaround for AI and for the formatRULES_VERSION stays 2, AI.VERSION 14 Nov eveningstep R5: AI level 3 also attacks from a full stackAI.VERSION 2. Format 1 would raise RULES_VERSIONand all records would go outdated (2 of 17 change).Format 2 makes nothing outdated.commit in the AI sourcesdocumented change of movesrecord format (change of format and version numbers)
The sources of the AI (ai.js, personas.js, data/personas.js, bots.js) from the first record (19 Oct 2026) to step R5 (4 Nov): one square is one commit (git log without merges). The orange ones are the two with a documented change of the moves, the grey ones are described only by the name of the commit. The version numbers are from the game.

What would happen today

From the evening of 4 November comes the second change of the AI (step R5, AI.VERSION 2: the level 3 AI continues an attack from a full stack when every attack comes out below zero). It can be tried on records made with the old AI: 15 golden games, CT83EA (8 players, 35 rounds) and FEPJB5 (a real game of 113 rounds). From each one, only the human's decisions against today's AI were replayed, exactly what format 1 did. The table shows how many records replay from their own decisions (the format 2 column) and how many against today's AI (the format 1 column).

Records of AI version 1format 2format 1
12 golden games12 of 1210 of 12
3 golden games on drawn maps3 of 33 of 3
CT83EA, 8 playersyesyes
FEPJB5, a real gameyesyes
Total17 of 1715 of 17

Two games come apart: "Principalities, 2 players" (the replay stops in round 5 of 22) and "Daily challenge" (in round 20 of 58). Both have level 3 opponents, which fits the description of the change; both real games had level 2 opponents. For format 1 this is a trap: the version number cannot say which two of the seventeen changed, so all seventeen would become outdated. Format 2 replays all of them, because it knows the decisions, not their reasons.

What format 2 is

The record has a new field s: one object for every seat; the position in the array is the seat number. The object holds the label of the AI that controlled the seat (b, for example ai2@2), any switches of the label (w) and above all the decisions of the seat (d). Seat 0 is the human, and its entries are exactly those of format 1. Opponents write only three kinds of entries:

  • a12-13: an attack from tile 12 to tile 13,
  • e: the end of the turn,
  • q13*2.14.17.18*3: the dice placement of an opponent under the setting "Placing reinforcements" set to "I divide myself" (two dice on tile 13, one each on 14 and 17, three on 18). It is one entry for the whole placement, not for each die; the q entries still make up 19 % of the bytes in a file of 200 random games (104 of them place the dice by hand).

The whole record of a small real game looks like this:

Anatomy of a format 2 record on a small real gameThe whole record of a game with three seats and seven rounds, cut into parts. Grey: the versions of the format, of the maps and of the rules, the mode, the settings, the game number and the roll salt, and the array of seats. Blue: seat 0, the human player, 39 entries. Orange: two AI seats with the label ai2@2, 27 and 5 entries. Green: the checkpoints after the rounds and the result with the board hash of the final board. Below it the key to the entries: a5-16 is an attack from tile 5 to tile 16, e the end of the turn, q the dice placement of an opponent.A real record: 663 bytes, 3 seats, 7 rounds{ "v": 2, "g": 1, "r": 2, "mode": "free","cfg": { "size": "small", "shape": "blob","opponents": 2, "loss": "half" },"seed": "GOLD6", "salt": "GS5","t": 1760000000005,versions (format, maps, rules) and the game modesettings that differ from the default, game number, roll salt"s": [one object per seat; array position = seat number{ "d": "a5-16 a6-13 e a17-5 a5-6 a7-10 …" },seat 0: human player, 39 entries (same as in format 1){ "b": "ai2@2", "d": "a2-4 a4-6 a6-5 e …" },seat 1: AI of level 2, behaviour version 2 (label), 27 entries{ "b": "ai2@2", "d": "a12-2 a9-4 a4-5 a5-14 e" }seat 2: AI, 5 entries: one turn (four attacks, end of turn)], "cp": "1ltepob,17bpbub,1ap9qs,…",checkpoints: board hash after each round (6 in the record)"res": { "r": "won", "n": 7, "h": "1xrd9uv","w": "conquest" } }result: won by conquest in round 7, final board hashDecision entriesa5-16attack from tile 5 to tile 16eend of the turnq13*2.14.17.18*3dice placement: 2 on tile 13, 1 on 14, 1 on 17, 3 on 18
Anatomy of a format 2 record: a real golden record of the game “Random shapes, round limit” (golden-records-ai2.json, game 0.119.0, AI.VERSION 2; seed GOLD6, three seats, a win by conquest in round 7, 663 bytes). The text of the lines is the text of the record (spaces and line breaks are added for the reader), “…” shortens lists. The q entry in the key is from another golden game with the dice placed by hand.

Why is the seat a position and not a mark before each entry? A fault is found where it arose (for example "seat 3 ran out of decisions in round 17"), the streams can be read by player (the analysis wants the decisions of the human separately), and nothing shifts when one entry is lost.

Three version numbers

NumberWhat it guardsWhat it does to a record
GEN_VERSION (1)map generatora different map from the seed: the record is outdated
RULES_VERSION (2)rules, engine, flow of the game, board hash and default values of the settingsa change of the game with the same decisions: the record is outdated
AI.VERSION (2)behaviour of the built-in AInothing: it is only the label @N in the record

RULES_VERSION keeps a narrower role: the AI is not in its list. One dangerous thing remained: a change of a default value of a setting is still a change of the game, because the record remembers only the difference from the default values. The decision of 4 November: the complete settings will not be written (about 0.5 kB per record); the golden file therefore writes the default values too and compares them.

When the decision of an opponent is written

The decision of an opponent is written at the moment it is applied to the game, not when it is made. An attack by an opponent has no "half-done" state the way an attack by a human has: a game saved in the middle of its animation has not applied it yet, and after "Continue" the opponent decides again, so writing at the decision would give two entries, or an entry for an attack that never happened. Therefore: a record of a saved game describes exactly the saved position, even in the middle of an opponent's turn. The morning draft of 4 November was wrong in one thing: the end of an opponent's turn is written when the refilling of dice begins, not when the AI answers "no more".

What was measured

The draft rested on a prototype with two AI functions replaced by readers of the recorded decisions: 216 games (15 golden ones, CT83EA and 200 random ones, 104 of them with dice placed by hand) were replayed to the same checkpoints and result, and 16 real and golden games to an identical stream of 5,753 events. The finished build has a sabotage test: AI.choose, AI.chooseOriginal and AI.placeReinforcements throw an error, and the replay ends the same way; with the live AI the same game cannot be replayed at all.

Today the sabotage test (bots.test.js, 11 tests) and the tests of the record and the player (39) also passed. What is not measured is the storage of a full profile in the browser and the time on a phone.

Size of the record

The price of format 2 is size: the record carries the decisions of everyone. In CT83EA they are 441 entries of seven AI opponents (336 attacks and 105 ends of turn) against 151 entries of the human. The file grew from 1,368 to 3,916 bytes, and the #R= link from 1,782 to 5,179 characters.

On 200 random games (the generator of the tool, seed tool:replay, today's AI) the file came out 2.9 times bigger at the median (1,197 B → 3,422 B), 3.0 times on average, the ninth decile 2,294 → 7,662 B, the largest 4,647 → 18,518 B. Three quarters of the entries (74 %) belong to the seats of the AI. The longest link has 24,648 characters, the limit of a link is 60,000 (MAX_LINK), and none of the 200 games exceeded it.

Size of a record: format 1 against format 2Two parts. Above, the real game CT83EA: the file of format 1 has 1,368 bytes, the file of format 2 has 3,916 bytes; the bar is split into the entries of the human player (825), the entries of the seven AI seats (2,393, format 2 only), the checkpoints (254) and the rest (289, in format 2: 444). Below, 200 random games: the median file is 1,197 bytes in format 1 and 3,422 in format 2, the ninth decile 2,294 and 7,662, the largest 4,647 and 18,518 bytes, that is about 2.9, 3.3 and 4 times larger.One real game: CT83EA8 players, 35 rounds; size of the file in bytesformat 11 368 Bformat 23 916 Bhuman: 825 Bseven AI seats: 2,393 B (format 2 only)checkpoints: 254 Bthe rest: 289 B, in format 2: 444 B200 random gamesthe AI of today, the settings of the tool; size in bytesmedian1 197 B3 422 B · ×2.990th percentile2 294 B7 662 B · ×3.3largest4 647 B18 518 B · ×4.0format 1format 2, and how many times larger
File size in format 1 and 2 on the same games. Above, CT83EA by parts (the human's entries 825 characters, the seven AI seats 2,393, 34 checkpoints 254, the rest 289 and 444). Below, 200 random games (seed tool:replay, AI version 2, game 0.119.0, 6 Nov 2026). Format 1 is the same game without the streams of the opponents; for CT83EA it gives exactly the 1,368 bytes of the original file.

Limits: the stream of one seat 6,000 entries, all streams 40,000, a game 400 rounds, and a file may be read up to 500,000 characters, so what the record can write, the game can also read. The list in the profile keeps 20 records of at most 60,000 characters each; a longer game stays in memory until the next game. The notice about this, the button "Save record as a file" (step S3) and short links (packing the JSON gives, according to the proposal, 3 to 4 times fewer characters: CT83EA 5,179 → 1,980 characters; step S4) were not in the game as of 6 Nov.

Replay, on the other hand, is faster, because the AI is not called: a median of 6.4 ms from the record and 9.3 ms with the call of the AI (20 games, Node in a warmed-up process, not a browser or a phone), a ratio of about 1.5.

A record from outside is a claim, not proof

A file or a link from another person is a claim about a game. Format 1 had one weak guarantee: the opponents were the built-in AI, because the game calculated them. In format 2 the opponents are what the file says: an opponent that never attacks, or a player who conquers everything in the first round, is allowed in the record. That is why safety rests on three things.

  1. Every decision is checked by the rules, and the game does it, not a reader of the entry: the attacking tile must belong to the seat on move, the attack must be allowed, and in a dice placement the tiles must be one's own, within the limit of dice, and the sum must not exceed the number. Otherwise the replay stops with a reason.
  2. Everything is limited: the number of entries, bytes, rounds and seats, and the replay has a guard time. A malicious record costs less than before: it does not call the AI.
  3. Nothing that counts is paid out of it. Experience, coins, achievements and leaderboards are written at the end of a game the player played in this game (showEnd, Profile.recordGame). A record from someone else is only shown, analysed, drawn or played as music, and is not added to the list of one's own games.
The way of a record from someone else through the gameDiagram from top to bottom. A record from someone else (a file, a link or pasted text) goes through four steps: cleaning, checking the versions, verifying every decision by the rules, and checking the checkpoints and the result. The result is one of three: OK, outdated, or damaged with a reason. A record may then be shown, analysed, drawn or played as music, but it never pays out experience, coins, achievements or leaderboards. Below, the numbers of the check: 13 damaged copies of CT83EA and 13 detected, 40 games and 121 of 122 damaged copies detected.A record from someone elsea file, a #R= link or pasted text1Cleaning the record (Record.clean)format 2 · a stream per player · shape of entries · limits→ outdated (format)2The replay builds the game from the seedformat number, map generator and rules match→ outdated (format · maps · rules)3The rules check every decisionseat owns the tile · attack allowed · dice within limit→ damaged (attack · place · short · left · order · seats)4A checkpoint each round, then the resultthe board hash must match the record→ damaged (checkpoint · result)OKoutdateddamaged: reasonAllowed· show in the replay· analyse it· draw it as a picture· play it as musicNever paid out· experience· coins· achievements· leaderboardsCheck of 6 Nov 202613 damaged copies of CT83EA: 13 detected40 games: 121 of 122 damaged copies detectedanother rules version: 8 of 8 marked outdated
The route of a record from another person through the game. The reasons (format, maps, rules, attack, place, short, left, order, seats, checkpoint, result) are the strings the replay of the game returns (Replay.run); what may and may not be done comes from RECORD-V2 §7 and the code of the game. The numbers below are from runs of the game's tool of 6 Nov 2026.

The label of the AI (ai2@2) is also only a claim, and the game decides nothing by it. If a build exists with the version of the AI from the label, it can be checked: a replay with the option verifyBots asks the live AI at every decision and compares. This is how the drift test of the game checks it; as a feature for the player, it does not exist yet.

What the replay says about a damaged record, CT83EA shows: the tool of the game made 13 damaged copies of it, and each one was detected.

DamageReason (round where it stopped)
an omitted attack of the humanattack (round 29)
another seed or another salt of the diceattack (already in round 1)
an attack of an opponent from a tile of another seatattack (round 9)
a human's turn ended earlycheckpoint (round 30)
a changed checkpointcheckpoint (round 26)
an entry of a seat removed, an end of turn added, an entry moved to another seatcheckpoint (round 10), three copies
a changed resultresult
a record shortenedshort (the decisions ran out)
an extra entry in a seat's streamleft (left unused)
a q where an attack is askedorder

A record of format 1 the replay does not mark as damaged, but as outdated (outdated, reason format); likewise a record from a newer game (v 3), from another version of the rules (rules) and from another map generator (maps).

The decision: no migration

The draft originally counted on converting old records (a worker, a frozen copy of the AI, a passage through the saved data). The game is not released and nobody has a format 1 record, so format 1 ends before the release and nothing is migrated. The game does not load records saved in the browser with a new build, and a saved game with such a record continues without the record.

The only exception is CT83EA, a record of a hard start that ended in a win for the human and that is the basis of a proposed challenge on the web. It was converted once, with the AI it was made with (game 0.108.0): it was replayed with the live AI, the decisions of each opponent were written down, and the result was verified twice (against the old record and by a second replay from the written streams: the same 768 events). It has 3,916 bytes, the game replays it in 35 rounds to a win (board hash d4vgjv), and it is the golden file of the tests.

**What this means for developing the AI: a change of the AI needs a new AI.VERSION and nothing else.** In practice, four steps from the comment of the tool: raise AI.VERSION, add a line of the source pin (ai-versions.json: a hash of ai.js, bots.js, personas.js, data/personas.js for each version), let the tool write two new golden files under the name of the version, and leave the old ones where they are. The duty that golden records once enforced by ceasing to play is now guarded by two safeguards:

  • the source pin: a change of the AI's sources without a new version and its line fails and says what to do;
  • the drift test: the golden games of the current version are replayed with the live AI and every decision is compared with the written one; the golden files of older versions are only replayed.

Step R5 of 4 November went exactly like this: a line of the pin and two golden files of version 2 were added, while the files of version 1, the record of CT83EA, and the pictures, music and the player stayed as they were. In the measurements of the AI, 25 of 196 game fingerprints changed, and all of them were games with a level 3 AI.

What the record of format 2 opens

Little is done and there are more plans, so only the state according to the documents, without promises:

  • Numbered AI: the label ai2@2 is at every AI seat, and the development of the AI does not touch the records.
  • AI written by a player: it is only a proposal. The shape of the label (u/<name>/<title>#<code hash>) is prepared in RECORD-V2, but the AI itself written by a player is marked in ARENA §5 as a proposal, and §9 has open questions.
  • Challenges on the web: according to CHALLENGE-PLAN, CT83EA is the start of the first challenge, and format 2 makes it possible to verify the result without the AI. The game can open a challenge from a #X= link (DESIGN §151) and the web has a verifier, but whether and when a challenge is published is decided by the author (CHALLENGE-PLAN §5, point 1).

What to take from it

  • Write decisions, not their reasons. Format 1 relied on the reason (the AI) always being the same, and that is an assumption the project itself breaks.
  • A version number is a blunt tool. When the AI changes, all records would become outdated, although only two of the seventeen changed.
  • The cost can be measured and is acceptable: about three times bigger a file at the median, still a few kilobytes, and the replay is not slower.
  • A record from outside is not proof. What counts cannot be filled in from a foreign file.
  • The safeguard must be mechanical. The duty "raise the number" can be forgotten; a source hash and a drift test cannot.

Sources and notes

  • The game and the measurements: game 0.119.0, data from 6 November 2026. The game was only read, by the tool of the game (replay.js --games 40 --check --verify-bots) and by a one-off script that is not part of the game.
  • Design and build: docs/RECORD-V2.md of the game (4 November 2026), docs/DESIGN.md §28 (format 1), §43.2 (the change of 22 October) and §149 and §151 (the build of format 2).
  • History of the AI: git log over ai.js, personas.js, data/personas.js and bots.js from 19 October to 4 November 2026. The pictures are drawn from these data and from one golden record.
  • Plans: docs/CHALLENGE-PLAN.md, docs/BOT-LEVEL3.md and docs/ARENA.md §4 to §6. These are the state of the plans, not a promise.