Frame time on a big farm: batched grass, sleeping bundles, no light probes
Measured in a real 2560x1440 window on the player's Mommy save (RTX 4090): the GPU took ~5 ms, the main thread the rest. - Grass: a fully mown sector draws only its floor (one draw, not up to six); untouched and fully mown sectors share a mow map look, so the fur pile draws them all in one instanced call per pile (GC_SECTOR_BUFFER, sector frames from a structured buffer). Grass draws 1112 -> 337 at the base, 876 -> 439 in the meadow. - Bundles: loose ones sleep when they come to rest (our gravity kept ~600 bodies awake), ones on belts skip the ground checks, and all of them are stepped from one CargoTick instead of two Unity messages each. - Belts leave a jammed line alone and only look every few steps whether it can move; splitters test distance before transforming every bundle. - Light probes off on everything (the planet has none) and the GPU Resident Drawer off: both cost CPU per moving renderer for nothing. - -demogpu N -onscreen measures frame time with one feature off at a time. Base view 17-19 ms -> 14-15 ms, meadow 14-16 ms -> 11.5-12 ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -48,6 +48,7 @@ namespace GrassCutter
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
All.Add(this);
|
||||
CargoTick.Ensure();
|
||||
if (Time.timeSinceLevelLoad > 3f) Tween.Scale(transform, Vector3.one * 0.3f, Vector3.one, 0.35f, Ease.OutBack);
|
||||
}
|
||||
|
||||
@ -65,10 +66,14 @@ namespace GrassCutter
|
||||
|
||||
float _fallV;
|
||||
|
||||
void FixedUpdate()
|
||||
/// <summary>One physics step, called by <see cref="CargoTick"/> for every bundle at once: two thousand Unity
|
||||
/// FixedUpdate messages cost more than the work in them.</summary>
|
||||
internal void Step()
|
||||
{
|
||||
if (!IsSpawned) return;
|
||||
var rb = _g.Body;
|
||||
// riding a belt or lying still: nothing below needs looking at (most of a big farm's bundles, every step)
|
||||
if (Belt || (rb && !rb.isKinematic && rb.IsSleeping())) { _fallV = 0f; _wasInGrass = !Belt; return; }
|
||||
var p = transform.position;
|
||||
|
||||
// tossed into a depot
|
||||
|
||||
Reference in New Issue
Block a user