Skip to content

Commit 3056d03

Browse files
authored
Revise README for clarity and updated project details
Refactor README to improve clarity and structure, including updates to sections on Echo's functionality, advantages, and project status. Signed-off-by: James Ross <[email protected]>
1 parent e0dae49 commit 3056d03

File tree

1 file changed

+100
-43
lines changed

1 file changed

+100
-43
lines changed

README.md

Lines changed: 100 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,25 @@
1313
//! (Recursively, in the Metaverse)
1414
```
1515

16-
<img src="https://github.com/user-attachments/assets/d31abba2-276e-4740-b370-b4a9c80b30de" height="500" align="right" />
16+
## **tl;dr:**
1717

18+
> _Echo is a recursive metagraph (RMG) simulation engine that treats _everything_–code, data, and time itself—as one big living graph.
19+
> It’s built so every change can branch, merge, and replay perfectly.
1820
19-
> _Echo is a recursive metagraph (RMG) simulation engine that executes and rewrites typed graphs deterministically across branching timelines and merges them through confluence._
21+
<img src="https://github.com/user-attachments/assets/d31abba2-276e-4740-b370-b4a9c80b30de" height="400" align="right" />
2022

2123
### Say what??
2224

2325
**Echo is an ambitious, mind-bending, radically different computational model for game engines and other interactive simulations.** The RMG is a powerful mathematical tool that brings the full weight of textbook category theory to interactive computational experiences.
2426

2527
Most game engines are object-oriented state machines. Unity, Unreal, Godot all maintain mutable object hierarchies that update every frame. Echo says: "No, everything is a graph, and the engine rewrites that graph deterministically using typed transformation rules."
2628

27-
## Snapshot Hashes
28-
29-
Echo records two hashes during a commit:
30-
- `state_root`: deterministic hash of the reachable graph state under the current root.
31-
- `commit hash` (commit_id): hash of a canonical header including `state_root`, parents, and deterministic digests for plan/decisions/rewrites.
32-
33-
See `docs/spec-merkle-commit.md` for the precise encoding and invariants.
34-
3529
Echo is fundamentally **built different**.
3630

3731
RMG provides atomic, in-place edits of recursive meta-graphs with deterministic local scheduling and snapshot isolation.
3832

3933
It’s the core of the Echo engine: runtime, assets, networking, and tools all operate on the same living graph of graphs.
4034

41-
## Developer: Running Benchmarks
42-
43-
- Command: `cargo bench -p rmg-benches`
44-
- Purpose: Runs Criterion micro-benchmarks for the benches crate (`crates/rmg-benches`).
45-
- Docs: see `crates/rmg-benches/benches/README.md` for details, tips, and report paths.
46-
4735
### Core Principles
4836

4937
| Principle | Description |
@@ -60,20 +48,13 @@ It’s the core of the Echo engine: runtime, assets, networking, and tools all o
6048

6149
---
6250

63-
## **tl;dr:**
51+
### What's Echo?
6452

65-
> ECHO is a game engine that treats _everything_—code, data, and time itself—as one big living graph.
66-
> It’s built so every change can branch, merge, and replay perfectly.
67-
68-
---
69-
70-
### The short pitch
71-
72-
ECHO runs on something called an **RMG (Recursive Meta-Graph)**. Think of it as a graph-based operating system. Everything in the engine (worlds, entities, physics, shaders, even the tools) lives inside that graph.
53+
Echo runs on something called an **RMG (Recursive Meta-Graph)**. Think of it as a graph-based operating system. Everything in the engine (worlds, entities, physics, shaders, even the tools) lives inside that graph.
7354

7455
Echo doesn’t “update objects.” It _rewrites_ parts of the graph using a set of deterministic rules. That’s what “graph rewriting” means.
7556

76-
### Why this is cool
57+
### Why Echo's Cool
7758

7859
- **Deterministic:** same inputs = same world every time.
7960
- **Branching:** you can fork reality, change it, and merge it back without chaos.
@@ -90,7 +71,7 @@ You can pause time, fork a copy of reality, try out a new idea, and merge the ti
9071

9172
## Advantages
9273

93-
> *"Things are only impossible until they're not."* — Jean-Luc Picard
74+
> _"Things are only impossible until they're not." — Jean-Luc Picard_
9475
9576
Can your game engine do...
9677

@@ -105,7 +86,7 @@ Same input graph + same rules = same output, always. This is huge for:
10586

10687
### Branching Timelines
10788

108-
> “All we have to decide is what to do with the time that is given to us.” — _Gandalf, The Lord of the Rings_
89+
> _“All we have to decide is what to do with the time that is given to us.” — Gandalf, The Lord of the Rings_
10990
11091
The Git metaphor is accurate. Fork reality, try something, merge back. This enables:
11192

@@ -132,17 +113,69 @@ Rules are graphs. Systems are graphs. The whole runtime is a graph. This gives y
132113

133114
---
134115

135-
## Current Status
116+
| Principle | Vision | Implementation |
117+
| :--- | :--- | :--- |
118+
| **Determinism (The "Replay")** | Same input graph + same rules = same output graph. Always. This is huge for networked multiplayer (no desync), perfect replays, and reproducible bug testing. | Achieved via an $O(n)$ deterministic scheduler. Pending graph rewrites are sorted using a stable radix sort (not a comparison-based sort) based on their scope, rule ID, and nonce. Combined with a deterministic math module (Vec3, Quat, PRNG), this ensures identical inputs always produce identical execution order and final state. |
119+
| **Branching & Confluence (The "Time Travel")** | Fork reality, try something, and merge it back like a Git branch. Independent, non-conflicting changes converge to the same canonical state, guaranteed. | The engine's Timeline Tree (modeling Chronos, Kairos, and Aion) allows for branching realities. The engine's core transaction model (begin, apply, commit) and footprint-based independence checks (MWMR) allow for safe, parallel execution and deterministic, conflict-free merges. |
120+
| **Snapshot Isolation (The "Commit")** | Snapshots are emitted from the live graph; append-only history is optional. This enables save/load, time-travel debugging, and collaborative editing. | Each commit produces two Merkle hashes derived from 256-bit BLAKE3: <ul><li><code>state_root</code>: deterministic hash of the reachable graph state under the current root.</li><li><code>commit hash</code> (commit_id): hash of a canonical header including <code>state_root</code>, parents, and deterministic digests for plan/decisions/rewrites.</li></ul> See <code>docs/spec-merkle-commit.md</code> for the precise encoding and invariants. |
121+
| **Everything-is-a-Graph (The "Substrate")** | Nodes, edges, systems, assets, and even rewrite rules are all graphs. Graphs can contain subgraphs recursively. | The engine operates on typed, directed graphs. All identifiers (NodeId, TypeId, EdgeId) are domain-separated BLAKE3 hashes. Rewrite Rules are defined with a matcher, executor, and compute_footprint function, allowing the engine to deterministically transform the graph. |
122+
| **Hexagonal Architecture (The "Ports")** | A core engine that is pure logic, completely decoupled from the outside world (rendering, input, networking). | Echo uses a Ports & Adapters design. The core engine (rmg-core) knows nothing of pixels, sockets, or key presses. It exposes narrow interfaces ("Ports") that external crates ("Adapters") implement. This allows swapping renderers (e.g., WebGPU, SDL) or physics engines without changing the core simulation logic. |
136123

137-
Echo is in **active development**. We're currently:
124+
---
138125

139-
- ✅ Formal proofs of confluence (tick-level determinism proven)
140-
-[C implementation](http://github.com/meta-graph/core) of independence checks and footprint calculus
141-
- ✅ 200-iteration property tests validating commutativity
142-
- 🚧 Performance optimization (subgraph matching, spatial indexing)
143-
- 🚧 Rust rewrite of core runtime
144-
- ❌ Lua scripting integration (not started)
145-
- ❌ Rendering backend (not started)
126+
## Architecture
127+
128+
Echo is a Rust workspace organized into a multi-crate setup. The core engine is pure, dependency-free Rust (#![no_std] capable) with I/O isolated to adapter crates.
129+
130+
```bash
131+
echo/
132+
├── crates/
133+
│ ├── rmg-core/ (Core engine: RMG, scheduler, transaction model, snapshotting)
134+
│ ├── rmg-geom/ (Geometry primitives: AABB, transforms, broad-phase)
135+
│ ├── rmg-benches/ (Criterion microbenchmarks: snapshot_hash, scheduler_drain)
136+
│ ├── rmg-wasm/ (WebAssembly bindings for tools and web)
137+
│ ├── rmg-ffi/ (C ABI for Lua/host integration)
138+
│ └── rmg-cli/ (Command-line interface, demos launcher)
139+
├── docs/ (Comprehensive specifications and diagrams)
140+
└── scripts/ (Build automation, benchmarking)
141+
```
142+
143+
### Core Layers (inside `rmg-core`)
144+
145+
**ECS**: Archetype-based Entity-Component-System storage.
146+
**Scheduler**: Deterministic $O(n)$ radix-sort-based rule scheduler.
147+
**GraphStore**: In-memory BTreeMap-based graph storage (ensures deterministic iteration).
148+
**Transaction Model**: The `begin()`, `apply()`, `commit()` lifecycle for graph rewrites.
149+
**Snapshotting**: `state_root` and `commit_id` (Merkle commit) computation.
150+
**Footprints**: Independence checks for Multi-Writer-Multi-Read (MWMR) concurrency.
151+
**Deterministic Math**: safe Vec3, Mat4, Quat, and PRNG.
152+
153+
---
154+
155+
## Project Status: Phase 1 MVP (Active Development)
156+
157+
The project is currently focused on proving the core determinism and performance of the RMG model.
158+
159+
✅ Formal proofs of confluence (tick-level determinism proven).
160+
✅ C implementation of independence checks and footprint calculus.
161+
✅ Rust core runtime (`rmg-core`) with the transaction model and $O(n)$ scheduler.
162+
✅ Comprehensive property-based test suite (200+ iterations validating commutativity).
163+
✅ Benchmark infrastructure (`rmg-benches`) with a D3 visualization dashboard.
164+
🚧 Performance optimization (subgraph matching, spatial indexing).
165+
🚧 Temporal mechanics (Aion integration for significance/agency).
166+
🚧 Radix sort micro-tuning for scheduler.
167+
☑️ (not yet started) Lua scripting integration (via `rmg-ffi`).
168+
☑️ (not yet started) Rendering backend (adapters planned).
169+
☑️ (not yet started) Full physics engine integration.
170+
☑️ (not yet started) Inspector tooling (via rmg-wasm).
171+
172+
## Learning the Vision
173+
174+
> _“Roads? Where we’re going, we don’t need roads.” — Doc Brown, Back to the Future_
175+
176+
- Read [docs/architecture-outline.md](./docs/architecture-outline.md) for the full spec.
177+
- Explore [docs/diagrams.md](./docs/diagrams.md) for Mermaid visuals.
178+
- Track active work in [docs/execution-plan.md](./docs/execution-plan.md).
146179

147180
---
148181

@@ -199,8 +232,32 @@ There's a ton of other advanced reasons why it's cool, but that's nerd stuff. Le
199232
200233
- Start each task by verifying a clean git state and branching (`echo/<feature>` recommended).
201234
- Tests go in `packages/echo-core/test/` (fixtures in `test/fixtures/`). End-to-end scenarios will eventually live under `apps/playground`.
202-
- Use expressive commits (`subject` / `body` / optional `trailer`)—tell future us the *why*, not just the *what*.
203-
- Treat determinism as sacred: prefer Echo’s PRNG, avoid non-deterministic APIs without wrapping them.
235+
- Use expressive commits (`subject` / `body` / optional `trailer`). Tell future us the *why*, not just the *what*.
236+
- Treat determinism as sacred: use Echo’s PRNG, avoid non-deterministic APIs without wrapping them.
237+
238+
### Running Benchmarks
239+
240+
Echo takes performance and determinism seriously. The `rmg-benches` crate provides detailed microbenchmarks.
241+
242+
**Command (live dashboard):**
243+
244+
```bash
245+
make bench-report
246+
```
247+
248+
- Runs `cargo bench -p rmg-benches`, starts a local server, and opens the dashboard at `http://localhost:8000/docs/benchmarks/`.
249+
250+
**Command (offline static file): **
251+
252+
```bash
253+
make bench-bake
254+
```
255+
256+
- Runs benches and bakes `docs/benchmarks/report-inline.html` with results injected so it works over `file://` (no server required).
257+
258+
**Docs:**
259+
260+
See [`crates/rmg-benches/benches/README.md`](./crates/rmg-benches/benches/README.md) for details.
204261

205262
### Git Hooks
206263

@@ -211,7 +268,7 @@ make hooks
211268
```
212269

213270
- The pre-commit hook auto-fixes formatting by default (runs `cargo fmt --all`).
214-
- To switch to check-only mode for a commit, set `ECHO_AUTO_FMT=0`:
271+
- To switch to check-only mode for a commit, set `ECHO_AUTO_FMT=0`
215272

216273
```
217274
ECHO_AUTO_FMT=0 git commit -m "your message"
@@ -229,11 +286,11 @@ You can also export `ECHO_AUTO_FMT=0` in your shell rc if you prefer check-only
229286
### Roadmap Highlights
230287

231288
- [x] **Phase 0** – Finalize specs and design.
232-
- [ ] **Phase 1** – Ship Echo Core MVP with tests and headless harness.
233-
- [ ] **Phase 2 “Double-Jump”** – Deliver reference render/input adapters and the playground.
289+
- [] **Phase 1** – Ship Echo Core MVP with tests and headless harness.
290+
- [ ] **Phase 2** – Deliver reference render/input adapters and **the playground**.
234291
- [ ] **Phase 3+** – Physics, WebGPU, audio, inspector, and full temporal tooling.
235292

236-
Chrononauts welcome. Strap in, branch responsibly, and leave the timeline cleaner than you found it.
293+
**Chrononauts welcome.** Strap in, branch responsibly, and leave the timeline cleaner than you found it.
237294

238295
---
239296

0 commit comments

Comments
 (0)