GeosPerformance
Higher frame rates in large factories
CHANGELOG
@repo/dsp-mod-geosperformance
0.1.0
Minor Changes
-
e6f0ee0: feat: cull buildings on worker threads and draw shadow casters only in the cascades they reach
In live play the main thread, not the GPU, limited the frame rate once belts and items were culled.
- Buildings: the game culls them with a compute shader and then submits every LOD batch in the camera, depth and shadow passes even when it is empty. GeosPerformance runs the same test on worker threads, matched instance for instance against the disassembled kernel, and skips empty batches. The job starts in Update, because the game draws buildings in LateUpdate before the camera moves for the frame.
- Shadows: each caster's shadow is tested against Unity's cascade spheres, read back from the previous frame. Instances are ordered by the nearest cascade they reach, and light command buffers copy each cascade's instance count into the draw's arguments before the cascade and restore it afterwards. Unity still draws the casters, so bias and depth match. Batches whose shadows reach no cascade skip the shadow passes.
- Mouse picking: a bounding-sphere test runs before each box raycast. The game tests every collider in the physics blocks under the cursor each tick, about 7,000 in this factory.
- Animation and sign pools are uploaded up to their cursors and only after a tick, instead of in full every frame.
- Belts are culled with cached bounding spheres. Belt, item and building culling run as separate worker jobs with one wake, and waiting for them never sleeps, since Sleep(1) can stall for over a millisecond under Wine.
bench/gains a fly path, GPU and main-thread frame timing, the game's own profiler totals, method timers, per-pass GPU timing and a check that compares the culled building lists against the game's shader. -
18a106a: feat: add GeosPerformance, which draws only the belts and items on belts that the camera can see
The game draws every belt and every item on a belt across the planet in the camera pass and in all four shadow cascades. GeosPerformance culls them on worker threads against the camera view and the planet's horizon, keeps the ones whose sun shadows fall into view, and draws items more than about 120 m away (past the third shadow cascade) without shadows.
Culling starts in Update, after the frame's simulation ticks, using the previous frame's camera widened by 1.5× its last turn and move. If the camera moves past that before rendering, the frame is culled again against the current camera.
bench/holds GeosPerfBench, a plugin and scripts that load a save copy in a separate r2modman profile, drive the camera along fixed paths, and record frame times.