The forest's mobs and the glide on the main thread (2026-12-01, branch perf/mobs-glide)
Measured with Tools/Dev/Quest-Perf.ps1 (Quest performance in Docs/Development.md) on staging's world (protocol 80, the
DEV test account), the Quest 2 (10.0.1.108, profile quest2) and the Quest 3 (10.0.1.139, profile quest3); the
desktop (Radeon 890M, 1280 × 720, --quality quest2, --xr-mode off) with the same flags. Two places: the forest
(--fly 3 --goto -320,1080 --walk 1: 139 wolves in the active cells) and the glide (--fly 300 --goto 150,40 --walk 1 --glide; on a desktop --glide is a level dev flight at the VR test glide's speed, new). The "before" of the headsets are
2026-12-01-quest2-town.md's runs (the same places, the same build but this branch's changes).
Where the main thread's time went (before)
PerfProbe has finer parts now (plates, sky, head, tail, mobs, mob_lod, entity_create, terrain_block,
terrain_ground_mesh, terrain_props, terrain_tile, terrain_plan, ground_add, mob_model_load, mob_crowd_mesh)
and probes_slow counts the times a part took over 3.5 ms at once (a hitch).
Forest, per frame (ms): the Quest 2 with every mob shown (q2b): the creatures' poses 23.7, the mob views'
smoothing 5.3 (each moving its ~70-node puppet), Main's own 3.0, the rest of the scripts ~21 (Godot's transform
notifications and the 139 nameplates turning to the eyes), the render thread 5.8 (1 092 draw calls): 20 fps, GPU 29 %.
The desktop, the same: creatures 4.9, views 2.3, nameplates 0.26, 821 draw calls, 9 710 nodes: 16.8 ms a frame (59 fps);
with the mobs hidden 2.2 ms. Per mob: ~0.17 ms of poses and ~8 draw calls on a Quest 2.
Glide (desktop, 30-40 s): no steady cost (main 0.8 ms) but hitches: main over 3.5 ms 130-170 times. Their parts: a
block's ground mesh (AddSurfaceFromArrays: up to 4.3 ms, the arrays' conversion 1.9 more; 18-21 times), the first block
of each kind of prop (24 ms once: the primitive meshes built on first use), a mob of a new species (its model read: 37-40 ms,
then its view 50 more), the clouds (0.5 ms every frame: one renderer call per puff). On the Quest 2 the same were 25-110 ms
(terrain worst 108, entities 216): 7.6 stale frames a second. No physics: the terrain has no collision shapes (the
collisions are Obstacles and the heights, pure functions), nothing to cut there.
What changed
- The mobs' level of detail (
Client.Core.MobLod, The mobs' level of detail inArchitecture.md): near (12 nearest within 22 m, and every mob fighting within 45 m) posed every frame with its nameplate; mid (within 45 m, fighting within 100 m, or within its attack's reach of the eyes + 5 m) posed one frame in 3, no nameplate; far: drawn byMobCrowd, the species' model at rest in one mesh, one draw call a species, its node never moved, its puppet never built, its nameplate never built. No mob is hidden: the Quest 2'smobRadius(40 m) is removed (not kept as a far limit: a far mob costs a few floats in a buffer now). The mob views are ticked byWorldSyncat their tier's rate. - The glide: a ground mesh's surface encoded on the worker in Godot's own byte format (
GroundSurface, checked byte for byte against Godot at start, else the old way):ground_add4.3 → 0.6 ms on the desktop; one block or far tile a frame; the terrain planned 1.5 s ahead along the velocity (≤ 64 m); the prop meshes built at start; the clouds placed one frame in 3 (0.45 → 0.16 ms desktop, 0.63 on the Quest 2); the biomes' mobs' models and far meshes read behind the loading screen (then on a worker thread: see below).
After
| Place | Device | Before | After | Draw calls | Stale frames/s | GPU at full clock |
|---|---|---|---|---|---|---|
| forest | Quest 2 | 19.9 fps (all mobs) / 72.4 (mobs hidden past 40 m) | 72.4 fps, no mob hidden | 1 092 → 123 | 55.9 → 0.5 | 73 % |
| forest | Quest 3 | 25.2 fps | 72.5 fps | 1 266 → 494 | 49.0 → 0.4 | 74 % |
| glide | Quest 2 | 69.2 fps | 70.0 fps | 69 → 75 | 7.6 → 4.7 | 60 % |
| glide | Quest 3 | 69.7 fps | 71.2 fps | 69 → 73 | 6.8 → 3.8 | 58 % |
| forest | desktop | 59 fps (16.8 ms) | 277 fps (3.6 ms) | 821 → 175 | ||
| glide | desktop | 1.83 ms, p99 4.2, 130 hitches | 1.93 ms, p99 3.6, 48 | 91 |
The forest's main thread on the Quest 2 now (ms a frame): mobs 5.1 (views 3.0 of it, poses of the near and mid 1.9), the
whole Main 7.5; nodes 10 211 → 2 489. Files: 2026-12-01-mobs-glide-*.json (mg3-q2-*, mg2-q3-forest, mg3-q3-glide:
the headsets; desktop-*: the desktop before and after).
Not done, risks
- The glide is not at 72 fps (70.0 / 71.2). What is left: a mob of a new species met in flight (its model 30-36 ms and
its far mesh 19-29 ms on a Quest, 2-3 times a run): in these runs the loading screen is skipped (
--waittest logins), so the pre-read was not finished; behind a real loading screen it is. And a part ofMainbefore the terrain (head: the sounds, the own body, the voice...; worst 34-37 ms, ~20 times a run) not looked into. The GPU is not it (58-60 %). - Props for far chunks are not deferred while flying fast (planning ahead and one block a frame were enough for the terrain's hitches: 27 → 2-5 a run).
- A far mob is drawn with the first choice of each part of its species (not its own horns or weapon) and at rest: its look changes a little at 45 m. Hit flashes and warning colours show only from mid distance (fighting mobs are near).
- The forest's 139 mobs are by design:
WorldGen.MobSpawnsgives exactly 139 in those 25 cells (a dense forest: packs of 3 wolves, 2 spawn points a 64 m cell). The server's "call for help" reinforcements have no lifetime (at most 8 a summoner) and could pile up where players fight a lot: not seen here, not changed.
Then: the glide's last spikes, the trees idea, a dungeon (the same day, the owner's follow-up)
PerfProbe splits Main's start (h_platforms, h_splash, h_sounds, h_ownbody, h_stream, h_voice, h_social,
h_space, h_fall), and --perf-run's report has the garbage collector's counts, pauses and the memory allocated
(gc_collections, gc_pause_ms: 0 on a Quest, its Mono runtime does not tell; allocated_mb).
The ~35 ms spikes in Main before the terrain (mg4/mg5-q2-glide): the voice (h_voice, 34 times over 3.5 ms in a
pass, up to 80 ms). Not Opus (0.6 ms at most): reading the microphone's capture (AudioEffectCapture.GetBuffer) waited on
the audio thread, up to 17 ms at a time. The microphone is now read every 10 ms on its own thread (the detector and Opus
with it), the slices handed back to the main thread to be sent: h_voice ≤ 0.4 ms (mg6).
A species met in flight: its model was read on the main thread (30-40 ms on a Quest, then 20-30 for its far mesh). The
models are now read on a worker from the start (MobModels: the 20 species in 4.4 s on a Quest 2, in 0.8 s on the
desktop), with their far meshes' arrays; a mob whose model is not read waits out of sight. The test runs are covered too
(no loading screen needed). The crowd's two shaders are compiled at start (the first far mob's material took 60 ms).
The garbage collector: a 30 s glide allocated 711 MB on the desktop (21 full collections, 194 ms of pauses), most of
it the terrain's big arrays: on a Quest (Mono) a full collection stops every thread, a lost frame no probe shows. A block's
ground is now merged and encoded in one pass (no merged arrays), the encoded bytes and the far tiles' arrays come from a
pool of exact lengths: 224 MB, 4 full collections, 136 ms (desktop-glide-gc-*). On the Quest 2: 137 MB in 45 s, 7 full
collections (mg7-q2-glide).
The owner's idea, trees from a shared model while moving fast: not done. The profile shows the props are not the cost
in a glide: terrain_props (a block's multimeshes made and filled) at most 1.4 ms on the Quest 2 (mg4), never over
3.5 ms in a pass, after their meshes are built at start. A pool of shared trees would save under a millisecond a block at
the price of a swap to the real ones; the "prepared on workers, one block a frame" way is the one kept.
| Glide | Quest 2 fps | stale/s | Quest 3 fps | stale/s |
|---|---|---|---|---|
| before this branch | 69.2 | 7.6 | 69.7 | 6.8 |
first pass (mg3) |
70.0 | 4.7 | 71.2 | 3.8 |
+ voice on its thread, models on a worker (mg6) |
71.4 | 3.3 | 71.0 | 2.1 |
+ the terrain's arrays pooled (mg7) |
71.6 | 3.4 | 71.3 | 2.2 |
Forest at the end (mg7): Quest 2 72.1 fps (1.1 stale/s), Quest 3 72.4. The glide is still not at 72: what is left
does not show in the main thread's probes (its mean 2.6 ms on the Quest 2): the 7 full collections of 45 s (the chunks' own
arrays and the props' lists are still allocated), and a few stale frames a second whose cause is not in the scripts (the
render thread, the compositor: not looked into).
A dungeon, offline (--dungeon-preview 0: range 10-20, the world's seed 1234, 50 mobs in 12 caverns; idle)
The preview shows its mobs at the game's tiers now (MobLod, a MobCrowd) and --perf-run measures it offline.
| Where | Quest 2 | Quest 3 |
|---|---|---|
| the entrance | 72.5 fps, GPU 71 % at full clock (10.9 ms), CPU 12 %, 4 draw calls, 26 k triangles | 72.4 fps, GPU 58 %, 4 draws |
the champion's hall (--dungeon-champion) |
72.5 fps, GPU 94 % (13.1 ms), 36 draws, 43 k triangles | 72.4 fps, GPU 84 %, 38 draws |
the 50 mobs all posed every frame (--mob-lod near) |
72.6 fps, their poses 3.4 ms a frame (0.07 ms a mob, feet placed) | 72.3 fps, 1.4 ms |
The dungeons' mobs per range (DungeonMap, seed 1234 / 0): 10-20: 50 / 42, 20-40: 47 / 50, 40-80: 44 / 47, 80-150: 48 / 47,
all creatures (no slimes), the champion a goblin (the preview has no goblin model: a box). The hall's fight (every mob
rallied there, all fighting within 45 m: all at the near tier): ~50 puppets posed every frame, 3.4 ms on the Quest 2, their
views ~1 ms, their 50 nameplates ~0.7 ms, ~400 draw calls (~8 a mob: ~2 ms of render thread, as the forest's 1 092 cost 5.8):
~7 ms more on the CPU side, which a Quest 2 has (its main thread ~1 ms there). The GPU would not: the hall is already at
94 % of the Quest 2's GPU with nothing in it, and 50 puppets (~3-5 k triangles each in sight) add a quarter more: expect
~55-60 fps on a Quest 2, around 65-70 on a Quest 3. Two ways when the dungeons come back: cap the near tier for the
fighting mobs (the 16 nearest whole, the others mid: animated, no nameplate; one line in MobLod), and look at what makes
the empty hall cost 13 ms of GPU (its lantern light and fog over the whole screen, likely).
Follow-up 3 (the owner validated everything; the Quest 2 first, the Quest 3 as a control)
Files: *-mobs-glide-d8-* (the hall's parts, the old build), *-f9-*, *-f10-* (this build), desktop-glide-gc-pooled.
1. Entering the world waits for the startup preload
Client.Core.StartupPreload: one gate for everything prepared off the main thread from the start (today the mobs' models,
MobModels, registered with their count); Main.WorldReady (the character screen's Play, an automatic login, a
reconnection) waits for it, and while it runs the loading screen says "Preparing creatures… 14/20" (loading.creatures, en, fr,
de, nl). Usually done long before (4.4 s from the start on a Quest 2): no wait. Tested (StartupPreloadTests).
2-3. The dungeon: the fight's cap and the hall's GPU
What costs the empty champion's hall 13 ms of GPU on a Quest 2 (--dungeon-off, one part off at a time, d8):
| Hall (Quest 2) | GPU at full clock | GPU ms |
|---|---|---|
| as it was | 95.8 % | 13.2 |
| no glow | 94.0 % | 13.0 |
| no fog | 95.9 % | 13.2 |
| no lantern | 95.3 % | 13.2 |
| no caverns' lights | 57.9 % | 10.2 |
Not the fog nor the glow: the caverns' lights. The mobile renderer gives each cave mesh every omni light whose range
touches it, and every pixel pays them all; the caverns' lights reach far into their neighbours. Now (dungeonLightRadius,
30 m on the Quest 2's profile) only the lights within 30 m of the eyes are on, faded in and out: the hall keeps its own (the
same picture as before), the others go out. Hall: 95.8 % → 79 % (f9-q2-hall).
The fight: at most 16 fighting mobs near (MobLod.MaxFightingNear), the others mid. --dungeon-rally puts the
dungeon's 49 mobs (and the champion) in the hall, fighting (goblins and slimes as the game's views now: the preview drew its
goblins as boxes):
| Rally in the hall | fps | stale/s | GPU at full clock | CPU | mobs' poses + views + plates |
|---|---|---|---|---|---|
Quest 2, all lights (d8-q2-rally) |
72.6 | 0.3 | 93 % | 23 % | 2.3 + 0.4 + 0.24 ms |
Quest 2, lights within 30 m (f9-q2-rally) |
72.7 | 0.1 | 72 % | 23 % | the same |
Quest 3 (its profile: all lights) (f9-q3-rally) |
72.4 | 0.1 | 85 % | 18 % | 0.4 ms of Main |
The headset lay on a table: what it looked at is not the same from run to run (14 draw calls in the rallies, 176 in the empty hall), so the GPU's figures there are the hall's walls and lights more than its mobs. With every mob in sight: +~150 draw calls and ~120 k triangles (the empty hall's 176 calls and 143 k triangles had them in the far crowd) on a GPU at 72-79 %: still under the Quest 2's limit by the estimate of the forest (1 092 draw calls for 5.8 ms of render thread). The Quest 3 could take the light radius too (85 % there): left for the owner.
4. The glide
Allocations (the full collections stop a Quest's threads): the chunks' ground arrays from a pool (given back a few seconds
after the chunk is dropped), the props' buffers from a pool of power-of-two sizes (the multimesh holds that many, draws its own);
the report gives the megabytes per part (allocated_by_part_mb). Desktop, 30 s: 228 → 141 MB, full collections 7 → 1
(the chunks' ground 126 → 16 MB). Quest 2, 45 s: 137 → 36 MB, full collections 7 → 2.
The frames that came late without the main thread being late: the headset's own lines (VrApi) showed the Quest 2 keeping
its CPU at clock level 2 of 5 in a glide (the mean load is low: the system does not raise it) and its GPU at 3-4; the late
frames came when a block or a spike came before the clock rose. The quality profile can now ask a floor through OpenXR
(cpuLevel, gpuLevel; XR_EXT_performance_settings):
| Glide, Quest 2 | fps | stale/s | CPU level seen |
|---|---|---|---|
before this follow-up (mg7) |
71.6 | 3.4 | 2 |
the pools (f9-q2-glide) |
71.3 | 3.4 | 2-3 |
+ cpuLevel=3 sustained high (f9-q2-glide-cpu3) |
71.9 | 2.5 | 5 |
+ gpuLevel=3 (f10-…-c3g3) |
71.6 | 3.5 | 5 (the GPU stayed 3-4) |
cpuLevel=4 boost, gpuLevel=3 (f10-…-c4g3) |
71.8 | 3.1 | 8 |
Kept: cpuLevel 3 in the Quest 2's profile (the Quest 3's untouched: its glide 71.0 fps, f9-q3-glide). The GPU's level
asked is not held by the system. Forest with all of it, Quest 2: 72.3 fps (f9-q2-forest).
Still not 72 in the glide (71.9 on the Quest 2, 71.0 on the Quest 3): two full collections left in 45 s, one mob's view made in
20 ms (entity_create), and ~2 late frames a second the scripts do not explain (the main thread at 2.3 ms on average, the
GPU at 65 % at full clock). What is left is in the renderer's own frame (Godot's Mobile renderer drawing on the main thread
after the scripts, a frame of CPU+GPU of 16-18 ms by VrApi against the 13.9 of 72 Hz): not something the game's code
shows; the next step would be Godot's own render thread (rendering/driver/threads/thread_model) or Meta's OVR Metrics tool.
Follow-up 4: the caves' lights on the Quest 3, the savings brought to the PC
A regression found on the way, fixed: since the startup preload (follow-up 2), the PC's profile crashed on Chopper's Radeon
890M once in the world (Can't create buffer … VkResult error -10, then a segmentation fault; the branch's base: no error).
Bisected to the preload: the 20 mob models' whole scenes made at start (~1 500 meshes, every variant of every piece) plus the
sun's shadows went past the driver's Vulkan allocations. Now the preload makes nothing of the renderer's: each file is parsed on
the worker and the far crowd's mesh and the model's height are baked from the parsed file, on the CPU (MobModels,
MobCrowd.BakeArrays); a species' whole scene is made when its first mob comes near (3-10 ms on the desktop, once). The PC's
profile then runs without an error (forest, town, glide, dungeon). Also fixed: Quest-Perf.ps1's flags file was merged with
the export's flags (an export's --glide or --quality-set went on in later runs: some forest runs of follow-ups 2-3 were
measured with the glide's hook on, mg7-q2-forest, f9-q2-forest); the file is now the whole run.
The caves' lights on the Quest 3 (30 m, the same fade)
| Champion's hall, rally (49 mobs fighting) | fps | GPU at full clock | GPU ms |
|---|---|---|---|
Quest 3, every light (f12-q3-rally-all) |
72.4 | 85 % | 11.6 |
Quest 3, lights within 30 m (f12-q3-rally) |
72.4 | 56 % | 6.0 |
Quest 2, lights within 30 m (f12-q2-rally) |
72.6 | 72 % | 10.7 |
Every Quest-only setting: brought to the PC, or kept
The code's savings were never gated on a device (the mobs' levels of detail and crowd, the ground encoded on the workers and the pools, one block a frame, the planning ahead, the clouds one frame in three, the voice's thread, the models prepared at start, the 16 fighting mobs near): the PC has had them from the start. The quality profile's settings:
| Setting (Quest's value) | PC | Why |
|---|---|---|
buildingBackFaces false |
applied | no visible change (town and plaza pictures, img/2026-12-01-pc-houses-diff.png: only the clouds, the column of light and the mobs moved) |
dungeonLightRadius 30 |
applied as 105 m | the dungeon's fog is opaque at 60 m and a cavern's light reaches 42 m at most: past 105 m a light lights nothing seen; the hall's picture is the same pixel for pixel (img/2026-12-01-pc-hall-diff.png). 30 m would darken caverns seen at 30-60 m: not on a PC |
nearRadius, propRadius, smallPropRadius, lowPropRadius |
kept | the view's distance and the trees' detail |
shadowDistance, shadowSplits, terrainShadows, propShadowRadius |
kept | the shadows |
litePlaza |
kept | the plaza's paving is simpler |
cloudDetail 0.5 |
kept | rounder clouds on a PC |
farQuads 16 |
kept | the far land's shape |
townRadius 500 |
kept | the fog closes only at ~4 km: the town is seen from afar |
renderScale, foveation, msaa |
kept | a headset's own (the PC: 1, 0, 2) |
streamCamera false |
kept | a feature (no window on a headset), not a saving |
cpuLevel 3, gpuLevel |
kept | a Quest's clocks (OpenXR) |
dungeonGlow |
(true everywhere) |
The PC measured (Chopper's desktop, Radeon 890M, 1280 × 720, the pc profile, the camera turning 18° a second): the
branch's base (795771f3, before any of this) against now.
| Place | Base | Now |
|---|---|---|
| town | 174 fps (5.8 ms, p99 9.1) | 198 fps (5.0 ms, p99 5.6) |
| forest (139 mobs) | 56 fps (17.7 ms, 1 166 draw calls, 9 837 nodes) | 199 fps (5.0 ms, 350 draw calls, 2 110 nodes) |
| glide | — (the base has no desktop glide) | 410 fps (2.4 ms, p99 3.7) |
| dungeon rally, every light / within 105 m | — (new hook) | 366 / 367 fps (GPU 1.55 / 1.52 ms) |
This follow-up's two settings alone change nothing measurable on this PC (town 198.4 fps either way; the rally within a percent): they are for a weaker GPU, and they cost nothing seen.
Bug report #18: the flight tower's handrail, MeshMerge
MeshMerge.Collapse merged the tower's pieces with SurfaceTool.AppendFrom: a non-indexed piece (the ramp's handrail, a
SurfaceTool strip) merged with indexed ones of the same material (the BoxMesh beams) lost every triangle. Now each piece is
made indexed as it is merged (Client.Core.MeshMergeBuffer, MeshMergeTests: a non-indexed piece with an indexed box keeps its
triangles, in either order). Collapse is used by the flight tower only. Checked offline with the budget's fixed town
(--budget --budget-shots, quest2 profile), the east view (the tower):
| Merge | Draw calls | Triangles | The tower against --no-mesh-merge |
|---|---|---|---|
none (--no-mesh-merge) |
581 | 311 504 | — |
| the old one | 420 | 300 856 | its rails missing (img/2026-12-01-meshmerge-old-vs-off.png) |
| fixed | 420 | 310 928 | the same (img/2026-12-01-meshmerge-fixed-vs-off.png: only the clouds differ, as in every view) |
The other views (north, south, west) differ from --no-mesh-merge only by their clouds. The budget's meadow view is over its
ceiling (114 draw calls for 108) in all three runs: not the merge.