part 52
A picture from one game: from an idea to a finished feature
From a finished game the game can draw a picture for printing: twelve variants, a live picture and a map imprint. How a record becomes a picture, why it is the same in every browser, what was found on the way, and what did not repeat today.
A game's music has its own article, but a picture of it did not have one yet. The article on the record, the analysis and the music does not talk about it, and the article Then and now has one section with two snapshots of the window. Yet seventeen days have passed since 20 October, and the game (version 0.124.0) has the window Game picture, twelve variants, a live picture during the game and a map imprint.
The article explains how a game becomes a picture, why it is the same in every browser, and what was found along the way. The pictures were made by the game's tools from a real game, not by hand. It is a game from the music (Principalities, four players, seed CLS4, twelve rounds, 140 attacks), so one record is told twice here. The AI played the game in the human seat, and the player You (red) won it.
From idea to game
The idea came on 20 October: when a game is turned into music, a picture can be made from it too, just a "projection of the record", a vector one, for printing and saving. Later came an addition that it can be drawn during the game as well, but switched off and only for a strong computer. What remained and what did not:
| Idea from 20 Oct | Today in the game | Status |
|---|---|---|
| A keepsake for printing: a vector that can be saved | SVG in millimetres; the window offers only A4 portrait and landscape, printing is one page; other formats are downloaded as SVG | done, formats narrowed |
| Rising rings, a tree, nested squares, a square for each player | Rings, Frames, Panels, Overlapping squares (each in two directions), Forest, Stream, Constellation and Map imprint | done, twelve variants |
| Drawn during the game too, off by default | The setting Live picture, off by default, with a guard | done |
| One button that gives the picture and the music | Two buttons, Picture and Music; the Music window draws a picture that grows with the music | did not happen |
| Remove or hide the weakest variants | The independent review proposed to remove the Panels (the weakest) and to hide the Overlapping squares (muddy), and to hide the recommendation of 22 Oct; the decision of 20 and 22 Oct was to keep them, and the window offers all twelve | kept |
| One large tree, squares shifted towards the leader | Not built | did not happen |
From record to picture
The picture is drawn from the record: by the same replay that the record of format 2 uses for the analysis and the music. Nothing is saved: the picture is made on request, and the record, even from a link, is enough for it to be drawn. The path has six steps.
- The collector is the only thing that reads the game. It has 142 lines (
picture-collect.js), the replay of the record sends it events and it turns them into facts: pure numbers about the start, the attacks, the placement of dice, closed rounds and the end. Everything below it works only with numbers and knows nothing about dice or rules. The article on architecture calls this "facts of a finished game" and adds that the picture, the music and the analysis read the stream of events of the replay. The collector adds the board map only on request, when a variant needs it. - The scene only grows. It is a list of primitives (a line, a polygon, an arc, a text) with a stable name taken from identity:
r1.a0is the arc of player 0 in the ring of round 1,m42a mark of an attack with event number 42, andc5.3a crack of player 3 in the ring of round 5 (player 3 dropped out in round 4; the crack runs through every further ring). An added event may add primitives, none is changed or moved, and a round is drawn when it closes. - The camera is separate and comes last: the scale and the offset that fit the picture onto paper. The layout is not computed again after it.
- The writer writes an SVG in millimetres, in a subset that the guard (
Picture.lint) checks: no filter,<pattern>or script. Three ways of writing words, four inks (see below).
One honest limitation: variants that go from the edge inwards, and the panels, need the length of the game (the first round is the outermost ring), so their scene stays empty until the game ends.
The same picture in every browser
The same record, variant, choices and Picture.VERSION give the same SVG, byte for byte. For printing this is convenient, for the live picture it is a condition (below), and for testing an advantage: it is enough to compare fingerprints. How it was achieved:
- The layout uses only addition, subtraction, multiplication, division and square root. Angles are not given by
Math.sinbut by a table of 1,025 numbers written into the file, between which it interpolates. (Why: the basic operations and the square root are exactly prescribed by IEEE 754, while the sine may have a different last digit in another browser. This is an explanation of the rule, not a measurement.) - Randomness is a fingerprint of identity. The waviness of the edge, the side of a twig and the place of a mark are an integer fingerprint (hash) of the identity of the element and the seed of the game, not a stream of numbers that is consumed in the order of arrival: so an added event cannot change an earlier element.
- Every number in the file is rounded by one function to 0.01 mm, without
-0, exponent orNaN. - The source lint is a test that reads the
picture*.jsfiles and forbids the power operator**,Date,Intl, timers,toFixedandtoLocale*; fromMathit allows onlyfloor,ceil,round,min,max,abs,sqrt,imul,trunc,signandPI. The first version could be bypassed (Math['sin'],const M = Math); an independent review found it, and the lint today goes through the code character by character, the list of allowed functions is the only way, and the test tries 21 bad writings including bypasses. - Golden fingerprints:
tests/…/picture-golden.jsonholds 174 fingerprints: twelve golden records in all twelve variants, plus other papers and inks, posters and pictures with an invented story layer. When the output changes, the test reports thatPicture.VERSIONmust be raised and the fingerprints written again.
The version is 5 today. Version 2 came when an independent review of the window found that a draw on a poster counted as a win; versions 3 to 5 are changes of the game's name on the sheet.
What was checked today. The output was made from the record CLS4 in all twelve variants and two inks (colour and grey), once in Node and once in the Chromium 152 browser from the Browser pane, with the same files of the game (rng.js, data/picture.js, core/picture.js). All 24 SVG files are byte-for-byte identical (SHA-256 and length). The golden fingerprints and the other tests of the picture passed today: 180 tests in the file with fingerprints and the lint, and 70 in the files of the map imprint, the live picture and the window. The checks in the browser that the game describes use Chromium.
What it cost and what it gave. It cost: a table, a guard and the rule that a new version is written whenever the output changes. It gave: the live picture can be compared with the picture of the record byte for byte. Such a test found an error that would otherwise have slipped through: the first feed of live events counted only its own events, so the marks were called m4, where the final picture has m5. It was a different picture.
Twelve pictures from one game
The same game, two ways: the rings say who grew when, the map says where.
The names are as the player sees them in the window. The notes in the table are the verdicts from the game's documentation (20 and 22 Oct), not today's measurement:
| Name in the window | What it shows | Weakness | Live |
|---|---|---|---|
| Rings, outwards / inwards from the edge | a round is a ring divided by the share of tiles; an elimination is a crack | very dense with a hundred rounds | outwards yes, inwards no |
| Frames, outwards / inwards from the edge | the same in squares, like a tunnel | loud | outwards yes, inwards no |
| Panels, inwards / outwards | the player has their own square, good for comparison | weakest as a picture: only empty frames with a cross | no |
| Overlapping squares, outwards / inwards | a rosette of squares | muddy in the middle, unreadable in black and white when lost | both yes |
| Forest | a tree for each player, a twig with a leaf for each won attack | small with 14 players | yes |
| Stream | shares of tiles over time, a column per round | more a graph than a picture | yes |
| Constellation | a star for each player, links for the tiles taken | sparse with 2 to 4 players | yes |
| Map imprint | the real board, tiles in stripes of time | weighs time, not territory | yes |
For the game CLS4 the scene has 32 (overlapping squares) to 290 primitives (map imprint), and the SVG is 7.8 to 47.6 kB. Eight of the twelve variants are live.
While the look was being sought, several things were tried and dropped: the first rings alternated two shades like a barber's pole, the first panels said nothing (the thickness of a band does not carry a share), and for the map imprint stripes won over rings in every tile. Rings are prettier (a target with the last holder in the middle), but they give less than half of the time resolution, and in black-and-white print they cannot be hatched.
Map imprint
The imprint draws the real board: each tile is cut into vertical stripes by time (the start of the game on the left, the end on the right) in the colour of whoever held it, and the lines between tiles are thicker according to the number of attacks that crossed them, so the fronts are visible.
The catch: the facts do not carry the owner of a tile, only the counts (how many tiles each has). The owners are therefore counted from the attacks: it starts with the owner before the first attack, and each won attack gives the tile to the attacker. This is how one tile of this game looks.
In round 1 the tile passed from hand to hand three times (Yellow, Blue, Green and again Yellow), and at the end of the round it was held by the original Yellow again, so the first round has no stripe of its own. In a long game the rounds are merged into at most 24 stripes per tile, and a stripe goes to whoever held the tile longest in it, except the first and the last: the first is always the original owner, and the last the final one, because the right edge of the picture is the result board and that is the only thing a reader checks. The documentation records this as a deliberate deviation from the brief.
Proof against the real board. picture.js --map-proof plays games of the AI with random settings (every shape, map type, lakes, neutral tiles, fortresses and cities, Principalities, free play and the daily challenge), after every round compares the owner of every tile in the live game with the count from the attacks, and checks that every attack lies on the border of two tiles.
| Run | Games | Lines of the board | Tiles | Attacks |
|---|---|---|---|---|
| 22 Oct, first measurement | 289 | 10,589 | 21,231 | 118,667 |
| 22 Oct, after the merge | 269 | 9,303 | 19,687 | 111,165 |
| 6 Nov, today (22 s) | 269 | 9,399 | 19,704 | 113,329 |
The difference was in no line and no run. The number of games differs, because only part of the 700 tries is used (the others leave no record that can be replayed), and after changes of the game the random games are different; according to the documentation that was so after the merge of 22 October too. Today's run covered seven shapes of the board, five types of map (there were four before), 195 games with lakes, 200 with neutral tiles and 241 with fortresses or cities.
Live picture
The picture can also be drawn during the game: in the setting Live picture (off by default; On is recommended "for a strong computer") a small window opens next to the board, in which the picture grows after each round. It can also be switched on in the middle of a game: the picture is made up from the record up to that point. It is not drawn in a game with fog of war (the collector reads the whole map, so the picture would show what the player must not see), in the puzzle, the lesson, the minigame or a mission of the campaign. Eight variants are live (the table above); those that need the length of the game are drawn only after it.
The protection is part of the game and its numbers are data: the picture switches itself off (and so does the setting), if it slows the game down. An update over 16 ms three times in a row stops it, one over 50 ms, more than 8,000 primitives or an error while drawing, and the player gets one notice. The map imprint is drawn again after every round (the stripes depend on the length of the game, which the live game does not know), and therefore has its own limits: 45 ms three times in a row and 140 ms once.
| What | Value | Source |
|---|---|---|
| Update of a live picture that only adds primitives | 0.6 to 0.9 ms; with a processor 4 times slower 1.6 to 2.8 ms, the worst 12 ms | documentation, 21 Oct, Chromium |
| Live map imprint after a round, a three-player game | 6.9 ms, the worst 11.7 ms | documentation, 22 Oct, Chromium |
| The same today, the live window of the game | 5.1 ms, the worst 5.5 ms | --map-browser-check, 6 Nov, Chromium without a window |
| Revealing 13 rounds of the map imprint in the Music window (300 triangles, 14 players) | 29 ms, the worst 35 ms; with a processor 4 times slower 99 and 107 ms (documentation). Today 18 and 20 ms, with a processor 4 times slower 63 and 72 ms | --map-browser-check |
| Today, game CLS4 (4 players, 12 rounds), events of a round | median 0.1 ms, the worst 2.3 ms; map imprint with redrawing 1.1 and 2.8 ms | Chromium 152 in the Browser pane, without slowing the processor |
| Today, 14 players and 57 rounds, events of a round | median 0.1 to 0.2 ms, the worst 2.1 ms; map imprint with redrawing 2.9 ms, the worst 11.3 ms | the same |
The last two rows are the computation of the picture without drawing into the page and without slowing the processor, so they can be compared only roughly with the older ones. Even the worst value of the map imprint (11 ms) is far below its limit of 140 ms, but that includes drawing; the browser check contains it and came out under the limits.
Gates and calibration
A picture is not judged by a person every time, so it is measured by a check: picture.js --check plays 60 AI games (2 to 14 players, every shape, teams, fog, 3 to 100 rounds) and seven edge cases, draws them in all twelve variants on three papers and four inks, and for every picture checks the gates: how much of the paper the ink covers (25 to 85 %), how many lines cross one cell (tangle), the thinnest band (at least 0.4 mm), balance, file size (500 kB) and validity of the SVG.
The first run with the limits from the brief had 878 violations in 1,809 pictures (according to the game's documentation). Each gate was then changed only after looking at the worst pictures, and four things were fixed in the design, not in the threshold: the marks were spread along the arc, the edges of a long game are thinned by ring, the cracks are joined, and the overlapping squares are thinned. Tangle grows with the rounds naturally, so the gate grows with them.
A fixed gate of 8 from the first draft would fail 11 of the 60 games; the rising gate lets none through, and the nearest is the game with 11 rounds: 7 against a gate of 10.4. It is therefore loose, and the documentation admits it: these are calibrated gates, not sharp guards. The lesson written there: a bad picture is not answered by changing the threshold without looking at the worst ones.
Today the check is not green. The run of 6 Nov (84 s, 9,648 pictures and 19,296 with a key, without words or without text) reports six violations of one gate, the file size: a game with 14 players and 76 rounds on A3 paper in grey and line inks has 502 to 515 kB against the limit of 500 kB. The game's documentation says every picture passes. A3 is not offered in the window, so a player would not meet it, but a check that should be green is not green.
Window and printing
The window Game picture opens with the Picture button on the end-of-game card, in the list of recent games and in the record player (also of a record from a link or a file). A record of the old format cannot be drawn, and the window says so.

Options: Picture (twelve variants), Colours (The colours of the game, Colour-blind palette, Grey with patterns for a black-and-white printer, Lines only), Paper (A4 portrait, A4 landscape), Words, title and description, the players' names, the seed with the New roll button, and the option Mark the turning points of the game from the analysis of a game. The picture beside is exactly the SVG that is saved (a test compares the bytes).
- Words have three ways: words (name, result, players' names), a colour key (no word, only colour squares, a star at the winner and numbers) and none (only the picture). The winner is always visible in the picture too.
- Grey with patterns: after conversion to grey, a colour sheet with eight players would blur into similar greys (blue, green, orange and turquoise came out almost the same), while the Grey with patterns version tells them apart by grey, hatching and dashes (by eye, 20 Oct).
- Save and Print: today this was tried in a real browser (
--map-browser-check, 35 s, Chromium without a window, map imprint): Save SVG gives exactly the same sheet (74,766 B), Save PNG a picture of 2,480 × 3,508 dots (A4 at 300 dpi) and Print one page 594.96 × 841.92 points (A4 is 595 × 842). The window fits at 375 px and at 1,100 px in both the light and dark theme, and the sheet is always white paper. - Poster of the last games: from the last games (the profile keeps 20 records) the ones that fit one sheet are chosen; the nine newest are ticked, a full circle under the picture is a win and an empty ring a loss. A draw does not count as a win.
The picture that grows with music is also in the Music window after the game (a piece of music from one game).
Honest limitations
- The picture is not an analysis. It shows the shares of tiles by round and the choice of attacks, not why the game was decided. That is what the analysis does; the picture gets only an optional layer of turning points.
- The map imprint weighs time, not territory. In a long game where fighting goes on everywhere, the winner's colour need not be the one that dominates the picture. The winner is shown by the edge around the board and by an asterisk in the legend.
- The gates measure shape, not beauty. Whether a picture is pretty was decided by the person who looked at it; the check only says that the paper is not tangled or empty.
- A game with fog of war has its picture only after the game; the live picture is not drawn in it.
- Not repeated today: the check of all twelve variants on all papers and inks in the browser (
--browser-check, printing to PDF, seven papers); from today's check only the map imprint counts. - Still open (game documentation): a mark on the first and the last tile of a player, marking the tiles of player You, the map of teams, a shared window for the picture and the music, and the decision about panels and overlapping squares that were kept "for now".
What to take from it
- A pure function of the record can be tested byte for byte, and much follows from that: the picture is not stored, the live one is the picture of the record, a change of output is visible.
- Fingerprints pin bytes, not meaning. Eight changes of meaning (the edge of the winner, a crown, "eliminated in round N") survived when the golden test was left out; 25 tests of meaning were added.
- Do not answer a bad picture by changing the threshold. Of the 878 violations, first the design was fixed, and only then the gate.
- Documentation and code drift apart. Today the check has six violations, the picture version is 5 and not 2, and the samples in
docs/picture/are from old versions.
Sources and notes
- Status and history: game 0.124.0 (6 Nov 2026),
Picture.VERSION5. The decisions are in the game'sdocs/DESIGN.md, §37, and indocs/ROADMAP.md, chapter 19. - Data and measurements: the game CLS4 from the gallery of the game's pictures (
tools/charts-data/obrazok.json). The check of the gates, the proof of the map imprint and the check in the browser are today's runs of the game's tools; times are the median of 15 runs. - Pictures made by the game's tools: two variants, the sheet and the families are drawn by
Picture.renderof the game; the others bytools/charts.js. - Does not match: the documentation says
Picture.VERSION2 and seven live variants; the code has version 5 and today eight are live.