The fps line of the performance overlay stops at the display's rate,
60 on most screens. It does not tell how much room a game has left.
The new top line answers that from the times the overlay measures.
- possibleFps in src/editor/frameMeter.ts is 1000 ms over the sum of
the five areas, rounded down. It has no number while nothing took
any time, and the overlay shows a dash then.
- The editor's share is in the sum, because it costs time while
playing in the editor. A released game can do a little better.
- It is an upper bound. The GPU's time is not measured and not in it.
- e2e 59e reads the lines one further down and checks the new line
against the times it measured itself.
Tests:
- Unit frame-meter: 11 passed (+2 for possibleFps)
- Gate: 197 files, 2855 tests, CHECK EXIT 0 (2853 + 2)
- e2e 59: ALL PASSED, 19 checks (+1), on melektaus-atx
- Counter-check: possibleFps without the editor's share fails the
unit test
- The e2e total of 1602 is counted (1601 + 1), not measured
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A game that stutters gave no hint where the frame goes. The Game tab
now has a Performance switch. It shows a small overlay in the top left
corner of the Game View while a game runs: fps, the number of entities
and the mean milliseconds per frame for each area, averaged over half
a second like the fps counter.
- src/editor/frameMeter.ts holds the pure rule. FrameMeter sums the
areas per frame, closes a window every 0.5 s and formats the lines.
- World.timeSystem times every system the world ticks. PlaySession
maps the systems to Behaviors, Physics and Animation and sets the
hook again after Load scene.
- Animation has its own line. Counting the AnimationSystem under
Behaviors would have skewed that number.
- Drawing is the build of the game picture plus app.render(). It is
main thread time only. The GPU work after it is not in the number,
and app.render() draws the whole canvas including the panels.
- Editor is the rest of the editor tick after the systems and the game
picture: mirroring into the model, panels and console.
- The overlay lets clicks through to the game. It shows dashes until
the first window closes. The switch is off by default and is not
saved. The released game (#266) runs without a meter.
Tests:
- Unit frame-meter: 9 passed.
- Gate on melektaus-atx: 197 files, 2853 tests, CHECK EXIT 0.
- e2e 59 on melektaus-atx: ALL PASSED, 18 checks (13 before, +5 in
59e with a real mouse on the switch). Run twice.
- Three mutations were caught: the editor share not subtracting the
systems (2 unit tests), systems running in pause not reported
(1 unit test), the overlay getting no times (59e).
- The e2e total of 1601 is computed (1596 + 5), not measured.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the behaviors fixed, the scene Performance test still ran at
about 23 fps with 500 entities. The rest of the frame went to the
editor: every spawn or destroy rebuilt the hierarchy with all its
rows, redrew the scene view behind the game tab and refreshed every
panel. The game itself is cheap. What the panels show of it now
follows a preset in the project settings.
- New section While playing in the project settings with three
presets: Live, Balanced and Minimal. Every project reads as
Balanced, including those saved before the setting existed.
- Live keeps today's behavior. Balanced brings hierarchy and panel
values up to date 4 times a second and stops redrawing the hidden
scene view. Minimal updates hierarchy and values only on pause and
throttles the graph tabs as well.
- The graph and state machine tabs stay live under Balanced. At 4
updates a second the beads on exec edges stutter, and the tabs
draw only while on screen. This differs from the issue proposal.
- The game itself is never throttled. Pause, step and stop bring
every panel up to date at once, and a change of structure that
falls between two updates is kept for the next one.
- The rule lives in editor/playThrottle.ts as panelPolicy and
PanelClock. PlaySession asks it after every frame.
- Objects spawned at the top level go into a hierarchy group named
after their asset, so hundreds of gold pieces fold into one row.
Groups start folded.
Measured on a throwaway copy of Performance test, 3 s each, fps:
- About 500 entities: Live 38.6, Balanced 56, Minimal 60.6.
- About 315 entities: Live 56.9, Balanced 60.5, Minimal 60.6.
- p95 frame time at 500 entities: 60 ms, 41 ms and 23 ms.
Tests:
- ./check.sh: 193 files, 2799 tests, CHECK EXIT 0.
- GM_STEPS=1,18,59: ALL PASSED, 54 checks.
- Full e2e run (local): ALL PASSED, 1562 checks.
- tests/editor/play-throttle.test.ts: presets, update rates, kept
structure changes, flush, spawn group and loading old projects.
- New e2e module 59: preset chosen with the mouse, measured update
rates, scene view behind the game tab, Minimal with pause.
- Module 03 now expects spawned objects in their group row after the
next update.
- Counter-checks: 4 in unit tests and 2 in the browser, each failing
as expected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>