How davide-perli/nysodi works
Project Type and Purpose
• Type: Multi-crate Rust workspace for a single-player 2D game.
• Purpose:
• Editor (scene creation & live preview)
• Executors (runtimes for desktop, WebAssembly, Android)
• Game logic as a dynamically loaded plugin
• Shared asset pipeline
Break Down the File Structure into Architectural Components
Top-level crates under nysodi/:
• editor – Binary GUI app for building and previewing levels
• executor – Desktop runtime binary
• executor-wasm – WebAssembly runtime (browser)
• executor-android – Android runtime library
• game-dylib – cdylib plugin crate that exports game logic hooks
• game – Core game logic (entities, systems) as an ordinary Rust library
• data – Asset folder (scenes, sprites, tilesets, configs)
Main Components
A. Fyrox Engine (shared across editor & executors)
B. Editor App
– Loads assets (scene RGS, sprites, tiles)
– Loads the game logic plugin (game-dylib) for live preview
C. Executors (3 variants)
– Desktop executor binary
– WebAssembly executor (main.js + WASM)
– Android executor library (APK integration)
All three load assets + game logic plugin
D. Game Logic Plugin
– game-dylib (compiled as cdylib)
– Depends on game crate for bot/player logic, health, items
E. Asset Pipeline
– nysodi/data/ folder containing all imagery, RGS scenes, configs
Relationships & Data Flow
1. Editor/Executor → Fyrox Engine
• Calls core rendering, input, scripting APIs
2. Editor/Executor → Asset Loader
• Loads .rgs scene files, sprite PNGs, tilesets, fonts
3. Editor/Executor → Game Logic Plugin
• Loads cdylib at runtime
• Invokes plugin’s lifecycle hooks (on_init, on_update)
4. Game Logic Plugin → game crate
• Executes entity logic (spawn bots, handle health, power-ups)
5. Executors (WASM / Android) → Platform Host
• WASM: Browser WebGL context + JS glue (main.js)
• Android: JNI bridge + keystore integration
Key Architectural Patterns & Principles
• Plugin Architecture: game logic lives in a dynamically loaded cdylib
• Multi-target Builds: single code-base with platform-specific executors
• Separation of Concerns:
• Editor vs. Runtime vs. Game Logic vs. Assets
• Data-driven Scenes: RGS scene files drive level structure
Technologies, Frameworks & Formats
• Language: Rust (stable)
• Engine: Fyrox (2D game engine)
• Build System: Cargo workspace with multiple Cargo.toml files
• Plugin Format: cdylib for desktop, wasm32-unknown-unknown, JNI for Android
• Asset Formats: .rgs (scenes), PNG (sprites), .tileset, .ron (settings)
• Fyrox Engine
• Editor App
• Executor-Desktop, Executor-WASM, Executor-Android
• Game Logic Plugin (game-dylib)
• Core Game Logic (game crate)
• Asset Store (data/)
• Platform Hosts (Browser, Android OS)