wobblyhead hg > minor_monsters
comparison doc/game.md @ 36:a464bd43b76c 1.0.0
clean documentation rewrite
| author | ark |
|---|---|
| date | 2026-10-21 22:34 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 35:0d40f346059c | 36:a464bd43b76c |
|---|---|
| 1 The game | |
| 2 -------- | |
| 3 | |
| 4 Minor Monsters is a tower defense game by M.A. and J.A. Juszczyk. It runs | |
| 5 in desktop and mobile browsers, with mouse or touch. The player only | |
| 6 manages towers: build, upgrade, sell. Everything else, such as collecting | |
| 7 coins, happens on its own. The game shows icons and hand-drawn digits in | |
| 8 place of text. | |
| 9 | |
| 10 This document describes the rules as the game implements them. The values | |
| 11 are in config/game.toml; the section names below point to them. How the | |
| 12 code does it is in architecture.md and implementation.md. | |
| 13 | |
| 14 | |
| 15 Maps | |
| 16 ---- | |
| 17 | |
| 18 There are four maps, played in order: map0 home, map1 mine entrance, map2 | |
| 19 mine, map3 lava depths. Each map has a mask that marks the path, its | |
| 20 entrances and its exits (art.md). | |
| 21 | |
| 22 - A won map leads to the next map. After the last map the game is won | |
| 23 - A lost map sends the player back to the first map | |
| 24 - There is no map selection and nothing is stored between visits. A | |
| 25 reload starts at the splash screen with a fresh game | |
| 26 - Each map starts with its own starting coins and hearts. Nothing is kept | |
| 27 from the map before ([map.N], [hearts]) | |
| 28 | |
| 29 The maps map0 and map3 have one route each. On map1 the path branches | |
| 30 into three routes. On map2 two entrances and loops give six routes. | |
| 31 | |
| 32 | |
| 33 Routes | |
| 34 ------ | |
| 35 | |
| 36 A monster picks its route when it spawns and follows it to the exit. On | |
| 37 map2 the route also decides the entrance. | |
| 38 | |
| 39 - A boss always takes the shortest route | |
| 40 - Other monsters weigh the routes by their speed. Each route has a value | |
| 41 between 0 and 1: the average of its length relative to the longest route | |
| 42 and its straightness relative to the straightest one | |
| 43 - A monster's speed factor is its speed minus the reference speed, divided | |
| 44 by the reference speed, limited to -1 to 1 | |
| 45 - The weight of a route is 1 + bias x speed factor x (2 x route value - 1), | |
| 46 and at least the minimum weight ([route_preference]) | |
| 47 | |
| 48 So faster monsters prefer long or straight routes, slower ones prefer | |
| 49 shortcuts, and a monster at the reference speed takes every route with the | |
| 50 same likelihood. | |
| 51 | |
| 52 | |
| 53 Monsters | |
| 54 -------- | |
| 55 | |
| 56 The regular monsters are m0 to m4, in rising strength. The bosses are b0 | |
| 57 to b3, one per map: b0 comes on map0, b1 on map1 and so on. Each monster | |
| 58 has hit points, a coin drop and a speed ([monster.*]). A monster's hit | |
| 59 points are the same on every map; a map gets harder through the size and | |
| 60 mix of its waves. All regular monsters appear on all maps. | |
| 61 | |
| 62 - Each monster's speed differs from its configured speed by a random share | |
| 63 ([movement] speed_variation). Faster ones overtake slower ones | |
| 64 - Monsters do not walk in single file. Each walks beside the centre line | |
| 65 of the road, with a fixed lean to one side and a part that wanders. The | |
| 66 offset grows from 0 at the start of the route and is reduced on the | |
| 67 inside of tight bends ([movement]) | |
| 68 - Monsters move by small hops, with squash on landing and stretch in the | |
| 69 air, and a slow breathing on top ([animation]) | |
| 70 - An HP bar shows above every monster; the boss has its own bar. The bar | |
| 71 turns blue while the monster is slowed | |
| 72 - A dying monster leaves a puff, a larger one for a boss | |
| 73 | |
| 74 | |
| 75 Waves | |
| 76 ----- | |
| 77 | |
| 78 Each map has a list of waves ([[map.N.wave]]). A wave says how many of | |
| 79 each monster it holds. The boss of the map is in the last wave. | |
| 80 | |
| 81 - A map starts with a break ([waves] first_break). The next wave starts | |
| 82 when the break runs out | |
| 83 - A wave spawns one monster per spawn interval ([map.N] spawn_interval). | |
| 84 The boss comes first, as it is the slowest; the others follow in random | |
| 85 order | |
| 86 - The break after a wave starts when its last monster has spawned | |
| 87 ([waves] break). Monsters of the wave may still be on the map | |
| 88 - The wave counter shows the current wave, and during a break the next one | |
| 89 - During every break, the first one included, a button starts the next | |
| 90 wave early. It pays a bonus: the seconds left times the map's | |
| 91 early_bonus rate, rounded down | |
| 92 | |
| 93 | |
| 94 Coins | |
| 95 ----- | |
| 96 | |
| 97 Killing a monster pays its coin drop. The coins count at once, so a player | |
| 98 can build right after a kill. Coin sprites then fly from the monster to | |
| 99 the coin counter, at most a few per death ([coins]); each is one of the | |
| 100 four coin drawings, picked at random. The early start bonus counts at once | |
| 101 too, and its coins fly from the exits. | |
| 102 | |
| 103 | |
| 104 Hearts | |
| 105 ------ | |
| 106 | |
| 107 A regular monster that reaches the exit costs hearts. A boss that reaches | |
| 108 it loses the map: its heart cost is all the hearts of a map ([hearts]). | |
| 109 At zero hearts the map is lost. The map is won when the last wave has | |
| 110 spawned and no monster is left on the map. | |
| 111 | |
| 112 | |
| 113 Towers | |
| 114 ------ | |
| 115 | |
| 116 There are four towers, each with five levels. Damage, range, slow and cost | |
| 117 are set in the config for level 1 and level 5; the levels between are | |
| 118 filled in by equal steps ([tower.*]). The time between attacks is the same | |
| 119 at every level. | |
| 120 | |
| 121 - t0, melee: each attack damages every monster in range at once. It | |
| 122 pushes out spikes (p0) only on the sides that face the path | |
| 123 - t1, the standard tower: turns and shoots p1 at one monster | |
| 124 - t2, the freeze tower: does no damage. It turns and shoots p2, which | |
| 125 bursts where it lands into a freeze splash. Every monster the splash | |
| 126 touches is slowed to a share of its speed for a time. Slows do not add | |
| 127 up; the strongest one applies, and a new hit of the same strength | |
| 128 restarts its time. A slowed monster also hops slower | |
| 129 - t3, the sniper tower: turns and shoots p3. It is meant to be weaker | |
| 130 than t1, and its much longer range lets it reach more of the path | |
| 131 | |
| 132 Targeting: | |
| 133 | |
| 134 - A tower aims at the monster in range that is furthest along, that is, | |
| 135 the one with the least distance left to its exit | |
| 136 - Turning towers face their target at once and keep their direction when | |
| 137 no monster is in range | |
| 138 - The projectiles p1, p2 and p3 home in on their target. If the target | |
| 139 dies first, the projectile flies on to its last position and disappears | |
| 140 there without damage. A p2 still bursts there | |
| 141 - A new tower attacks at once | |
| 142 | |
| 143 Prices: | |
| 144 | |
| 145 - Building costs the level 1 price. Each upgrade costs the price of the | |
| 146 new level | |
| 147 - Selling refunds a share of everything paid for the tower, build and | |
| 148 upgrades, rounded down ([tower_rules]). A tower is always sold whole | |
| 149 | |
| 150 | |
| 151 Placing and managing towers | |
| 152 --------------------------- | |
| 153 | |
| 154 Towers stand next to the road, never on it, and not near the entrances or | |
| 155 exits. They keep a distance from each other and from the map edge | |
| 156 ([placement], and per map in [map.N]). | |
| 157 | |
| 158 - The shop sits on the right in landscape and at the bottom in portrait. | |
| 159 A tower the player cannot afford is dimmed and cannot be chosen | |
| 160 - After choosing a tower, a press on the map puts a preview with its range | |
| 161 at the nearest legal position. The preview follows the pointer until it | |
| 162 is let go | |
| 163 - Tapping the preview builds the tower. Dragging the preview, or pressing | |
| 164 elsewhere and dragging, moves it again | |
| 165 - Where no legal position is within reach, a red cross shows briefly and | |
| 166 the placement refused sound plays | |
| 167 - The preview pulses in time with the chosen shop item. A second tap on | |
| 168 that item cancels the choice; building clears it | |
| 169 - Tapping a built tower shows its range and a bubble with upgrade and | |
| 170 sell, each with its price. An upgrade the player cannot afford is | |
| 171 dimmed. At level 5 only sell is left | |
| 172 - Selling takes two taps. The first arms the sell button, which then | |
| 173 pulses with a red glow; the second sells. Any other tap cancels it | |
| 174 - A tap outside the bubble closes it | |
| 175 | |
| 176 | |
| 177 Controls | |
| 178 -------- | |
| 179 | |
| 180 The top bar shows coins, hearts and the wave count. Its buttons, from the | |
| 181 right: help, pause, speed, sound, and during breaks the early start button | |
| 182 with the countdown. On a narrow screen the buttons move to a second row. | |
| 183 | |
| 184 - Pause stops the game. The shop is dimmed, and nothing can be built, | |
| 185 upgraded or sold. Pausing drops the shop choice and the tower selection. | |
| 186 The top bar buttons still work, early start included | |
| 187 - Speed switches between the game speeds ([controls]) | |
| 188 - Sound switches all sound on or off. The choice is kept in the browser. | |
| 189 Until the player first uses it, the config's default applies ([sound]) | |
| 190 - Help opens the help popup, which pauses the game. A tap anywhere closes | |
| 191 it and lets a game that was running go on. A tap on the email address in | |
| 192 the popup writes a mail ([links]) | |
| 193 | |
| 194 Nothing depends on mouse hover. With a mouse, hover only enlarges the | |
| 195 screen buttons and shows the pointer cursor over buttons. | |
| 196 | |
| 197 | |
| 198 Screens | |
| 199 ------- | |
| 200 | |
| 201 - Splash: title, byline and play button, over the paused first map, with | |
| 202 music looping | |
| 203 - Browsers allow sound only after a tap, so on the first splash screen | |
| 204 after loading, a sound button covers the play button. It pulses with a | |
| 205 red glow; a tap starts the sound and the music and uncovers the play | |
| 206 button. When sound was switched off on an earlier visit there is no | |
| 207 sound button and no music | |
| 208 - Left of the play button the logo opens the game's web page ([links]), | |
| 209 right of it a question mark opens the help popup | |
| 210 - The play button fades the music out and starts play | |
| 211 - Map won, after every map but the last: one button, which starts the next | |
| 212 map | |
| 213 - Game won, after the last map: one button, which goes back to the splash | |
| 214 screen. The music plays at once there, as sound is already running | |
| 215 - Game lost: one button, which starts the first map | |
| 216 | |
| 217 All four screens are drawn at one scale, so the larger drawings stay | |
| 218 larger. The screen buttons pulse slowly as a cue to tap. | |
| 219 | |
| 220 | |
| 221 Sound | |
| 222 ----- | |
| 223 | |
| 224 Game events play the voice recordings in art/sounds/, a random one where | |
| 225 an event has several. Events without a recording play short beeps made in | |
| 226 the browser. The events are listed in art.md. The map won sound waits for a | |
| 227 death sound still playing, the map lost sound for the last exit sound. |
