Smoother drives across the meadow: no more hitches opening sectors
- Sector maps are put away on a worker thread, and trimmed in batches - A far sector's texture only needs its look; at most four new ones a frame - Fresh maps fill rows between their borders instead of testing every cell - Rocks are marked with plain numbers; marks come back on unpacked maps - Worked-overlay sort uses float keys; idle belts look on staggered steps - Chase camera cast no longer allocates; perf demo drives and runs too Drive phase on a late save: p99 33 -> 16 ms, frames over 20 ms 242 -> 7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -339,7 +339,9 @@ namespace GrassCutter
|
||||
{
|
||||
if (!Server || !Piece || !Piece.IsSpawned || Items.Count == 0) return;
|
||||
// a line that hasn't moved for a while only looks again every few steps whether the front can go on
|
||||
if (_idle > 40 && ++_idleSkip % 6 != 0) return;
|
||||
// (each line at its own step of the six: a loaded base has hundreds, and all of them looking on the same step
|
||||
// stalled that frame)
|
||||
if (_idle > 40 && (++_idleSkip + _phase) % 6 != 0) return;
|
||||
bool moved = false;
|
||||
float dt = Time.fixedDeltaTime * (_idle > 40 ? 6f : 1f);
|
||||
float step = Speed * dt;
|
||||
@ -372,6 +374,8 @@ namespace GrassCutter
|
||||
}
|
||||
|
||||
int _idle, _idleSkip;
|
||||
static int s_lines;
|
||||
readonly int _phase = s_lines++ % 6;
|
||||
|
||||
/// <summary>How far an item can go: to the turn until it has chosen, then the end of its route, and never into the one ahead.</summary>
|
||||
float Room(int i, ref float L)
|
||||
|
||||
Reference in New Issue
Block a user