Skip to main content

Performance Budget

Measures the running game's frame rate, JS heap and page load time against budgets and signals when one is breached, so the game can turn effects down. Browser only and local: nothing is sent anywhere, and nothing compiles to the RGS.

Fire Start when the game starts. The node counts frames with requestAnimationFrame and, every Sample Every (ms) (default 1000, minimum 100), publishes FPS (frames in the window divided by its length, rounded), Heap (MB) and Load Time (ms), updates Over Budget and Report, then fires Sampled. Start reads heap and load time at once, with FPS at 0 until the first sample. Stop pauses sampling and keeps the last values; Start again restarts the window and clears the breach memory.

Heap (MB) reads performance.memory.usedJSHeapSize to one decimal — Chromium only; other browsers report 0. Load Time (ms) comes from the navigation timing entry (loadEventEnd, else domComplete, else duration) and stays 0 until the load event has finished, after which it is read once and kept. A heap or load time of 0 can never breach its budget; a frame rate of 0 can.

A breach is FPS below FPS Budget (min, 0 = off) (default 50), Heap (MB) above Heap Budget (MB, 0 = off) (default 256) or Load Time (ms) above Load Time Budget (ms, 0 = off) (default 4000); a budget of 0 disables that check. Budget Exceeded fires once per breach type when it first appears in a sample, and again only after that type has recovered and breached anew. Report is { fps, heapMB, loadTimeMs, breaches }, with breaches holding fps, heap and/or load.

Everything is measured and kept in the browser: nothing is uploaded, logged to the RGS or stored. To see the figures off the device, wire Report into the Payload of a Telemetry Event and fire its Send from Budget Exceeded or Sampled. Timers and the frame loop stop on Stop and when the node is deleted. The Slot Features guide shows where this node sits among the slot feature nodes.

Inputs​

Actions​

SignalDescription
StartBegins sampling: resets the frame window, reads heap and load time, clears the breach memory. Fire again to restart.
StopPauses sampling and the frame loop; the last values stay on the outputs. Does nothing when not running.

Budgets​

DataDescription
FPS Budget (min, 0 = off) (number)Minimum acceptable FPS; a sample below it is an fps breach. Default 50; 0 turns the check off.
Heap Budget (MB, 0 = off) (number)Maximum JS heap in MB; above it is a heap breach. Default 256; 0 turns the check off. Chromium only.
Load Time Budget (ms, 0 = off) (number)Maximum page load time in ms; above it is a load breach. Default 4000; 0 turns the check off.

Sampling​

DataDescription
Sample Every (ms) (number)Sampling window in ms. Default 1000, minimum 100; changing it while running restarts the interval.

Outputs​

Metrics​

DataDescription
FPS (number)Frames rendered per second over the last window, rounded. 0 until the first sample.
Heap (MB) (number)Used JS heap in MB to one decimal (performance.memory, Chromium only; 0 elsewhere).
Load Time (ms) (number)Navigation-to-load time in ms; 0 until the page's load event has finished.

State​

DataDescription
Over Budget (boolean)true while at least one budget is breached in the latest sample.
Report (object){ fps, heapMB, loadTimeMs, breaches } — breaches lists fps, heap, load currently over budget. Wire into Telemetry Event's Payload.

Signals​

SignalDescription
Budget ExceededFires once per breach type when it newly appears — twice if two types breach in one sample; re-fires only after that type recovers.
SampledFires after every sample, once the metrics and Report are updated.

Usage​

  1. Add Performance Budget and fire Start when the game starts.
  2. Set the three budgets for your target device, or 0 to ignore one.
  3. Wire Budget Exceeded into the logic that lowers quality — fewer particles, no blur, a static background — and read breaches from Report to pick which.
  4. Wire FPS and Heap (MB) to a debug overlay in the editor preview while tuning.
  5. Fire Stop while the game is paused or hidden.
caution

Browsers stop delivering requestAnimationFrame callbacks to a hidden tab, so FPS falls to 0 in a background tab and an fps breach fires. Treat it as noise, or Stop while hidden.