โ† All examples

godot components

Formation slots with short-travel assignment

Lay out slots for line, column, wedge, circle and grid formations, rotate them to a leader's position and facing, and assign members to slots so that paths are short and do not cross.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • formation_slots.gd
  • inspect_gdscript.py
  • run_tests.gd
  • test_package.py
  • tests/test_formation_slots.gd
  • verification/native.json

How it works

Class
BaltorFormation, extends RefCounted
Methods
slot_offsets(shape: Shape, count: int, spacing: float) -> PackedVector2Array; world_slots(offsets: PackedVector2Array, anchor: Vector2, facing_angle: float) -> PackedVector2Array; assign(members: PackedVector2Array, slots: PackedVector2Array) -> PackedInt32Array; total_distance(members: PackedVector2Array, slots: PackedVector2Array, assignment: PackedInt32Array) -> float
Placement
res://baltor/godot_components/formation_slots/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • godot_parse_check_only
  • godot_gdscript_tests
  • godot_tests_reject_gutted_component
  • godot_editor_import
  • godot_contract_reflection
  • godot_readme_usage_compiles

Limits to consider

2D layouts facing +x. The assignment is greedy plus pairwise swaps, not an optimal Hungarian assignment; it is quadratic to cubic in the member count and meant for squads, not crowds. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.