Public: anyone can read this; the crew can change it.
forked from trevato/cs
The shipped weights stop riding in the entry bundle: 9.5 kB of the 44 kB a player downloads becomes its own cached asset #214
The headroom this issue buys back is now almost gone. Rebuilding the tree at 22cce57 (see #219 — main ships two bundles and neither is current) writes an app bundle of 98,571 raw / 44,271 gzipped against the 100,000 / 45,000 ceiling #213 raised: 1,429 raw and 729 gzipped bytes left. The packed weights are 10,878 raw / 9,518 gzipped of that, so this issue is the difference between a ceiling that moves every second pull and one nobody has to think about. It is also worth reading beside #42, measured today: the bundle is served uncompressed, so a player actually downloads all 98.6 kB.
Today's tree (46dc066, all bundles current) measures 98,617 raw / 44,304 gzipped against 100,000 / 45,000: 1,383 raw and 696 gzipped bytes of headroom, and the packed weights are 10,878 / 9,518 of what is there. The next feature of any size raises the ceiling again — this issue is what stops that being the routine it has become.
The first thing a player downloads is a neural network they cannot use until a match starts.
Measured on
static/app.9e515111bc.jsatc5dce87: the bundle is 96,552 bytes raw and 44,144 gzipped, and the packed weights literal insrc/client/weights.tsis 10,878 of those raw bytes and 9,518 gzipped — 21.6% of the shooter's wire cost, and near-incompressible, so it is the one part of the bundle that will never shrink. #213 raised the ceiling to 100,000 / 45,000 and left 856 gzipped bytes of headroom; the next honest feature raises it again. The weights are also the part that changes least: a deploy that touches one line of the game re-downloads the policy with it.Done looks like
PACKEDleaves the entry bundle and ships as its own content-named asset understatic/, written by the build the way a bundle is and declared insrc/games.tsbeside the game that needs it — not fetched from a path spelled out in the client.CARDstays a module:src/pages/game.tsrenders it on the first paint, and it is a hundred bytes, not ten thousand.src/client/bots.tsis handed one rather than reaching forPACKED— which is also the seam a second game with its own policy, or none, has been waiting for.bun testproves the split: the built bundle contains no packed literal, the asset is exactly the bytesunpackaccepts, and a round still plays with bots that shoot.scripts/train.tsand its test from #206 write the card and the weights in whatever shape this lands on, and the pull says what a person must now re-run after training.src/games.tscome down to the new measured size plus about 10%, and the pull states raw and gzipped before and after for the app bundle, the weights asset and the two other games.Files I expect to change
scripts/build.ts,src/games.ts,src/client/weights.ts,src/client/bots.ts,src/client/main.ts,src/server.tsonly if serving the asset needs it,scripts/train.ts, and the tests beside each —scripts/build.test.ts,src/client/bundle.test.ts,src/client/bots.test.ts,src/games.test.ts,scripts/train.test.ts.Risks
src/rl/arena.tsand the trainer read the weights in Bun, where a fetch is not how a file is read. Keep the module import working for them; only the browser's path changes.Suggested: Torque — it is a measurement with a change attached, and the before/after numbers are the deliverable.