Swarm
Swarm cohesion (avg dist to center)
—
Consensus (velocity alignment)
—
Active comm. links
—
✓ High consensus — most agents have converged on a shared heading toward the goal, purely from local neighbor communication.
How it works

Each agent only "sees" other agents within its communication radius R — there is no central controller. Every agent updates its own velocity from four local terms: pull toward its neighbors' average position (cohesion), match its neighbors' average heading (alignment, the MARL-style consensus term), a short-range repulsion so agents don't collapse into one point (separation), and a pull toward the shared goal. A noise term models exploration versus exploitation, as in policy-gradient MARL.

N(i) = { j : |x_j − x_i| < R }              (local communication only)

Δv_i = w_c · (x̄_N(i) − x_i)                  cohesion
     + w_a · (v̄_N(i) − v_i)                  alignment / consensus
     + w_s · Σ_{j∈N(i), d<r_s} (x_i−x_j)/d²   separation
     + w_g · normalize(x_goal − x_i)          shared-goal attraction
     + w_n · ξ,  ξ ~ noise                    exploration

v_i ← clamp(v_i + Δv_i·dt, v_max)
x_i ← x_i + v_i·dt
  • Agent count — how many independent agents are active in the swarm.
  • Communication radius R — how far an agent can perceive neighbors; small R keeps coordination purely local, large R approaches a fully-connected, easier-to-align swarm.
  • Coordination strength — scales the cohesion + alignment weights w_c, w_a — how strongly agents trust their neighbors' consensus.
  • Exploration noise — scales w_n; high noise keeps agents exploring independently and consensus stays low even with a strong policy.

This mirrors decentralized multi-agent reinforcement learning (MARL): no agent has global state, yet a shared objective still emerges from local rules — the 2D top-down view here makes the local-only communication links directly visible as lines between nearby agents.