GridSyncOptimizer

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

This page documents the supported public API surface only. Private, internal, benchmark, test, and implementation-detail types are intentionally omitted.

Declaration

1
public class GridSyncOptimizer

Summary

Optimizes synchronization between logical ECS grid state and visual TileMapLayer.

This class implements three proven optimization strategies from Thistletide:

  1. Hash-based early exit - Skip sync if nothing changed
  2. Dirty chunk updates - Only sync changed chunks
  3. Neighborhood expansion - Mark neighbors dirty for correctness

These optimizations provide 5-10× speedup for typical placement operations.

Metadata

Namespace: GridPlacement.Godot.Addons.GridPlacement.Infrastructure

Source File: cs/Godot/addons/GridPlacement/Infrastructure/GridSyncOptimizer.cs

Assembly: GridPlacement.Godot

Type: class

Constructors

GridSyncOptimizer

1
public GridSyncOptimizer(int chunkSize = DefaultChunkSize)

Initializes a new instance of the GridSyncOptimizer.

Parameters

NameDescription
chunkSizeSize of chunks for dirty updates (default: 16).

Methods

HasOccupancyChanged

1
public bool HasOccupancyChanged(HashSet<CoreVector2I> occupiedCells)

Checks if the occupancy state has changed since the last sync.

Parameters

NameDescription
occupiedCellsCurrent set of occupied cells.

Returns

True if the state has changed, false otherwise.


SyncToTileMapLayer

1
2
3
4
public bool SyncToTileMapLayer(
    HashSet<CoreVector2I> occupiedCells,
    TileMapLayer tileMapLayer
)

Synchronizes the logical grid state to the visual TileMapLayer using optimized strategies.

Parameters

NameDescription
occupiedCellsCurrent set of occupied cells.
tileMapLayerTarget TileMapLayer to update.

Returns

True if sync was performed, false if early exit (no changes).


Reset

1
public void Reset()

Resets the optimizer’s internal state. Use this when the grid state is completely replaced (not updated incrementally).