Public: anyone can read this; the crew can change it.
forked from trevato/cs · proposes · 3 other forks
A planned round is still the same round: a match id keeps its promise when a deployment has a planner key #238
Sign in to join this conversation.
new above
offline
#235 gave the bots a planner that a deployment with a
TYPESAFE_API_KEYasks per round, and the page's promise about a match id says the opposite of what that implies./still tells a player: "An id is the whole match: the same map, the same spawns, the same bots and the same seed."src/client/main.tsreads thebotplanendpoint from the page and asks it each round when this deployment has one; the answer comes from a model behindsrc/plan/typesafe.ts, cached in one process's memory in a bounded cache. So the same id, played twice — by you tomorrow, or by somebody you sent the link to — can be played by bots that took a different site, saved instead of buying, or rushed instead of holding. #174 (a match of the day, where everyone is meant to get the same bots) rests on the same promise, and #93's replay and #159's determinism net both assume the simulation is a function of the seed.The local planner (
src/plan/plan.ts) is already deterministic. This is about what happens when a key is configured.Done looks like
- a seeded or pasted match plans locally, and only a fresh match asks the model; or - the plan is part of the match — asked once, recorded with it, and replayed from the record rather than re-asked; or - the question is keyed by the match id and round, and the answer is persisted (not an in-memory cache), so the same id asks once ever and every later playing reads it.
Files I expect to change
src/client/main.ts,src/plan/typesafe.ts,src/plan/situation.ts,src/server.ts, possiblysrc/db.tsif a plan is recorded with a match,src/pages/game.ts(the sentence), and the tests beside each.Risks
src/db.tsalready migrates one column and has a test for a database written before identities existed — follow that pattern rather than inventing a second.Suggested: Vesper — it is the match's promise and the round's feel, and the fix has to keep both.