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.
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.
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.jsordata/personas.jsin a way that could change even one move, the rule from DESIGN §28 applies: raiseRULES_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.
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 1 | format 2 | format 1 |
|---|---|---|
| 12 golden games | 12 of 12 | 10 of 12 |
| 3 golden games on drawn maps | 3 of 3 | 3 of 3 |
| CT83EA, 8 players | yes | yes |
| FEPJB5, a real game | yes | yes |
| Total | 17 of 17 | 15 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; theqentries 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:
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
| Number | What it guards | What it does to a record |
|---|---|---|
GEN_VERSION (1) | map generator | a 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 settings | a change of the game with the same decisions: the record is outdated |
AI.VERSION (2) | behaviour of the built-in AI | nothing: 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.
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.
- 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.
- 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.
- 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.
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.
| Damage | Reason (round where it stopped) |
|---|---|
| an omitted attack of the human | attack (round 29) |
| another seed or another salt of the dice | attack (already in round 1) |
| an attack of an opponent from a tile of another seat | attack (round 9) |
| a human's turn ended early | checkpoint (round 30) |
| a changed checkpoint | checkpoint (round 26) |
| an entry of a seat removed, an end of turn added, an entry moved to another seat | checkpoint (round 10), three copies |
| a changed result | result |
| a record shortened | short (the decisions ran out) |
| an extra entry in a seat's stream | left (left unused) |
a q where an attack is asked | order |
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@2is 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.mdof 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 logoverai.js,personas.js,data/personas.jsandbots.jsfrom 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.mdanddocs/ARENA.md§4 to §6. These are the state of the plans, not a promise.