How sharpedmimishee/schematics works
Project type and purpose
• This “Schematics” repo is a small Rust-based game/mod application that uses macroquad for real-time rendering and mlua for Lua scripting.
• It loads custom “schemapacks” (cell machine definitions), manages game features (cells, functions, registers), and drives multiple UI scenes (menus, play screen, credits).
File structure
• Top-level:
• Cargo.toml / Cargo.lock (Rust project manifest and locks)
• src/ (all Rust source code)
• schemapacks/ (external cell-machine definitions and test scripts)
• .github/workflows/rust.yml (CI build)
• src/:
• main.rs – application entrypoint & event loop
• assets/ – fonts, textures, UI assets
• scene/ – separate scenes (main menu, options, play screen, credits)
• features/ – core game logic modules (cell, celltype, functions, register)
• scene.rs – scene manager/dispatcher glue
• README highlights two main dependencies: macroquad (rendering + input + audio) and mlua (Lua VM).
README for additional insights
• Confirms it’s a standalone application, not a web service.
• Emphasizes mod-pack extensibility (schemapacks) and credits for art assets.
a. Main components to represent:
1. Application Core (main.rs)
2. Event Loop & Scheduler
3. Rendering Engine (macroquad)
4. Input System (macroquad)
5. Audio System (macroquad)
6. Scene Manager (scene.rs + scene/*)
7. Asset Manager (assets/* loader)
8. Feature Modules (features/*)
9. Lua Scripting Engine (mlua)
10. Schemapack Loader (schemapacks/*)
b. Relationships and interactions:
• The Event Loop orchestrates calls to Input → Update → Render each frame.
• Input System feeds raw events into the Scene Manager.
• Scene Manager delegates to the active Scene (playscreen, mainmenu, etc.).
• Scenes invoke Feature Modules for game logic (cell updates, function execution).
• Feature Modules may invoke Lua scripts (via the mlua engine) or respond to them.
• Asset Manager delivers textures/fonts/UI assets to the Rendering Engine.
• Schemapack Loader feeds definitions into Feature Modules and/or Lua.
• Audio System is called by Scenes or Features to play sounds.
c. Architectural patterns and design principles:
• Modularization by responsibility: assets, scenes, features, scripting.
• Separation of concerns: rendering vs. game logic vs. scripting.
• Plugin/mod-pack architecture: external schemapacks loaded at runtime.
d. Key technologies:
• Rust & Cargo (build)
• macroquad (OpenGL wrapper for graphics, input, audio)
• mlua (embedded Lua VM)
• Lua scripts in schemapacks for extensibility