comparison doc/architecture.md @ 36:a464bd43b76c 1.0.0

clean documentation rewrite
author ark
date 2026-10-21 22:34 +0200
parents 85d23328a215
children
comparison
equal deleted inserted replaced
35:0d40f346059c 36:a464bd43b76c
1 architecture 1 Architecture
2 ------------ 2 ------------
3 3
4 the game is a static html page with plain javascript, drawn on a 2d canvas. it 4 The game is a static HTML page with plain JavaScript, drawn on a 2D canvas.
5 uses no javascript libraries. a python build script prepares everything that 5 It uses no JavaScript libraries. A Python build script prepares everything
6 can be calculated in advance: processed images, map data, route data and the 6 that can be calculated in advance: processed images, map data, route data,
7 config. it writes them to www/, together with a copy of the hand-written game 7 embedded sounds and the config. It writes them to www/, together with a
8 files from game/. www/ is the runnable game. it is not kept in the repository, 8 copy of the hand-written game files from game/. The www/ directory is the
9 so the game has to be built before it can be run. 9 runnable game. It is not kept in the repository, so the game has to be
10 10 built before it can be run.
11 this is a plan; nothing is implemented yet. 11
12 12 The details of the algorithms and their constants are in implementation.md.
13 13
14 directory layout 14
15 Directory layout
15 ---------------- 16 ----------------
16 17
17 proposed: 18 art/ drawings and recordings as supplied, and files cut from them
18 19 art_sources/ the scans the drawings were cut from
19 art/ drawings as supplied: scans, masks, sprites 20 digits/ digits cut from digits.png (tools/cut_digits.py)
20 sound_sources/ voice recordings as supplied 21 sound_sources/ voice recordings as supplied
21 sounds/ sounds cut from the recordings (tools/cut_sounds.py) 22 sounds/ sounds cut from the recordings (tools/cut_sounds.py)
22 config/ hand-edited game settings (toml) 23 config/
23 game.toml numbers from balance.md, waves, debug switches 24 game.toml every game setting, the wave lists, debug switches
24 tools/ python build scripts 25 doc/ documentation
25 game/ hand-written game files 26 game/ hand-written game files
26 index.html 27 index.html
27 style.css 28 style.css
28 js/ game code 29 js/ game code
29 doc/ design and technical notes 30 tools/ build, cutting, balancing and release scripts
30 www/ the built game, opened as www/index.html (generated, ignored) 31 www/ the built game (generated, ignored)
31 index.html copied from game/, as are style.css and js/ 32 index.html copied from game/, as are style.css and js/
32 assets/ processed images 33 assets/ processed images
33 data/ maps.js, sounds.js, config.js 34 data/ config.js, maps.js, sounds.js
34 dist/ tarballs for distribution (ignored) 35 dist/ release tarballs (ignored)
35 temp/ scratch files, build previews (ignored) 36 temp/ build cache and previews (ignored)
36 37 build/maps.json route and placement data of the last build
37 generated files carry a header line saying so and naming the script that made 38 preview/ preview images, balance and simulation reports
38 them. 39
39 40 Generated files have a header line saying so and naming the script that
40 41 made them.
41 running the game 42
42 ---------------- 43
43 44 Running and deploying
44 - desktop: open www/index.html directly from disk, or serve the directory 45 ---------------------
45 with any static web server 46
46 - tablet: tablets cannot easily open local html files, so the game is served 47 - Local: build, then open www/index.html from disk, or serve www/ with any
47 over http, from a computer on the home network or from a web host. the 48 static web server
48 tarball in dist/ is meant for that 49 - Server: `tools/make_dist.sh` runs a release build and packs www/ into
49 - an optional later step makes it installable to the home screen (web app 50 dist/minor_monsters_VERSION.tar.gz, which unpacks into a directory
50 manifest, offline cache). that requires https 51 minor_monsters. That directory is what the web server serves
51 52
52 opening the page from disk (file://) limits what the browser allows. chrome 53 The page also runs from disk (file://), where Chrome blocks JavaScript
53 blocks javascript modules, fetch() and reading pixels back from a canvas 54 modules, fetch() and reading pixels back from a canvas. So:
54 there. so: 55
55 56 - Scripts are loaded with plain script tags in a fixed order, and share one
56 - scripts are loaded with plain script tags in a fixed order, and share one 57 global namespace object, MM
57 global namespace object 58 - Data files are JavaScript files that assign to MM, not JSON files
58 - data files are javascript files that assign to that object, not json files 59 - The game never reads mask pixels; the build turns the masks into data
59 - the game never reads mask pixels; the build turns the masks into data 60 - Images are loaded with image elements
60 - images are loaded with image elements, which works from disk 61 - Sounds are embedded as base64 in a JavaScript file, so they can be
61 - recorded sounds are embedded by the build as base64 data in a javascript 62 decoded without fetch()
62 file, so they can be decoded without fetch() 63
63 64
64 65 Build
65 screenshots
66 -----------
67
68 firefox's own --screenshot captures at the load event. the game loads its
69 images and draws its first frame after that, so the capture shows an empty
70 page. the ff_screenshot script (in $PATH, ~/bin/ff_screenshot) drives
71 headless firefox over marionette and waits before capturing:
72
73 ff_screenshot -w 1024,768 -s 2 file://$PWD/www/index.html temp/splash.png
74
75 -w sets the viewport, -s the wait after loading. the game state is not
76 reachable from outside, so other screens are reached by tapping: -J runs
77 javascript after the wait, and -S waits again before capturing. a pointer
78 event sent to the canvas counts as a tap at that position in css pixels.
79 a fresh firefox profile has no stored settings, so the splash screen first
80 shows the sound button over the play button (sound.md). this taps it, and
81 the play button a second later, at 1024 x 768:
82
83 ff_screenshot -w 1024,768 -s 2 -S 3 -J 'function tap() {
84 document.getElementById("game").dispatchEvent(new PointerEvent(
85 "pointerdown", {clientX: 497, clientY: 560, bubbles: true})) }
86 tap(); setTimeout(tap, 1000)' \
87 file://$PWD/www/index.html temp/play.png
88
89 `ff_screenshot -h` lists the other options.
90
91
92 build
93 ----- 66 -----
94 67
95 one command, `python3 tools/build.py`, runs all steps. each step skips its work 68 `python3 tools/build.py` runs all steps. It needs Python 3.11 or later, for
96 when its inputs have not changed. requires python 3.11 or later (for the 69 the built-in TOML reader, and Pillow. A step is skipped when its outputs
97 built-in toml reader) and pillow. numpy is optional, if the pure python image 70 are newer than its inputs and the build scripts; `--force` runs every step.
98 steps turn out too slow. 71
99 72 1. Sprites: trim transparent edges and write to www/assets/. This covers
100 tools/cut_sheet.py, tools/cut_digits.py and tools/cut_sounds.py are run by 73 monsters, towers, projectiles, coins, HP bars, icons, buttons, screens
101 hand and write to art/. 74 and the digits, written as digit_NAME_N. The HP bars also get an empty
102 cut_sounds.py also needs ffmpeg with mp3 support, so the build itself does not 75 variant and blue variants for slowed monsters
103 depend on it. see sound.md. 76 2. Tower levels: split each t*p strip into levels 2 to 5, fill the inside
104 77 of each outline with white, trim, and write t0_2 to t3_5
105 steps: 78 3. Maps: write the map scans as JPEG
106 79 4. Masks: classify the mask pixels, extract the routes and write the
107 1. sprites: trim transparent edges, write to www/assets/. this covers the 80 placement grid to www/data/maps.js. The result is also kept in
108 icons, buttons and screens, and the digits from art/digits/ as 81 temp/build/maps.json, for the later steps and the balance tools. This
109 digit_NAME_N. make the hp bar variants: the empty part, and the blue bars 82 step also reruns when the placement settings or a map's road and spawn
110 for slowed monsters (art.md) 83 settings change
111 2. tower levels: t0-t3 are level 1. split each t*p strip into four images, 84 5. Sounds: embed art/sounds/*.mp3 in www/data/sounds.js, grouped by event
112 levels 2-5. fill the inside of the outline with white (flood fill from 85 6. Config: check config/game.toml, fill in the tower values for every
113 outside, everything not reached is inside), trim, write as t0_2..t0_5 and 86 level, add the size of every sprite, and write www/data/config.js
114 so on. see art.md 87 7. Checks: print per map its routes with length, turning and walk times,
115 3. maps: copy the map images, possibly converted to a smaller format 88 the monster counts and shares, the coins and hit points of its waves, and
116 4. masks: for each map 89 the early start bonus for skipping every break. Warn on problems, such as
117 - classify pixels as path, entrance, exit or free by their exact colour. 90 a wave count that does not match the lists, or a boss missing from the
118 masks must have hard edges: a pixel that is neither fully transparent 91 last wave
119 nor opaque pure red, blue or green stops the build (art.md) 92 8. Previews: write temp/preview/mapN.png with routes, entrances, exits and
120 - extract routes, see below 93 placement grid, mapN_routes.png for maps with several routes, and
121 - write a placement grid: cells where a tower footprint fits next to the 94 towers.png with every tower level, its rotation point and footprint
122 road, within the limits in balance.md. the red path in the mask is the 95 9. Game files: copy the files in game/ to www/ when their time or size
123 centre line of the road; the road's half width is set per map 96 differs. Files no longer in game/ are removed from www/, apart from
124 5. sounds: embed art/sounds/*.mp3 as base64 in www/data/sounds.js, 97 www/assets/ and www/data/
125 grouped by event 98
126 6. config: read config/game.toml, check it, write www/data/config.js 99 Options:
127 7. checks: print a summary per map (routes with length and turning, monster 100
128 counts, coins and hp per map against the target) and warn on problems 101 - `--watch` reruns the build when a file in art/, art/sounds/, art/digits/,
129 8. previews: draw each map with its routes, entrances, exits and placement 102 config/ or game/, or a build script, changes. Changes to the game code
130 grid into temp/preview/, for checking without starting the game. towers.png 103 show in www/ only after the build has copied them
131 shows the tower levels, each turned by its drawing direction to face up, 104 - `--release` writes www/js/debug.js empty and leaves [debug] out of
132 with its pivot and footprint 105 config.js. The game then runs as with every debug switch off
133 9. game files: copy the files in game/ to www/. a file is copied when its 106
134 time or size differs from the copy. files no longer in game/ are removed 107 `tools/make_dist.sh` takes its version from `tools/get_version.sh -f`: the
135 from www/, apart from www/assets/ and www/data/. a release build writes 108 latest Mercurial tag, with a timestamp appended when the working directory
136 www/js/debug.js empty 109 is not clean or not at the tagged revision. `--debug` packs a build with
137 110 the debug code. The www/ directory keeps the build the script made, so a
138 a watch mode (`tools/build.py --watch`) reruns the build when a file in
139 config/, art/, art/sounds/ or game/ changes. tuning then means: edit the toml,
140 save, reload the browser. the same goes for changes to the game code: they
141 show in www/ only after the build has copied them.
142
143 `tools/build.py --release` leaves the debug code out: it writes
144 www/js/debug.js empty and leaves [debug] out of config.js. the game then
145 runs as with every debug switch off.
146
147 `tools/make_dist.sh` runs a release build and packs www/ into
148 dist/minor_monsters_VERSION.tar.gz, which unpacks into a directory
149 minor_monsters. the version comes from `tools/get_version.sh -f`: the
150 latest tag, with a timestamp appended when the working directory is not
151 clean or not at the tagged revision. `--debug` builds with the debug code
152 in place of a release build. www/ keeps the build the script made, so a
153 plain build afterwards brings the debug code back. 111 plain build afterwards brings the debug code back.
154 112
155 113 Scripts run by hand, not by the build:
156 balance tools 114
157 ------------- 115 - tools/cut_sheet.py cuts the monster, tower, projectile and HP bar
158 116 sprites from a drawing sheet into art/ (art.md)
159 tools/balance.py estimates, map by map and wave by wave, whether the coins 117 - tools/cut_digits.py cuts art/digits.png into art/digits/
160 a map pays buy enough firepower (balance.md, balancing). it is run by hand 118 - tools/cut_sounds.py cuts the recordings into art/sounds/. It needs FFmpeg
161 after a build: it reads config/game.toml, and the routes and placement grid 119 with MP3 support, which the build does not
162 from temp/build/maps.json. it only calculates and leaves the images alone. 120 - tools/balance.py and tools/simulate.js estimate and test the balance of
163 it writes tables and charts (numpy, matplotlib) to temp/preview/: 121 the game (balancing.md)
164 122
165 - balance.txt: value per coin for every tower and level; per map the 123
166 coverage of each tower's range, and per wave the coins on hand, the 124 Config
167 damage rate both demands need and the coins the naive and greedy players
168 need to hold the wave
169 - balance_value.png: value per coin by tower level
170 - balance_map0.png to balance_map3.png: coins per wave, and the surplus at
171 the last wave and the hearts left against a wave size factor. the factor
172 scales the number of regular monsters in every wave; the coins they drop
173 follow
174
175 `tools/balance.py --draft` prints wave lists made from the draft numbers in
176 each map's section of the config (balance.md, waves), as toml to paste over
177 the map's [[map.N.wave]] lists. `--draft 2` does map2 only. below each map
178 it prints what the calculation makes of the drafted lists. nothing is
179 written in this mode.
180
181 tools/build.py does not count balance.py as one of its inputs, so changing
182 it does not rebuild the game.
183
184 tools/simulate.js checks the calculation by playing the real game logic
185 with scripted players. it is run by hand with node after a build:
186
187 node tools/simulate.js
188 node tools/simulate.js --maps 2 --players naive,naive_t0 --seeds 10
189
190 it loads www/data/config.js, www/data/maps.js and the logic files util.js,
191 assets.js, map.js, monster.js, tower.js, projectile.js, wave.js and
192 game.js, as the browser would, with window set to the global object.
193 render.js, ui.js, input.js, debug.js and main.js are left out, so the
194 debug switches have no effect. MM.audio is the only stub; assets.js loads
195 unchanged, since sprite sizes come from the config and images are only
196 loaded by main.js.
197
198 the game advances in steps of 1/60 s, as in the browser; game speed plays
199 no part. each run has its own seed, passed to the game. the players build,
200 upgrade and start waves through the game's own functions (shop choice,
201 preview, build, tower selection, upgrade, early start), so placement rules
202 and prices are the game's. the players and their rules are listed at the
203 top of the file; naive and greedy follow balance.md, balancing, and pick
204 cells as tools/balance.py does, from the placement grid in maps.js.
205
206 the coins a wave needs are measured by playing that wave alone from an
207 empty map with the first purchases of the player's list, and searching
208 for the fewest that lose no heart. every wave starts on an empty map in
209 the game, so this matches the wave in a full run, apart from towers
210 bought during the wave.
211
212 it writes temp/preview/simulate.txt (per map and player: maps won, hearts
213 left, coins on hand and the surplus at the start of the last wave, hearts
214 lost per wave) and temp/preview/simulate.json, which tools/balance.py reads
215 for the hits per t0 attack. `--need all` measures the coins needed for
216 every wave, `--waves` takes wave lists from a json file in place of the
217 config's, for trying drafts without a build.
218
219
220 routes
221 ------ 125 ------
222 126
223 a route is a list of points from an entrance to an exit. a map has one or 127 The file config/game.toml holds every game setting. The build checks it and
224 more routes. a monster picks a route at spawn (weights in balance.md) and 128 turns it into www/data/config.js. There is no in-game editor: values are
225 follows it to the end. this handles the branches on map1 and map2 without 129 changed in the file and the game is rebuilt. Units are map pixels (pixels
226 junction logic at runtime. 130 of the map scan), seconds, and map pixels per second.
227 131
228 extraction in the build: 132 Sections:
229 133
230 1. thin the path pixels to a one-pixel centre line (skeleton) 134 - [scale]: drawing scale of maps, sprites, coins and HP bars
231 2. turn the skeleton into a graph of junctions and segments, and drop short 135 - [monster.*]: hit points, coins and speed of each monster; boss marks
232 dead ends left by uneven strokes 136 the bosses
233 3. find the graph nodes nearest to each entrance and exit blob 137 - [animation], [movement]: hops, puffs, and the spread of monsters on the
234 4. list every path through the graph from an entrance to an exit that visits 138 road
235 no junction twice 139 - [route_preference]: the route weights (game.md, routes)
236 5. smooth each route and reduce it to a few points per bend 140 - [tower.*], [tower_rules]: tower values at level 1 and level 5, attack
237 6. record length and turning for each route 141 time, projectile, slow, sell refund
238 142 - [placement]: where towers may stand
239 map0 and map3 give one route each. map1 and map2 give several; map2 may give 143 - [waves], [hearts], [coins], [controls]: breaks, heart costs, flying
240 more than wanted. where the automatic result is wrong, the mask is redrawn. 144 coins, game speeds
241 145 - [sound], [sound.event]: volume, the minimum time between two plays, and
242 the game walks a monster along the route's centre line, by distance, and 146 a placeholder beep per event
243 draws it beside the line. the offset is set per monster at spawn 147 - [art.angle], [art.pivot], [art.screen]: drawing direction and rotation
244 (balance.md, monsters) and needs no route data from the build. when a map 148 point of turning sprites, and where buttons sit on the screen drawings
245 loads, each route works out the sideways direction at its points and how far 149 (art.md)
246 an offset may go on the inside of each bend. towers rank monsters by their 150 - [links]: the logo's web page and the email address of the help popup
247 distance along the centre line, so the offset does not change the order. 151 - [debug]: debug switches
248 152 - [map.N]: per map the starting coins, early start bonus, spawn interval,
249 153 road half width, distances from spawn and exit points, the draft numbers
250 config 154 for tools/balance.py, and the wave lists [[map.N.wave]]
251 ------ 155
252 156 Debug switches, all off by default:
253 config/game.toml holds every number in balance.md, the wave lists, and debug 157
254 switches. the build converts it into www/data/config.js. toml allows comments, 158 - Start coins, unlimited coins, no heart loss
255 so each value can carry its source note (guess, decided). 159 - Start map and wave. The start map counts as the first map: the play
256 160 button starts it, and a lost map returns to it. Only that map starts at
257 wave format: 161 the start wave
258 162 - Show routes, placement grid, tower ranges, hit areas
259 [[map.0.wave]] 163 - Frame time and entity counts on screen
260 monsters = { m0 = 5, m1 = 1, m2 = 1, b0 = 1 } 164 - A fixed random seed; 0 picks a new one per map
261 165
262 a wave lists how many of each monster it holds. when the wave starts, the 166 The file js/debug.js holds the code for all of them. It replaces functions
263 boss spawns first: it is the slowest monster and the others overtake it. the 167 of the game and the UI, and render.js calls it to draw over the map image
264 rest follow one per spawn interval, each drawn at random from the monsters 168 and over the monsters. The start-up in main.js takes the start map, wave
265 left in the wave. the spawn interval is set per map. the boss is in the last 169 and seed from it.
266 wave. 170 In a release build the file is empty and none of this is left.
267 171
268 debug switches, all off by default: 172
269 173 Runtime
270 - start coins override, unlimited coins
271 - start at a given map and wave. that map counts as the first map: the play
272 button starts it, and a lost map returns to it
273 - no heart loss
274 - show routes, placement grid, tower ranges, hit areas
275 - on-screen frame time and entity counts
276 - a fixed random seed
277
278 js/debug.js holds the code for all of them. it replaces functions of the
279 game and the top bar drawing, and render.js calls it to draw over the map
280 image and over the monsters. main.js takes the start map, wave and seed
281 from it. without it, as in a release build, nothing of this is left.
282
283 there is no in-game config editor: values are changed in the toml file.
284
285
286 runtime
287 ------- 174 -------
288 175
289 script files, in load order: 176 Script files, in load order:
290 177
291 data/config.js generated settings 178 data/config.js generated settings
292 data/maps.js generated map data 179 data/maps.js generated map data
293 data/sounds.js generated sound data 180 data/sounds.js generated sound data
294 js/util.js vector maths, random numbers, easing 181 js/util.js vector maths, seeded random numbers, easing
295 js/storage.js settings kept in the browser 182 js/storage.js settings kept in the browser
296 js/assets.js image loading, sprite table 183 js/assets.js image loading, sprite drawing with angle and pivot
297 js/audio.js recorded sounds, placeholder beeps for the other events, 184 js/audio.js recordings, placeholder beeps, splash screen music
298 splash screen music 185 js/map.js routes and sideways offsets, placement lookup, snapping,
299 js/map.js placement lookup, snapping, route sampling 186 t0 spike sides, route weights
300 js/monster.js movement along a route, hops, slow, hp 187 js/monster.js movement along a route, hops, slows
301 js/tower.js targeting, attacks, upgrade, sell 188 js/tower.js targeting, attacks, upgrade cost, refund
302 js/projectile.js 189 js/projectile.js flight to the target, damage, p2 freeze splash
303 js/wave.js wave timing, countdown, early start bonus 190 js/wave.js breaks, spawning, early start bonus
304 js/game.js game state, rules, win and loss 191 js/game.js game state and rules: coins, hearts, building, upgrade,
305 js/render.js drawing 192 sell, win and loss
306 js/ui.js top bar, shop, tower menu, screens 193 js/render.js drawing of the map and everything on it
194 js/ui.js layout, top bar, shop, tower menu, screens, help popup
307 js/input.js pointer events 195 js/input.js pointer events
308 js/debug.js debug switches, empty in a release build 196 js/debug.js debug switches, empty in a release build
309 js/main.js start-up and main loop 197 js/main.js start-up, screen flow and main loop
310 198
311 game loop: 199 Game loop:
312 200
313 - the simulation advances in fixed steps of 1/60 s. drawing happens once per 201 - The simulation advances in fixed steps of 1/60 s, driven by the
314 browser frame and is independent of it 202 browser's frame clock. Drawing happens once per frame
315 - game speed 2x runs two simulation steps per frame 203 - Game speed n runs n times as many steps per frame
316 - pause stops the simulation; drawing and the top bar buttons continue 204 - Pause stops the simulation; drawing and the top bar buttons go on
317 - a frame that takes too long runs at most a few steps and drops the rest, so 205 - A long frame runs at most a few steps per speed step and drops the rest,
318 the game slows down rather than freezing after the tab was in the background 206 so the game slows down rather than freezing after the tab was in the
319 207 background
320 state: 208
321 209 State:
322 - game state is plain objects: monsters, towers, projectiles, coins in flight, 210
323 wave state, coins, hearts. rendering reads it and does not change it 211 - The game state is plain objects: monsters, towers, projectiles, coins in
324 - random numbers come from one seeded generator, so a run can be repeated with 212 flight, puffs, freeze splashes, wave state, coins and hearts. Rendering
325 the same seed when chasing a bug 213 reads it and does not change it
326 214 - The game's random numbers come from one seeded generator, so a run can
327 display: 215 be repeated with the same seed. Sound variants use Math.random, so sound
328 216 does not change a run
329 - the canvas fills the window. the map is scaled to fit and centred, with 217
330 borders where the shapes differ 218 Display:
331 - the canvas resolution follows the device pixel ratio, so drawings stay sharp 219
332 on high-resolution screens 220 - The canvas fills the window. The map is scaled to fit the area left by
333 - layout: top bar with coins, hearts, wave, countdown, sound, speed, pause 221 the top bar and the shop, and centred
334 and help. on a narrow screen the buttons move to a second row under the 222 - The canvas resolution follows the device pixel ratio
335 counters. the tower shop sits on the right in landscape and at the bottom in portrait 223 - Buttons are at least 48 CSS pixels for touch
336 - buttons are at least 48 css pixels for touch 224
337 225 Input:
338 input: 226
339 227 - Pointer events cover mouse and touch alike
340 - pointer events cover mouse and touch alike 228 - Buttons and tower selection act when the pointer goes down. Placing
341 - nothing relies on hover; selection and confirmation are by tap. with a 229 follows the pointer until it is let go. The logo and the email address
342 mouse, hover enlarges the screen buttons and shows the pointer cursor over 230 act on release, as some browsers open a page or a mail only then
343 any button 231 - The page blocks browser zoom, scroll, double tap and context menu
344 - buttons and tower selection act when the pointer goes down. placing 232 gestures on the canvas
345 follows the pointer until it is let go, and building happens then 233
346 - the page blocks browser zoom and scroll gestures on the canvas 234 Persistence:
347 235
348 placement: 236 - Game progress is not stored. Settings, so far only sound on or off, are
349 237 kept by js/storage.js in one localStorage entry with a format version
350 - the build's placement grid marks every cell where a tower may stand 238 - All access is wrapped, so the game still runs when storage is
351 - while the pointer is down, the game searches outward from it for the 239 unavailable, for example in private browsing; settings are then not kept
352 nearest legal cell that keeps the minimum distance to other towers, within
353 the snap radius. where there is none, the preview stays where it was
354 - t0 checks once, at placement, which of its four sides face the path, and
355 only draws spikes on those
356
357 persistence:
358
359 - nothing is stored for now. maps are played in order and a lost map goes
360 back to the first map, so there is no progress to keep. a reload starts at
361 the splash screen with a fresh game
362 - settings, so far only sound on or off, are stored by js/storage.js. it
363 wraps localStorage, and one entry holds them
364 - all access is wrapped so the game still runs when storage is unavailable,
365 for example in private browsing; settings are then not kept
366 - the entry carries a version number for later format changes
367
368
369 not planned
370 -----------
371
372 - in-browser editors or tuning panels