Frame time on a big farm, round two: riding layer, instanced bundles

- Bundles on a belt move to a Riding layer that ignores the belts and the
  static world: every belt's catch trigger called OnTriggerStay (with a
  GetComponent) for each bundle riding it, every physics step.
- Bundles draw as instanced batches from CargoTick (their own renderers off,
  one in someone's hands draws itself), not as 2000 renderers to cull, sort
  and draw in the view and every shadow cascade.
- The main camera skips front-to-back sorting: the GPU has time to spare.
- BeltNet.Belted and DronePad.Belted are cached until the build changes;
  splitters on the host look only at their own items.

On the player's Mommy save, 2560x1440: base 14-15 ms -> 7.7 ms (~130 fps),
meadow 11.5-12 ms -> 6.8-7.5 ms (~135-145 fps).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NiemandKG
2026-11-09 20:35:35 +06:00
parent 57d0f4d31a
commit bbf73a6b96
12 changed files with 184 additions and 16 deletions

View File

@ -219,7 +219,17 @@ namespace GrassCutter
static readonly List<Port> s_ports = new List<Port>();
/// <summary>Is a belt joined to the hatch?</summary>
int _beltedVer = -1;
bool _belted;
bool Belted()
{
if (_beltedVer == BuildPiece.Version) return _belted;
_beltedVer = BuildPiece.Version;
return _belted = LookForBelt();
}
bool LookForBelt()
{
s_ports.Clear();
Ports(s_ports);