Audamir

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.

· 21 min read

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 OctToday in the gameStatus
A keepsake for printing: a vector that can be savedSVG in millimetres; the window offers only A4 portrait and landscape, printing is one page; other formats are downloaded as SVGdone, formats narrowed
Rising rings, a tree, nested squares, a square for each playerRings, Frames, Panels, Overlapping squares (each in two directions), Forest, Stream, Constellation and Map imprintdone, twelve variants
Drawn during the game too, off by defaultThe setting Live picture, off by default, with a guarddone
One button that gives the picture and the musicTwo buttons, Picture and Music; the Music window draws a picture that grows with the musicdid not happen
Remove or hide the weakest variantsThe 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 twelvekept
One large tree, squares shifted towards the leaderNot builtdid 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.

How the record of a game becomes a pictureA scheme of six steps from the record to the SVG file, with the numbers of one real game (seed CLS4, 4 players, 12 rounds, 140 attacks). The record has 1 267 bytes. Replaying it gives 212 events. The collector is the only place that reads the game, and from the events it makes 182 facts (140 attacks, 29 dice placements, 11 closed rounds, the start and the end), 31 225 bytes in all. The scene is a list of primitives that are only added: 180 for Rings and 290 for Map imprint. The camera fits the scene to the paper, and the writer writes the SVG: 47 620 bytes for Rings and 27 523 for Map imprint.Recorddecisions1 267 bytes: what each player did.Nothing else is saved.ReplayReplay.run212 events: the game replays fromthe decisions; nothing changes.Collectorpicture-collectThe only reader of the game: 182 facts140 attacks, 29 dice placed, 11 rounds,the start and the end; 31 225 B, of whichboard map 9 339 B (62 ms with replay).ScenePicture.buildA list of primitives, only added to:180 for Rings, 290 for the map.Ids from identity: r1.a0, m42, c5.3.(5.3 and 4.7 ms)CameraScale and position on the paper,at the end; the layout is not redone.WriterPicture.svgSVG, in mm: 47 620 B (Rings),27 523 B (map) with the A4 text;words, colour key or nothing;four inks (3.2 ms).
Partia principalities4 from the gallery of the game's pictures: seed CLS4, Principalities, four players, 12 rounds, 140 attacks, a win; Picture.build and Picture.svg, game 0.124.0, 6 Nov 2026. The times are the median of 15 runs in one process of Node.
  • 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.a0 is the arc of player 0 in the ring of round 1, m42 a mark of an attack with event number 42, and c5.3 a 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.sin but 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 or NaN.
  • The source lint is a test that reads the picture*.js files and forbids the power operator **, Date, Intl, timers, toFixed and toLocale*; from Math it allows only floor, ceil, round, min, max, abs, sqrt, imul, trunc, sign and PI. 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.json holds 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 that Picture.VERSION must 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 same game as Rings and as Map imprintOne game (game CLS4 (seed CLS4): Principalities, four players, 12 rounds, 140 attacks, a win by You) drawn in two ways. On the left Rings, from the centre outward: each round is one ring, divided into arcs by the share of tiles of each player. You are red; Blue, Green and Yellow have their own colours; eliminated players leave a gap in the rings. On the right Map imprint: the real map of the game, every tile cut into vertical stripes by time, from left to right, in the colour of its holder; the thick lines are the fronts across which many attacks passed. The pictures have no words; on the sheet a square of 210 mm.Rings, from centre outwardMap imprintYouBlueGreenYellowYouBlueGreenYellowpicture-version=5 record=wrkvo0 projection=rings-out ink=color | picture-version=5 record=wrkvo0 projection=map-v-imprint ink=color
Partia principalities4 from the gallery of the game's pictures: seed CLS4, Principalities, four players, 12 rounds, 140 attacks, a win for the player You; Picture.render with the variants rings-out and map-imprint on a square sheet without words, game 0.124.0 (Picture.VERSION 5), 6 Nov 2026. The game's tools drew it; the sheets are joined into one file.

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 windowWhat it showsWeaknessLive
Rings, outwards / inwards from the edgea round is a ring divided by the share of tiles; an elimination is a crackvery dense with a hundred roundsoutwards yes, inwards no
Frames, outwards / inwards from the edgethe same in squares, like a tunnelloudoutwards yes, inwards no
Panels, inwards / outwardsthe player has their own square, good for comparisonweakest as a picture: only empty frames with a crossno
Overlapping squares, outwards / inwardsa rosette of squaresmuddy in the middle, unreadable in black and white when lostboth yes
Foresta tree for each player, a twig with a leaf for each won attacksmall with 14 playersyes
Streamshares of tiles over time, a column per roundmore a graph than a pictureyes
Constellationa star for each player, links for the tiles takensparse with 2 to 4 playersyes
Map imprintthe real board, tiles in stripes of timeweighs time, not territoryyes

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.

Four more pictures of the same game: Frames, Forest, Constellation and StreamThe same game (game CLS4 (seed CLS4): Principalities, four players, 12 rounds, 140 attacks, a win by You) in four more variants, with no words. Frames, from the centre outward: a round is a square frame whose perimeter is divided by the share of tiles. Forest: a tree for each player; the trunk grows one segment per round; a won attack is a twig with a leaf. Constellation: a star for each player, a ray for each round and a link between players for the tiles taken. Stream: the shares of tiles over time, one column per round.Frames, from centre outwardForestConstellationStreampicture-version=5 record=wrkvo0 projection=frames-out ink=color | picture-version=5 record=wrkvo0 projection=tree-forest ink=color | picture-version=5 record=wrkvo0 projection=constellation-stars ink=color | picture-version=5 record=wrkvo0 projection=stream-stacked ink=color
Partia principalities4 from the gallery of the game's pictures (seed CLS4, 12 rounds, 140 attacks); Picture.render with the variants frames-out, tree-forest, constellation-stars and stream-stacked on a square sheet without words, game 0.124.0, 6 Nov 2026.

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.

Four stripes from ten attacks: one tile of the map imprintTile 9 of 32 in the game CLS4 (4 players, 12 rounds). Before the first attack Yellow held it, and then it was taken by Blue, Green, Yellow, You, Blue, You, Blue, You, Blue, You in turn; in 3 attacks of the first round it went from hand to hand, and the round ended again with Yellow. From the attacks it is counted who held the tile at the start of each round, and from that come 4 stripes: Yellow, You, Blue, You. The first stripe is the holder before the first attack, and the last is the final holder.round123456789101112endattacks,that took itholder atstart of roundstripesin the pictureholdersin turnYouBlueGreenYellow
Tile 9 of 32 in the game CLS4 (Principalities, 12 rounds): attacks from the facts of the game, the holder from Picture.ownership and the stripes from the primitives s.9.0 to s.9.3 of the scene of the map imprint; game 0.124.0, 6 Nov 2026.

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.

RunGamesLines of the boardTilesAttacks
22 Oct, first measurement28910,58921,231118,667
22 Oct, after the merge2699,30319,687111,165
6 Nov, today (22 s)2699,39919,704113,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.

WhatValueSource
Update of a live picture that only adds primitives0.6 to 0.9 ms; with a processor 4 times slower 1.6 to 2.8 ms, the worst 12 msdocumentation, 21 Oct, Chromium
Live map imprint after a round, a three-player game6.9 ms, the worst 11.7 msdocumentation, 22 Oct, Chromium
The same today, the live window of the game5.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 roundmedian 0.1 ms, the worst 2.3 ms; map imprint with redrawing 1.1 and 2.8 msChromium 152 in the Browser pane, without slowing the processor
Today, 14 players and 57 rounds, events of a roundmedian 0.1 to 0.2 ms, the worst 2.1 ms; map imprint with redrawing 2.9 ms, the worst 11.3 msthe 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.

The tangle of Rings grows with the rounds, and the limit with itA scatter plot of the sixty games of the check of the tool of the game (seed PICCHK, Rings from the centre outward on A4): horizontally the number of rounds of a game (3 to 100), vertically the most lines through one cell of the paper, that is the tangle. The longer the game, the more rings and the greater the tangle. A fixed limit of 8 from the first draft would fail 11 of the 60 games; today's limit, 8 + 0.22 per round, lets none exceed it; the nearest game has 11 rounds: 7 against the limit 10.4.01020300255075100rounds in the gamefirst draft: 8 for every gametoday's limita game that would pass with the fixed limit 8a game that would fail with it (11 of 60)8 + 0.22 per roundmost lines through one cell of paper
60 games of the check of the game's tool (seed PICCHK), Rings from the centre outwards on A4; tangle is the largest number of lines through one cell of the paper (Picture.metrics); gate 8 + 0.22 per round from data/picture.js; game 0.124.0, 6 Nov 2026.

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.

The window Game picture after a finished game: a preview of the picture on a sheet of A4 and the choices of the variant, the colours, the paper, the words and the title; it can be saved as SVG or PNG, or printed.
The picture is drawn from the record of the game; the variant and the colours can be changed before it is saved or printed.

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.
A4 sheet with the Rings of one game, as printedAn A4 sheet of paper in portrait, with the Rings of one game from the centre outward: game CLS4 (seed CLS4): Principalities, four players, 12 rounds, 140 attacks, a win by You. Above, the picture with the turning points from the analysis (2 turning points: round 1 and round 2), each marked by a line and a label; the thin ring round it is the chance of You winning across the rounds. Below, a block with the name Audamir, the result Won in round 12, the description Principalities - 4 players - 32 tiles, the date of the sheet and the legend of the players: You with the star of the winner, Blue out in round 12, Green out in round 5, Yellow out in round 4.Turning point: round 2Turning point: round 1AudamirWon in round 12Principalities - 4 players - 32 tiles2026-11-06Record wrkvo0 - Picture v5 - rings-outYou100%Blueout in round 12Greenout in round 5Yellowout in round 4picture-version=5 record=wrkvo0 projection=rings-out ink=color
A4 sheet, as Picture.render draws it with the game's English texts: the game CLS4 (Principalities, 12 rounds, 140 attacks), Rings from the centre outwards with the turning points from the analysis, game 0.124.0 (Picture.VERSION 5). The date on the sheet is 6 Nov 2026, the day the picture was made.

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.VERSION 5. The decisions are in the game's docs/DESIGN.md, §37, and in docs/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.render of the game; the others by tools/charts.js.
  • Does not match: the documentation says Picture.VERSION 2 and seven live variants; the code has version 5 and today eight are live.