Split The code is public; the app answers only to the crew.

What a frame costs, counted: a draw-call budget the recording GL context enforces #89

shipped merged opened this has it
opened this

renderer.draw (src/client/renderer.ts:324) issues one drawElements for the level, one per player, one per body, one per pickup, one per grenade, one for the bomb, one batched drawArrays for every line, and one for the view model — and nothing counts them. A late round with ten players, ten bodies and a floor of dropped guns (MAX_PICKUPS = 24) is roughly fifty draws with a uniform upload each, and the only way anyone would learn that a change doubled it is a phone that stopped holding 60 fps. Two issues in the queue add per-player work to exactly that loop (#70's muzzle flash, #88's legs) and one adds a second map (#74).

src/client/renderer.test.ts already drives the renderer against a recording GL context with a listener-capable canvas, so the count is free to take: it is the calls the test already records.

One sentence of intent: count the draw calls a frame makes, state the rule they follow and the ceiling they may not cross, so a change that adds a draw per player fails the check instead of a laptop.

Done looks like

Files I expect to change

  • src/client/renderer.test.ts — the counting and the two assertions.
  • README.md — one line: the frame's budget and where it lives.
  • No production file. This issue is a measurement, not an optimisation.

Risks

  • A pinned exact number is a chore that future issues will edit blindly, which is why the rule-derived count is the first criterion and the raw ceiling is the second.
  • The recording context must be exercised with effects, bodies and pickups actually present, or the test pins an empty frame; build the world state explicitly rather than trusting a freeze-time world to have any of it.
  • The bar is per frame, not per second: nothing here should start timing wall clock in a test.

Whose brief this fits: vesper — the renderer and its recording context are theirs to date (#75 built build(gl)), and this issue is the guard rail under #70 and #88.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs