Skip to content

Stratkit Army Collision Offset System

Resolves visual overlap between armies (and between armies and province icons) using iterative AABB separation.

How it works

  1. Each visible army is treated as a square collider sized from its ColliderFixedBounds (scaled by the closest zoom level scale), falling back to FallbackRadius when the component is absent.
  2. Province centers within the army bounding box act as immovable circular obstacles.
  3. Each update schedules a chain of SeparationIterationJobs that push overlapping pairs apart along the minimum separating axis. The chain short-circuits as soon as an iteration reports no overlap.
  4. Finalized offsets are written back to ArmyVisualPosition.Offset.

Updates are throttled by a zoom-adjusted frequency (UpdateFrequencyMaxUpdateFrequency). A new separation pass is only scheduled once the previous job chain has completed.

Setup

  • Add an ArmyCollisionOffsetModule and ArmyCollisionOffsetConfig asset to your bootstrap.
  • Tune the config fields:
  • IterationCount — max separation passes per update (default 10)
  • Padding — extra gap between army colliders (world units)
  • ColliderMultiplier / MinColliderSize / FallbackRadius — collider sizing
  • ProvinceObstacleRadius — radius of the circular province repulsion obstacle
  • MaxDisplacement — max world-unit displacement from an army's base position (0 = unlimited)
  • UpdateFrequency / MaxUpdateFrequency — throttle interval at closest / farthest zoom
  • ShowDebugColliders — draws AABB and obstacle circles in the editor