Explain the performance overlay in the Game View (#275)
- Concepts: new paragraph Performance with a table of what each line counts. - Architecture: how the frame is measured, and that Chromium rounds performance.now() to 0.1 ms. The mean over about 30 frames smooths that out. - Development: the e2e total is now 1601.
1 parent
8460ac614c
commit
9d65087c79
3 files changed
+29
-1
No files matched your search
+10
@@ -357,6 +357,16 @@ the same number to tests. It counts **drawn** frames over the time the renderer
|
||||
idle seconds are not slow seconds, so the readout answers "how smooth is it while it moves" and
|
||||
holds its last answer while nothing needs drawing, instead of falling to zero when all is well.
|
||||
|
||||
The performance overlay of the Game tab (#275) is fed by `FrameMeter` (`editor/frameMeter.ts`,
|
||||
pure and unit tested). While playing, `World.timeSystem` is set and the world times each system it
|
||||
ticks with `performance.now()`; `PlaySession` sorts them into behaviors, physics and animation.
|
||||
`GameViewport` adds up what its `redraw` takes, and `ui/render.ts` keeps what the last
|
||||
`app.render()` took (`lastRenderTime`). Both together are *Drawing*. `Editor.tick` times itself;
|
||||
what is left of that once the systems and the game's redraw are taken off is *Editor*. The meter
|
||||
averages per frame over 0.5 s, the window of the fps readout. The released game leaves
|
||||
`timeSystem` unset, so the world runs untimed there. Browsers round `performance.now()` (Chromium
|
||||
to 0.1 ms without cross-origin isolation), which the average over some 30 frames smooths out.
|
||||
|
||||
Rules that keep it organised: `core/` imports nothing from other layers; `ui/` never sees
|
||||
assets; position exists only on scene objects; overrides are merged in exactly one place
|
||||
(`core/properties/resolve.ts`); the inspector is generated from `PropertySchema` — a new
|
||||
|
||||
+18
@@ -96,6 +96,24 @@ screen, so Balanced lets them keep up with every frame. Under Minimal they are h
|
||||
pulse glows for 0.35 s, longer than the gap between two updates, so every pulse still shows. Balanced is also what a project written before there was a
|
||||
choice plays with. The preset is saved with the project and is an undo step.
|
||||
|
||||
**Performance** (#275). The **Performance** button in the Game tab's header switches an overlay in
|
||||
the top left corner of the game view. It shows while a game runs, and only then: the frame rate,
|
||||
how many entities the world has, and where the time of a frame goes, in milliseconds per frame
|
||||
averaged over half a second:
|
||||
|
||||
| Line | What it counts |
|
||||
|---|---|
|
||||
| **Behaviors** | The behavior graphs and state machines |
|
||||
| **Physics** | The physics step and the contacts it finds |
|
||||
| **Animation** | Advancing the animations |
|
||||
| **Drawing** | Building the game's picture and handing the frame to the GPU |
|
||||
| **Editor** | Everything else the editor does in the frame: writing the run into the model, the panels, the console |
|
||||
|
||||
A dash stands for what has not been measured yet, in the first half second of a run. The numbers
|
||||
are what the main thread spends; the GPU works on after that, and its time is not in them. The
|
||||
switch is not saved and stays as it is until the page is loaded again. A released game has no
|
||||
overlay.
|
||||
|
||||
**Snapshots** (#231). *Menu → Snapshots…* lists the snapshots of the open project, newest first,
|
||||
with the local time each was made. **Create snapshot** copies the project as the server has it
|
||||
stored, under the name typed or, left blank, under the date and time; the autosave is written
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ php tests/php/accounts.test.php # the API's accoun
|
||||
# has and the web server's container has not (SKIP there)
|
||||
php tests/php/snapshots.test.php # the snapshot store (#231), the same way
|
||||
php tests/php/releases.test.php # the release store (#266), the same way
|
||||
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1596 editor checks, screenshots in /tmp/gm-e2e-*.png
|
||||
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1601 editor checks, screenshots in /tmp/gm-e2e-*.png
|
||||
GM_STEPS=20 node tools/e2e.mjs # or 1-12, or 6,20 — a subset while working on one step
|
||||
./e2e.sh start [GM_STEPS] # the same run detached, see below
|
||||
./e2e.sh status # live progress, or the last run's result
|
||||
|
||||
Reference in new issue
Block a user