Traffic by message type
Event log
The framework
Every drone runs the same software. Nobody is told which layer to be in: each drone works it out from what it has, or hasn't, heard recently. A higher layer overrides a lower one whenever it's available, so losing the radio makes the swarm slower, never useless.
Layer 3 · Coordinator plan
When links are good, one node computes a globally optimal assignment (Hungarian algorithm) and broadcasts a PLAN five times a second.
Active while a plan is younger than the plan timeout.
Layer 2 · Peer claims
No plan, but neighbors are audible. Each drone bids on its cheapest target with a CLAIM. Lowest cost wins; ties go to the lower ID.
Active while any peer was heard within the contact timeout.
Layer 1 · Solo
Nobody is audible. The drone chases the most urgent enemy its own camera can see, and otherwise patrols its home slot.
Always available. The last line of defense.
Six rules
- Roles are emergent, not assigned. Identical code everywhere; the layer and the coordinator role follow from what each node hears.
- The coordinator is the lowest ID heard recently. No voting rounds. The ground station is ID 0, so it wins whenever it's reachable. If it goes silent past the leader timeout, the next lowest ID takes over automatically. When a lower ID reappears, the stand-in steps down.
- Share observations, not conclusions.
OBScarries what a drone's own camera sees, with a timestamp, so everyone can build the same picture. - Deterministic tie-breaks. Everyone applies the same rule to the same claims, so agreement needs no extra round of messages.
- Act first, reconcile later. A drone announces and moves on a new target immediately. Two drones briefly chasing one target costs less than everyone hesitating.
- Fast loops stay local. Steering runs on board. The radio only carries decisions, never stick commands.
Messages
| Type | Sent by | Meaning | Size | Relayed |
|---|---|---|---|---|
STATE | everyone, 5 Hz | My position, velocity, target, layer. Doubles as a heartbeat. | 17 B | up to TTL |
OBS | anyone seeing enemies, 5 Hz | What my own sensor sees right now. | 10 + 7 per enemy | up to TTL |
CLAIM | drones with a target, 5 Hz + on change | "I'm taking target T at cost C." | 12 B | max 2 hops |
RELEASE | the drone that intercepts | "Target T is done, forget it." | 11 B | up to TTL |
PLAN | coordinator, 5 Hz | Assignment for every known drone, plus position cues for assigned targets. | 10 + 2/drone + 7/target | up to TTL |
ELECT | a node that just became coordinator | "I'm coordinating now." | 9 B | up to TTL |
Every message carries origin, sequence number, timestamp and TTL (9-byte header). Receivers drop duplicates and ignore anything older than what they already have.
What v0.1 assumes
- Perfect identity. Every node agrees on enemy IDs. Real systems must solve data association; this is the next milestone.
- Hand-written policy as a stand-in. The cost function and assignment in
js/policy.jsstand in for the trained model. The comms layer only calls three functions, so a learned policy can replace them directly. - Flooding relays. Simple and robust, but bandwidth grows quickly with swarm size. Smarter routing is on the roadmap.
- Flat 2D world, simple dynamics, synchronized clocks, symmetric links.
- Interception is a tag: getting within 12 m of an enemy.
Experiments to try
1 · How long is the coordination gap?
Run Clear skies and press Kill coordinator. Drones turn amber (Layer 2) after about 0.6 s, then D1 takes over at about 1 s and they turn blue again. Try changing the timeouts and watch the gap change.
2 · Split brain
Lower Drone radio range to about 130 m and Ground station radio to about 200 m. As drones chase outward, the network splits and a second coordinator appears (e.g., GS + D2). When the groups meet again, the higher ID steps down.
3 · What does coordination buy?
Compare Clear skies with Total blackout over a few waves. Watch the average response time and the breaches. In headless runs: about 0.3 s versus 1.4 s response, and about 0% versus 7% breaches.
4 · Relay hops versus bandwidth
Move Relay hops between 1 and 5. More hops reach drones far from the coordinator, but messages per second climb steeply. Where is the sweet spot?
5 · Fighting through interference
Pick the Move zone tool and drag the zone over the incoming wave. Drones that chase into it lose the plan and fall back, then rejoin as they leave.
6 · One drone per target, or two?
Change Max drones per target. Doubling up wastes drones but beats evasive enemies. This is the trade-off a trained policy should learn.
Roadmap
- v0.2 Track identity: drones name tracks themselves and merge duplicates (data association).
- v0.3 Policy plug-in: load a trained model (e.g., ONNX or TensorFlow.js) in place of the hand-written policy.
- v0.4 Smarter relaying: gossip and a per-drone bandwidth budget instead of flooding.
- v0.5 Dataset export: log every message and decision as JSON for ML training.
- v0.6 Learned communication: agents learn what to send, compared against this hand-designed protocol.
- v0.7 3D world and realistic flight dynamics.
Changelog
- v0.2.1 Viewer games updated to the current rules (a 2-tick deadline), plus a formation D cannot win.
- v0.2.0 Added the Simplex Game viewer: watch recorded games in 3D, scrub through ticks, and record a video for slides.
- v0.1.0 First release: three-layer fallback, implicit lowest-ID election with step-down, peer claims, TTL flooding, interference zone, five scenarios, and an inspector showing each node's private picture.