Ruvon Swarm Studio 3D

A live demonstration of ruvon-edge agents running entirely inside browser tabs, forming coordinated 3D drone swarms with no server required.

WebGPU SharedArrayBuffer Pyodide ruvon-edge BroadcastChannel mesh PeerJS cross-device Zero servers

What you're looking at

Each browser tab runs 64 fully simulated drones under the control of a live RuvonEdgeAgent — the same Python runtime that powers payment terminals and industrial IoT gateways — compiled to WebAssembly via Pyodide.

Open multiple tabs from the same sovereign link and the tabs form a private fog network: they elect a leader, divide the formation space, and render a unified swarm with each browser contributing its own slice. Close any tab and the remaining nodes re-elect a new sovereign and recompute the fleet in under a second.

Architecture at a glance

BROWSER TAB (sovereign) BROWSER TAB (follower N) ┌─────────────────────────────────┐ ┌──────────────────────────────────┐ │ RuvonEdgeAgent (Pyodide/WASM) │ │ RuvonEdgeAgent (Pyodide/WASM) │ │ DroneCommand workflow │ │ DroneCommand workflow │ │ SwarmFormation workflow │ │ SwarmFormation workflow │ ├─────────────────────────────────┤ ├──────────────────────────────────┤ │ mesh_brain.js (Worker) │◄──────────►│ mesh_brain.js (Worker) │ │ BroadcastChannel gossip mesh │ │ gossip + election follower │ │ Sovereign election (scored) │ │ FORMATION_INTENT receiver │ ├─────────────────────────────────┤ ├──────────────────────────────────┤ │ physics_worker.js × 4 (SAB) │ │ physics_worker.js × 4 (SAB) │ │ Reynolds flocking + PID alt │ │ Reynolds flocking + PID alt │ │ Shared memory (SharedArrayBuf) │ │ Shared memory (SharedArrayBuf) │ │ ↳ fallback: inline rAF loop │ │ ↳ fallback: inline rAF loop │ ├─────────────────────────────────┤ ├──────────────────────────────────┤ │ renderer_webgpu.js │ │ renderer_webgpu.js │ │ Instanced drone mesh │ │ Instanced drone mesh │ │ LED glow + trails │ │ Ghost dots for remote squads │ └─────────────────────────────────┘ └──────────────────────────────────┘ │ BroadcastChannel (same-device) · PeerJS/WebRTC (cross-device, active) └──────────────────────────────────────────────────────────────────────►

How to use the demo

  1. Open the demo in any Chrome or Edge browser (WebGPU required). Firefox support coming when WebGPU ships in stable.
  2. Click Launch Drones. 64 drones spool up and fly to the default Ruvon-R formation. This tab is the sovereign — it controls the swarm.
  3. Copy the Sovereign Link shown in the top-left panel and paste it into a second tab or window. The second tab joins the mesh as a follower.
  4. On the follower tab, click Join Formation. The sovereign expands the fleet to 128 drones and each tab renders its own 64-drone slice of the formation.
  5. Add more tabs from the same link. Each adds another 64-drone squad. The formation math scales deterministically — no extra network traffic per drone.
  6. Try the 3D Formations panel: Sphere, Helix, DNA, Torus, Vortex, Wave, Cube.
  7. Type a command in the Command box (e.g. "form a sphere", "scatter", "land all"). MiniLM matches it to the nearest preset; complex prompts escalate to wllama/Ollama.
  8. Close the sovereign tab. The remaining tab detects the departure via GOODBYE broadcast, re-elects itself sovereign, and recomputes the fleet — all in under one second.

Key technology

🧠

ruvon-edge in the browser

RuvonEdgeAgent runs via Pyodide (CPython → WASM). The full DroneCommand and SwarmFormation workflows execute as real Python — same code that runs on hardware edge devices.

🌐

BroadcastChannel + PeerJS mesh

Tabs on the same device gossip via BroadcastChannel. Tabs on different devices connect via PeerJS/WebRTC — no signaling server needed beyond the free PeerJS cloud. A scored capability-vector election picks the sovereign; FOUNDING_BIAS + stable pod_id prevent split-brain.

SharedArrayBuffer physics

Four Web Workers share a SAB (64 drones × 16 f32 = 4 KB). Reynolds flocking + PID altitude run in parallel threads with zero serialization overhead. When SAB is unavailable (non-isolated context), physics falls back to an inline requestAnimationFrame loop on the main thread.

🎮

WebGPU renderer

Instanced drone meshes with LED glow, motion trails, and rotor animation. Ghost dots show remote squads. The camera is fully independent per tab — orbit, zoom, pan freely.

🔢

Deterministic sync

Formation changes broadcast a seed + preset name (not coordinates). Each tab independently computes its own index slice using mulberry32 PRNG — bitwise-identical in JS and Python.

📦

Instant Pyodide warm-up

The full Pyodide runtime (~35 MB) is bundled as same-origin static assets in pyodide-cache/. A cache-first service worker stores everything on first load — subsequent page refreshes skip the network entirely and boot in under 2 s.

🌿

92% less CO₂

Computation stays on the device. No round-trips to a cloud inference server. The green energy estimate in the HUD is calculated from active drone count and idle power displacement.

Sovereignty election

Every tab runs a gossip heartbeat every ~2 s, broadcasting a capability vector (battery, CPU load, RAM, task queue). The mesh scores all pods and elects the highest-scoring one as sovereign.

How split-brain is prevented

Sovereignty transfer

When a follower is elected sovereign it:

  1. Resets its slot to 0 (sovereign is always slot 0).
  2. Adopts all currently flying pods as active fleet members.
  3. Rebroadcasts the current formation with the corrected slot map.

ruvon-swarm package

The Python workflow logic is packaged as ruvon-swarm — a local wheel bundled with the demo and installed inside Pyodide at startup via micropip. It provides:

# The wheel is served alongside the demo — no PyPI installation needed
# pyodide_worker.js installs it automatically at startup:
await micropip.install("./ruvon_swarm-0.1.0-py3-none-any.whl")

Run locally

git clone https://github.com/KamikaziD/ruvon-swarm
cd ruvon-swarm/examples/swarm_studio
python serve.py          # serves on http://localhost:8080

The local server adds the COOP/COEP/CORP headers required for SharedArrayBuffer. The full Pyodide runtime is bundled in pyodide-cache/ and served locally — no CDN download needed. No installation beyond Python 3.9+.

For cross-device testing: open http://<your-lan-ip>:8080 on two devices. PeerJS will connect them directly via WebRTC.