Skip to content

CPU spike during mowing when used alongside FS25_CropRotation and Precision Farming #29

@Squallqt

Description

@Squallqt

Mod combination

  • FS25_MoistureSystem v1.0.0.2
  • FS25_CropRotation
  • Precision Farming (Giants official)
  • Dedicated server, FS25 v1.17+

In-game symptom

CPU spikes occur during mowing when all three mods are active. Removing either FS25_MoistureSystem or FS25_CropRotation makes the spike disappear.

Spike severity scales with mower configuration — a mower with 3 working elements simultaneously produces spikes significantly larger than a single-element mower.

Code observation

MowerExtension.lua overrides Mower.processDropArea (line 61). This is called every frame, per active drop area. A 3-element mower triggers this 3 times per frame.

Each call invokes tracker:addPile(). In GroundPropertyTracker.lua (lines 255–260), when a pile already exists at a cell, addPile calls DensityMapHeightUtil.getFillLevelAtArea() for each affected grid cell to compute a volume-weighted moisture average. With GRID_SIZE = 2, a standard pass covers 4–8+ cells per call.

getAffectedGridCells() is also computed twice per processDropArea invocation — once inside addPile, once inside markAreaMowed — for the same area.

DensityMapHeightUtil.getFillLevelAtArea reads from the terrain density map (physical pile heights, engine-managed).

Hypothesis — Giants patch 1.17

"Fixed mower work areas for mowers without a defined drop area"

FS25_CropRotation hooks FSDensityMapUtil.cutFruitArea, an area-level batch call. This hook benefited from the 1.17 fix, which corrected mower work area geometry and reduced spurious calls — resolving a pre-existing performance issue in CropRotation during mowing.

Mower.processDropArea is a separate code path. The 1.17 fix does not appear to affect its per-frame call pattern or the terrain density map reads inside addPile.

This is a hypothesis, not a confirmed root cause.

Suggested investigation

  • Replace DensityMapHeightUtil.getFillLevelAtArea in addPile with a stored accumulated volume to remove the terrain read from the per-frame hot path
  • Consider moving moisture sampling upstream to cut time rather than drop time, to align with the cutFruitArea pattern that benefits from the 1.17 fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions