forked from Rockachopa/the-matrix
fdfae19956abca7f59d5a4f76095b4acb4ccbac9
3D visualization for AI agent swarms built with Three.js. Matrix green/noir cyberpunk aesthetic. - 4 agents: Timmy (orchestrator), Forge (builder), Seer (planner), Echo (comms) - Central core pillar, animated green grid, digital rain - Agent info panels, chat, task list, memory views - WebSocket protocol for real-time state updates - iPad-ready: touch controls, add-to-homescreen - Post-processing: bloom, scanlines, vignette - No build step — pure ES modules via esm.sh CDN Created with Perplexity Computer
The Matrix — Sovereign Agent World
A persistent 3D world for visualizing and commanding AI agent swarms. Built with Three.js, Matrix green/noir cyberpunk aesthetic.
Overview
The Matrix is a dark 3D environment — think the Matrix digital world meets a cyberpunk command center. The sovereign operator enters this world to observe and command their AI agent swarm. Each agent has a physical presence in the world with unique geometry, animations, and glow effects. The world visualizes the system's state in real-time.
Agents
| Agent | Direction | Role | Visual |
|---|---|---|---|
| Timmy | North | Main Orchestrator | Wireframe humanoid, green glow |
| Forge | East | Builder Agent | Geometric anvil/hammer, orange glow |
| Seer | South | Planner/Observer | Crystal icosahedron, purple glow |
| Echo | West | Communications | Concentric pulse rings, cyan glow |
How to Run Locally
Just serve the static files:
# Using npx serve (recommended)
npx serve . -l 3000
# Or Python
python3 -m http.server 3000
# Or any static file server
Open http://localhost:3000 in your browser.
Controls
- Rotate: Click/touch + drag
- Zoom: Scroll wheel / pinch
- Pan: Right-click drag / two-finger drag
- Select Agent: Tap/click on an agent
- Select Core: Tap/click on the central pillar
- Close Panel: Tap empty space or click ✕
Connecting a Real Agent Backend
Replace the MockWebSocket with a real WebSocket connection. The world expects to connect to:
ws://[host]:[port]/ws/world-state
See PROTOCOL.md for the complete WebSocket protocol specification.
Quick Start
- Implement a WebSocket server that sends events in the format specified in PROTOCOL.md
- In
js/websocket.js, replaceMockWebSocketusage with a nativeWebSocket:
const ws = new WebSocket('ws://your-server:8080/ws/world-state');
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
// Dispatch to world systems
};
Adding Custom Agents
- Add the agent definition to
AGENT_DEFSinjs/websocket.js - Add position to
AGENT_POSITIONSinjs/agents.js - Add color to
AGENT_COLORSinjs/agents.js - Create a geometry function (e.g.,
createMyAgent()) injs/agents.js - Register in
AGENT_CREATORSmap
iPad Access
Via Tailscale
- Install Tailscale on your server and iPad
- Run the server on the Tailscale IP
- Open
http://[tailscale-ip]:3000in Safari on iPad
Add to Home Screen
- Open the URL in Safari on iPad
- Tap the Share button → "Add to Home Screen"
- The app will run in full-screen mode
Tech Stack
- Three.js (v0.171.0) — 3D rendering via esm.sh CDN
- WebGL 2 — Hardware-accelerated rendering
- EffectComposer — Post-processing (bloom, scanlines, vignette)
- OrbitControls — Touch-friendly camera
- ES Modules — No build tools needed
- JetBrains Mono — Typography via Google Fonts
File Structure
the-matrix/
├── index.html # Entry point
├── style.css # All UI styles
├── js/
│ ├── main.js # Bootstrap, scene setup, game loop
│ ├── world.js # Ground plane, core pillar, grid
│ ├── agents.js # Agent geometry, animations, labels
│ ├── effects.js # Digital rain, particles, post-processing
│ ├── ui.js # Panel, tabs, chat, task list, memory
│ ├── interaction.js # Raycasting, selection, camera
│ └── websocket.js # WebSocket client + MockWebSocket
├── README.md # This file
└── PROTOCOL.md # WebSocket protocol specification
Screenshots
Coming soon
License
MIT
Description
Languages
JavaScript
71.4%
CSS
17.2%
HTML
11.4%