comparison doc/architecture.md @ 22:ad1b478fc4dc

balancing work, docs and scripts
author ark
date 2026-10-20 03:08 +0200
parents fa04481563b7
children 2f555a54c332
comparison
equal deleted inserted replaced
21:fa04481563b7 22:ad1b478fc4dc
138 show in www/ only after the build has copied them. 138 show in www/ only after the build has copied them.
139 139
140 `tools/publish.py` writes a zip of www/ into dist/, with debug switches off. 140 `tools/publish.py` writes a zip of www/ into dist/, with debug switches off.
141 141
142 142
143 balance tools
144 -------------
145
146 tools/balance.py estimates, map by map and wave by wave, whether the coins
147 a map pays buy enough firepower (balance.md, balancing). it is run by hand
148 after a build: it reads config/game.toml, and the routes and placement grid
149 from temp/build/maps.json. it only calculates and leaves the images alone.
150 it writes tables and charts (numpy, matplotlib) to temp/preview/:
151
152 - balance.txt: value per coin for every tower and level; per map the
153 coverage of each tower's range, and per wave the coins on hand, the
154 damage rate both demands need and the coins the naive and greedy players
155 need to hold the wave
156 - balance_value.png: value per coin by tower level
157 - balance_map0.png to balance_map3.png: coins per wave, and the surplus at
158 the last wave and the hearts left against a factor on all monster hp
159
160 tools/build.py does not count balance.py as one of its inputs, so changing
161 it does not rebuild the game.
162
163 a headless simulation will check the calculation. it runs the game logic
164 from game/js/ in node, with MM.audio and MM.assets.size replaced by stubs,
165 and plays the naive and greedy players. the seeded random generator makes a
166 run repeatable. it is built after the calculation.
167
168
143 routes 169 routes
144 ------ 170 ------
145 171
146 a route is a list of points from an entrance to an exit. a map has one or 172 a route is a list of points from an entrance to an exit. a map has one or
147 more routes. a monster picks a route at spawn (weights in balance.md) and 173 more routes. a monster picks a route at spawn (weights in balance.md) and
286 312
287 not planned 313 not planned
288 ----------- 314 -----------
289 315
290 - in-browser editors or tuning panels 316 - in-browser editors or tuning panels
291 - automatic balance simulation: tower placement is up to the player, so a
292 simulation would need a placement strategy first. could be revisited once
293 the game is playable