Systems & toolingNewWave director for action games

Who comes, how many, from where and when, over a run’s clock.
Who comes, how many, from where and when, over a run’s clock: a crowd curve as a share of the device’s cap, groups that arrive from just past the edge of the view on every side, named phases with their own mix of kinds, timed surges that close in as a ring, and set pieces from a chosen side. Headless and seeded, so the same seed plays the same run; it spawns through a callback and says what happened as events for banners, sounds and the live region.
What it costs a frame
- GPU
- not used
- CPU, median
- 0.51 ms
- CPU, 95th pct
- 0.97 ms
- Draw calls
- 0
- Weight
- Moderate
Measured 21 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged CPU 0.50–0.53 ms). What ran: Alone, from 2:00 at 1× with a cap of 300 (the busiest stretch, a surge and a heavy arrival in it): the director’s update each frame, the demo’s plain crowd count, and the spawn marks and timeline drawn in Canvas 2D. Phones: tiers are being measured next.
How steadily it runs on RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference
- Typical frame ?
- 16.86 ms
- 1% low ?
- 54 fps
- Varies by ?
- ±0.48 ms
All metricsRTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference
Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.
Frames
- Median (p50) ?
- 16.86 ms
- p95 ?
- 17.75 ms
- p99 ?
- 18.25 ms
- Slowest ?
- 18.96 ms
- Mean ?
- 16.88 ms
- Standard deviation ?
- 0.48 ms
- 1% low ?
- 54 fps
- 0.1% low ?
- 53 fps
- Hitches ?
- 0 of 600
- Over budget ?
- 0 of 600
Main thread
- Long tasks ?
- 0
- Long frames ?
- 0
- Event-loop delay ?
- 0.1 / 0.9 / 1.2 ms
Input
Memory
- JavaScript heap ?
- 35.6 → 36.0 MB
- Growth ?
- +0.39 MB
Browser
- JavaScript a frame ?
- 0.66 ms
- All tasks a frame ?
- 1.18 ms
- Layout / style ?
- 0.04 / 0.01 ms
- Main thread busy ?
- 7%
Garbage collection
- Collections ?
- 28 (28 minor, 0 major)
- Pauses ?
- 12.2 ms in all, longest 1.6
What it needs
- Renders with
- Canvas 2DA 2D canvas: every current browser.
- Your browser
- Runs hereNo WebGPU needed
- Depends on
- NothingNo other packages
- With an agent
install("wave-director")Your coding agent reads its pitfalls and installs it through the library’s MCP server. Set it up
What it’s for
- Swarm and survival games where the crowd builds over a run
- Tower defence and arena waves with named phases
- A boss or set piece at fixed times on the clock
- Pacing a run to a device’s budget (fewer on a phone, the same shape)
- Replays and balance tests that need the same run from a seed
Pitfalls, in brief
- Pass the real number alive every update: the director stops sending groups at the curve’s share of the cap and counts its own spawns within a step only.
- The cap is the device’s budget, not the design’s: give the phone tier a smaller cap and the run keeps its shape (the curve is a share).
- Groups arrive
beyondpast the view radius. - Surges and set pieces may push the crowd above the curve (never above the cap).
- Step it on the game’s fixed clock, not the frame’s dt, and with the same calls, or two runs from the same seed differ.
2 more in brief
- Set-piece times must be in order. startAt skips set pieces and surges already past, and announces the current phase again on the next update.
- Events are pushed each update into the array you pass: clear it after handling, and say them in words as well as with sound (the live region, a banner).
Where it comes from
From another of the maker’s apps. Fully custom code.
Tommy Ettinger, mulberry32: The small seeded generator, a public-domain algorithm. The algorithm, not code.


