Baltor Get started

Gallery / Godot components

Boids flocking with a spatial hash

In your harnessGodot componentMIT

Simulate a 2D flock with separation, alignment and cohesion over neighbors found through a uniform spatial hash, with speed and force limits and optional wrapping bounds.

Files, names only

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

Full files in your harness.

What it takes and gives

Class
BaltorFlock, extends RefCounted
Methods
add_boid(position: Vector2, velocity: Vector2 = Vector2.ZERO) -> int; get_count() -> int; get_positions() -> PackedVector2Array; get_velocities() -> PackedVector2Array; neighbors_of(index: int) -> PackedInt32Array; steering_of(index: int) -> Vector2; step(delta: float) -> void
Placement
res://baltor/godot_components/boids_flock/

Limits. Positions and velocities live in the flock object; drawing them (for example with a MultiMeshInstance2D) is up to you. GDScript cost grows with neighbors per boid; hundreds of boids are practical, thousands need a compute approach. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.

Details

Kind
Godot component
Engine
Godot 4.3 or later
Files
11 files, 77.6 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, headless
Checks
godot parse check only, godot gdscript tests, godot tests reject gutted component, godot editor import, godot contract reflection, godot readme usage compiles
Techniques
Reynolds boids (separation, alignment, cohesion), uniform grid spatial hashing, synchronous snapshot update
Tags
boids, flocking, crowd, ai, spatial hash, simulation
Identity
library.supply.creative_originals.95a8323cf1cf56f8d1794733.0da676522640989c
Version
0da676522640989ce85f4f7eecab6b8944e8551e3c41def8d6d214f534f85e35

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.