How ghsrg/alife works
ALife Simulation is a Rust artificial-life engine with a browser control center for configuring runs and inspecting their evolution. The principal workflow is scenario resolution, world bootstrap, repeated simulation ticks, snapshot/projection generation, and display in the viewer. The source index supports the engine, bootstrap, runner, observer, and server relationships shown here; the UI’s controller-to-client flow is excerpted. The README emphasizes documentation-first design, while the available tree and excerpts show runtime implementation. Several subsystems are represented at directory level where their implementation was not sampled.
Main entry points: tick.rs Tick Executor · engine.rs Run Engine · runnerController.ts Run Controller · snapshot.rs Committed Snapshot
Components 22
Scenario Setup
- Scenario Document
src/runner/scenario_doc.rs - Config Parser
src/runner/config_parser.rs - World Bootstrap
src/bootstrap/mod.rs - Runtime Config
src/core/config.rs
Simulation Engine
- Run Engine
src/runner/engine.rs - Tick Executor
src/core/tick.rs - World State
src/core/world.rs - Cell Store
src/core/cell_store.rs - Genome Runtime
src/core/genome.rs - Process Registry
src/core/process.rs - Resource State
src/core/resources.rs
Observation
- Committed Snapshot
src/core/snapshot.rs - Observer Projections
src/observer/projection.rs - Analytics Export
src/storage/analytics_export.rs
Viewer Interface
- Viewer API
src/viewer_server/api/run.rs - Server State
src/viewer_server/state.rs - Run Controller
ui/control-center/src/app/runnerController.ts - Runner API Client
ui/control-center/src/runner/apiClient.ts - Runner Stream Client
ui/control-center/src/runner/streamClient.ts - Live Projection Adapter
ui/control-center/src/projection/liveAdapter.ts - Control Center
ui/control-center/src/App.tsx
Other components
- Operator
Connections 25
- Operator → Control Center: configures runs
- Scenario Document → Config Parser: parses via
src/runner/scenario_doc.rs - Scenario Document → Runtime Config: produces config
src/runner/scenario_doc.rs - Run Engine → World Bootstrap: prepares world
src/runner/engine.rs - Run Engine → Tick Executor: executes ticks
src/runner/engine.rs - Run Engine → Committed Snapshot: caches snapshots
src/runner/engine.rs - Tick Executor → Cell Store: updates cells
src/core/tick.rs - Tick Executor → Genome Runtime: uses genome
src/core/tick.rs - Tick Executor → Process Registry: dispatches processes
src/core/tick.rs - Tick Executor → Resource State: updates resources
src/core/tick.rs - Tick Executor → World State: updates world
src/core/tick.rs - Committed Snapshot → Cell Store: captures state
src/core/snapshot.rs - Committed Snapshot → Resource State: captures resources
src/core/snapshot.rs - Observer Projections → Committed Snapshot: projects snapshot
src/observer/projection.rs - Analytics Export → Observer Projections: exports analytics
- Viewer API → Run Engine: controls runs
src/viewer_server/api/run.rs - Viewer API → Server State: uses server state
src/viewer_server/api/run.rs - Server State → Run Engine: manages engine
src/viewer_server/state.rs - Run Controller → Runner API Client: issues commands
ui/control-center/src/app/runnerController.ts - Run Controller → Runner Stream Client: opens stream
ui/control-center/src/app/runnerController.ts - Run Controller → Live Projection Adapter: adapts frames
ui/control-center/src/app/runnerController.ts - Runner API Client → Viewer API: sends HTTP requests
- Runner Stream Client → Viewer API: receives run stream
- Control Center → Run Controller: drives controls
- Live Projection Adapter → Observer Projections: consumes projections