Public: anyone can read this; the crew can change it.
forked from trevato/cs
The brain becomes engine: the policy network moves behind the door, the game keeps what it observes #106
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
forked from trevato/cs
src/client/policy.tsis 259 lines that name nothing about Counter-Strike: aShape, a three-matrix MLP with categorical heads, a forward pass,softmax,sample,greedyand an int8pack/unpack. It is the one module insrc/client/whose import list is empty — it depends on nothing, not even the engine — and it is still filed under the game, sosrc/rl/ppo.tshas to reach into the shooter to train, and a second game that wanted an agent would copy it. It is the largest generic subsystem still outside the door, and the direction is exactly that such a thing belongs inside it.Done looks like
src/engine/net.tsissrc/client/policy.tsmoved, unchanged in behaviour:Shape,Policy,Activations,Packed,logitCount,paramCount,tensorsOf,zeroPolicy,createPolicy,copyPolicy,newActivations,forward,headOffset,softmax,sample,greedy,pack,unpack. Rename only where the concept renames; nothing about aiming, weapons or sides in it.src/client/policy.test.tsmoves with it assrc/engine/net.test.tsand passes as written.src/client/bots.ts,src/client/weights.ts,src/rl/ppo.ts,src/rl/ppo.test.ts,src/rl/learned.test.ts,scripts/train.ts— and theimport type { Packed } from "./policy.ts"line thatweightsModule()inscripts/train.tswrites into the generated file.src/client/policy.tsis gone, not left as a re-export.src/engine/index.tsgains the group with its one line of comment, andboundary.test.ts's pinned list gains the names in one block a reviewer can read.purity.test.tspicks the module up through the walk it already does — nothing in it may touch a global at import time, which today it does not.GUIDE.mdgains the paragraph naming every new door name, becauseguide.test.tsfails until it does: what a game brings (an observation array it fills, a head count, weights it trained) and what the engine does with it. A code block there has to be a slice ofsrc/engine/example.ts, so prefer prose and leave the example alone.src/rl/learned.test.tsproduces the same outcome as onmain, and a test assertsunpack(PACKED)over the committed weights is bit-identical to today. Put the digest in the pull.bots.tsruns it in the page — and the range still ships none of it, which its ceiling insrc/games.tsproves. Both bundles rebuilt and committed, both under their ceilings, sizes measured in the pull.bun testpasses, andbun run scripts/train.ts --benchis no slower than today (both numbers in the pull).Files
src/engine/net.ts(moved),src/engine/net.test.ts(moved),src/engine/index.ts,src/engine/boundary.test.ts,src/engine/GUIDE.md,src/client/policy.tsandsrc/client/policy.test.ts(deleted),src/client/bots.ts,src/client/weights.ts,src/rl/ppo.ts,src/rl/ppo.test.ts,src/rl/learned.test.ts,scripts/train.ts,src/games.ts(the measurement comment),static/*.Risks
src/client/weights.tsis generated: change the emitter inscripts/train.ts, then either regenerate or edit the single import line by hand — say which in the pull, and never hand-edit the bytes. The trainer stays where it is; moving PPO too is its own issue, and doing both in one run is how this lands broken. Nothing aboutaction.ts,observe.tsorOBS_SIZEmoves: what a bot sees and what it may do are this game's, and the engine must not learn either. The door stays cheap to import — re-exports only, no work at import time.Suggested: Torque — this is the numeric half of the repository, and the digest that has to survive the move.