part 46
Previews in the settings: what a preview is and how it was built
Five of the six steps of the preview plan in the settings were built: what a preview is, how it is shown, and what changed compared with the proposal. The sixth step, music and the live picture, is in the next article.
A preview is a picture or a demo next to a setting. It shows what the setting does before the player switches it on. The game has them for the settings of Kastgard from 1 November 2026, and later steps added more parts to them. This article says what a preview is, how it is shown, and how steps P1 to P6 were built. Music and the live picture are in the next article, because they had not been built at that point.
The previous article, number 39, described the plan for previews and ended with only the first step built in the game. This text continues it: what was built next, what changed compared with the proposal and the mockup, and what the real browser showed. Five of the six planned steps (P1 to P6) are in the game. Step P5, music and the live picture, was waiting; it was built on 3 November 2026, and the next article is about it.
The state written about: the development version of the game. Steps P3, P4 and P6 were merged on 2 November 2026 (version 0.96.1). The numbers are from the game's documents (docs/SETTINGS-PREVIEW.md, docs/DESIGN.md §128, §130, §137 to §139) and from git log.
What a preview is
In the settings window there is one panel next to the rows. It follows the row the player has selected: it shows the scene of that setting and, under it, the description of the value the player currently has set. The same panel is on the realm cards and in the Your hero window.

The scene is not a picture drawn by hand. It is a live picture of the game: the board with dice, the pace of the turns, the remarks. The game's renderer draws it, so the preview looks the same as the game. The panel has no copy of the rules of its own; it only calls the same functions.
How a preview is shown
The registry decides. Settings.PREVIEWS has one decision for each setting: a scene, an explicit "no picture" with a reason, or a step that does not yet have a scene. A test says that every setting is decided, not only that it is in the table.
Two rules from the code are worth mentioning. The scene is made only at the first touch of the row and then stays, so the panel does not draw everything at once. A hidden scene is not destroyed. The caption under the picture writes no new text: Settings.captionOf picks the description of the chosen value that the game already had; otherwise the description written for that value; otherwise the description of the whole setting; otherwise the hint.
Five steps out of six
The plan had six steps (P1 to P6), and this article describes five of them. The sixth step, music and the live picture, was added on 3 November 2026. The table shows when the steps were added, how big their commits were, and in which version of the change log they are.
| Step | What | Commit of the step (day) | Size of the commit | Change log |
|---|---|---|---|---|
| P1 | Kastgard card: registry, panel, board host | 1 Nov | 31 files, +1,121 / −29 | 0.82 (commit message: 0.82.2) |
| P2 | Your hero: palette, colour, markers, the corner with the Avatar, Colour vision | — | 34 files, +706 / −55 and 7 files, +246 / −20 | 0.83 (merge message: 0.84.0) |
| P3 | Show demos: attack confirmation, end of turn, opponents' turns, speed | 2 Nov | 34 files, +932 / −82 | 0.94 |
| P4 | Sample remarks and the end sentence in three genders | — | 10 files, +246 / −25 | 0.95 |
| P6 | Freeze: registry test, checklist | 2 Nov | 11 files, +56 / −1 | 0.96 |
| P5 | Music and the live picture | not built at that time | 0.102 (3 Nov), in the next article |
The three steps P3, P4 and P6 with their tests and documents, merged as one, are 38 files, +1,405 / −102. The change log gives P2 the number 0.83, but the merge message says 0.84.0: the entry of the Rokgard card, earlier 0.83, became entry 0.84 in that merge.
First step: the registry before the picture
The details of the first step (263 lines in three files, 19 to 22 frames per second, the Russian name broken into syllables) are in article 39. Here is what was not in it.
The registry came before the first picture. The table Settings.PREVIEWS has one decision for each setting of the group look: a scene, an explicit "none" with a reason, or a scene that is decided but not yet drawn (step: 'P2' and so on). The test that does not let a new setting in without a decision applies from the first step, and each further step deletes one step from the table (DESIGN §128.2, item 4). The 24th setting, Avatar movement, was added at the merge with the development version of the game that had brought it in the meantime.
The caption under the picture is a definition field, not a table of the panel. Settings.captionOf picks the line in this order: the description of the chosen value that the game already had; the description written for this value; the description of the whole setting; the hint. A description of a value is never replaced by new text (§128.1), so the platform has no strings of its own for the keys of the settings.
A click is taken in the capture phase. The panel follows the row by focus, click and mouse; a touch that only passes over does not move it. A click on a button must show this row before the control changes the value (§128.2, item 1). The second trap was in the environment: a static server kept the old files in the browser, and the panel showed the old CSS (§128.4).
The commit of the first step added 7 texts in nine languages, so 63 strings (my own calculation).
Second step: the browser changed the proposal
The panel went into the Your hero window: the dice of Kastgard and the tokens of Rokgard for the palette, the player's colour and the markers, the corner of the game window with the real Avatar for "Avatar in the corner" and "Avatar movement", and the Colour vision switch. The real browser then showed two things (§130.2):
- Four frames instead of two. The first version asked the manager for all started realms, and at the Avatar four pictures appeared: Kastgard, Rokgard and two skeleton realms (Vitgard, Telgard) that the player does not know. Now only the realms the player has revealed are drawn.
- The height of the panel on a phone. The realm chips and the Colour vision switch stood under the picture, so the panel was 322 px of 812 on a phone, that is 40%, and 46% in Russian. After the chips moved to the bar on the line with the name of the setting, it is 27 to 34% in English. The budget from decision D8 was 24 to 32%.
The third change is a decision, not a finding: the real Avatar instead of an imitation. The mockup drew the turning on a canvas. The Avatar in the game is CSS 3D, and its rule "it turns, or it stands" is its own, so the preview only calls it. The cost: the preview has a timer of its own that turns the avatar about every 2.6 s, while the game does so every 5 to 8 s, so that the difference is seen at once.
Smaller differences: Colour vision is only under the palette (D5 says "for the palette only"; the mockup had it also under "Your colour"). The control "Players in the sample" belongs to the scene of Rokgard and starts with three players, so that "Automatic" shows the shapes at once. At 375 px the panel by the palette is 313 px in Slovak and 331 px in Russian (§130.3).
Third step: rules are not copied, they are extracted
Four settings are not a picture but a behaviour over time. The panel plays a demo for them with the Show button, and after a change of the row's value it plays it again by itself (at the first showing it waits for the button). The mockup had basic demo times (900 and 220 ms), which were an estimate (SETTINGS-PREVIEW §7). The real build was not allowed to invent times, so the rules that the demo needs were extracted into functions that both the game and the demo call (§137.2, item 2):
| Demo | What it shows | What the game and the demo call together |
|---|---|---|
| Attack confirmation | a territory with 5 dice, target with 3; with the choice Mouse / Touch the attack starts at once, or after a second tap, with a 91% chance | BoardInput.needsConfirm, Rules.attackOdds |
| End-of-turn warning | the real "End turn" button; if an attack with at least 75% chance remains, the first click warns for 4.5 s and the second ends the turn | Interaction.favorableAttacks(g) (it got a game parameter) |
| Opponents' turns animation | two fights in a row with a time label; "All attacks" rolls both, "Only attacks on me" rolls the first and shows the second after 45 ms | Flow.animMode, Hud.rollTimes (new pure functions) |
| Animation speed | four dice are thrown one after another; the pause is 450 ms × max(f, 0.45), at the slow speed 765 ms | Settings.PACE, Settings.paceOf |
The table of speeds Settings.PACE (slow 1.7; normal 1; fast 0.45; instant 0) used to live in js/ui/app.js under the name SPEED, and three places read it. Now there is one, and a test says that app.js has no table of its own.
The change from the proposal: the choice "the opponent attacks me, or another opponent" was replaced by two fights in a row, because the difference between the settings Only attacks on me and All attacks is exactly the difference between the two. The All realms card got a panel for one row out of nine (the speed), so the window is wide there too. A row without a scene (Language, Theme, Sound, Live music) now hides the pictures and leaves only the line under them: P1 and P2 left under it the picture of the previous row, which on the All realms card would show the dice of the speed under "Language".
Texts: 16 keys in nine languages, 10 of them for demos and 6 for captions. The processor load did not change according to §139.2: in three seconds of idleness there were 152 requests for a snapshot, during a demo 162.
Fourth step: the game's engine chooses the remarks
Three settings are words: "Opponents comment" (Kastgard card), "Avatar comments" (the hero's voice) and "Gender". The proposal wanted, for the first two, a face and a line according to the mode. What was built is the list of remarks from the engine the game uses (NarratorEngine): a fixed sample game of twelve moments is put into the engine in the chosen mode with a fixed seed, and the remarks that the engine said are listed, each with a round icon (the personality of the opponent, or a die of the Avatar).
The seed was chosen so that the modes differ as they do in the game (§138.1): Brief says four remarks of the opponents and four of the Avatar, Chatty seven and eight, Tips only one piece of advice, and Off nothing. A real speech bubble would show one remark at a time for 4.5 seconds or longer, so one could not see how many remarks a mode says (§138.2, item 2).
The gender sentence shows one sentence of the game in three genders: the text of the end card of a won game ("You conquered the whole map in 12 rounds."), with the gender of each form and the shape the player chose marked. A language that writes the three forms the same way shows the sentence once. No new text was added: the remarks, the names of the personalities and the gender names are texts of the game. The hero window now has a panel in every layout and opens on the Gender row.
Sixth step: the freeze is mostly a test
P6 has 11 files in the git history, +56 / −1: one test (46 lines), a description in nine languages and one changed line in settings.js. The registry test says (§139.1) that the decision is true, not only that it exists:
- a setting without a picture (Language, Theme, Sound, Live music) reports no realm, and the platform pictures (
corner,pace,sentence) report none either; - the picture of a realm is in the
previewsof some realm of the set under the name from the decision, and the realm's hook makes the scene, shows its settings and removes everything at the end; - the undrawn ones remain exactly
livePicture,musicStyle,musicDensity,musicVolume; the test names them, so that the postponement is not forgotten and a fifth is not added.
The second test says that every value of every setting that has a picture or does not need one has a line under the panel. It found the only missing one, "Live music: Off"; its description was written.
Then the real page was walked through in the Browser pane: an iframe 375 or 1,100 px wide, and for each row of the three windows a focus on the row (a real focus, as Tab does), the height of the panel, elements wider than the panel or the window, and the line under the picture. The languages en, sk, de and ru × two themes × two widths are 16 runs of 27 lines each (my own calculation: 432 checks). The result: 0 page errors, 0 windows wider than the frame (359 px at 375 px, 1,040 px at 1,100 px), 0 elements wider than the panel. The height of the panel at 375 px was 27 to 41% of the window's height: the row without a demo 14%, the board with a demo 32 to 36%, the remarks 28%. The palette with the switch and the chips was 39 to 41% in Russian. The demos, the remarks and the gender sentence were also gone through by hand, with real clicks, in en and sk.
The mutants of steps P3 to P6 and their results are in the next article.
What changed compared with the proposal and the mockup
Where the real build differs from the proposal in SETTINGS-PREVIEW and from the mockup of draft no. 39, and where it showed.
| Proposal and mockup | The real build | Where it showed |
|---|---|---|
| board view assembled by hand (about 30 lines) | the game's projection StacksBoard.view over a minimal game; the chances 24%, 91%, 45% are real | P1, the browser |
| wide window from 900 px | from 920 px (at 900 px the panel was 819 px) | P1, the real window |
| pictures for every started realm | only for the revealed realms | P2, the browser (four frames) |
| chips under the picture | chips in the bar on the name row | P2, the browser (46% of a phone) |
| turning the avatar on a canvas | the real CSS 3D Avatar with its own rule; a timer of 2.6 s | P2, decision |
| Colour vision also under "Your colour" | only under the palette | P2, per D5 |
| "the opponent attacks me, or another opponent" | two fights in a row | P3 |
| demo times of 900 and 220 ms (estimate) | the game's rules extracted into functions; pause 450 ms × max(f, 0.45) | P3 |
| phone panel 24 to 32% | 27 to 34% (English), 39 to 41% with the palette in Russian | P2, P6, the browser |
What is decided and what stays open
Decided: D1 to D12 of 1 November. Under them, P1 to P4 and P6 are in the development version of the game. P5 was postponed by decision D10 and built on 3 November; that is in the next article.
Open, waiting for a decision:
- The panel on a phone. The palette with the switch and the chips is 39 to 41% of the height in Russian; the budget of D8 was 24 to 32%. The first thing that can be cut is the Colour vision switch (§139.4).
- Colour vision under "Your colour". It is one key in the
visionlist of the hero window (§130.5). - Left out are the scene from blob-type territories (the default maps of Kastgard), a build with Rokgard only (eight dice settings have no picture), the free-play editor without a panel, and the settings card for Rokgard (§128.5, §139.4). Names cut at 375 px ("Automaticky" in Slovak: 98 px of text in a button 73 px wide) are an older effect that the panel only made visible.
What I take from it
- A decision for every setting is worth making before the first picture. The registry with
stepforbids a setting without a picture from the first step on; the freeze at the end was then 11 files. - The browser finds what a mockup cannot. Four frames, 819 px, the Russian syllables and a panel at 46% of a phone's height were shown by the real page. The mockup was right in its foundation, because it draws with the game's renderer.
- A rule is not copied, it is extracted. The demo and the game call the same functions, so a change of the rule changes the demo too.
- "It exists" and "it is true" are two tests. The claim "every value has a line" found a value that the decisions had not found.
Sources and notes
- Game documents (the game's repository):
docs/SETTINGS-PREVIEW.md(§0 to §7, appendix A, "Checks"; the plan §5, decisions §6);docs/DESIGN.md§128 (P1), §130 (P2), §137 (P3), §138 (P4), §139 (P6; chapters P3 to P6 were renumbered from 136 to 138 at the merge);docs/ROADMAP.mdchapter 30;js/data/changelog.js, entries 0.82, 0.83, 0.94, 0.95, 0.96 and 0.97. - Commits (
git log,git show --statand--numstat): the analysis (1 Nov), the decisions (1 Nov), steps P1 to P4 and P6 with their merges; versions 0.82.2, 0.96.1 and 0.97.1. The base "before the first step" is version 0.80.1. - Related articles: One window, one card per realm, Previews in the settings, From Hero Dice to Avatar.