ry-core
Core trait and module registry for Ry-Dit game engine
Overview
ry-core provides the foundational RyditModule trait and ModuleRegistry system for the Ry-Dit game engine. All modules in the ecosystem implement this trait, enabling dynamic loading, execution, and metadata discovery.
Features
- RyditModule trait - Common interface for all engine modules
- ModuleRegistry - Dynamic module loading and management
- ModuleMetadata - Descriptive metadata for plugin systems
- ModuleResult/ModuleError - Standardized error handling
- JSON-based execution - Universal command interface via
serde_json::Value
Installation
[]
= "0.8.2"
= { = "1.0", = ["derive"] }
= "1.0"
Usage
Implementing a Module
use ;
use ;
use HashMap;
;
Using ModuleRegistry
use ;
let mut registry = new;
// Register modules
registry.register?;
// Execute commands
let result = registry.execute?;
assert_eq!;
Module Metadata
use ModuleMetadata;
let metadata = new
.with_name
.with_version
.with_description
.with_license
.with_authors;
API Reference
RyditModule Trait
ModuleResult
pub type ModuleResult = ;
ModuleRegistry
Design Principles
- JSON Interface - All modules use
serde_json::Valuefor maximum flexibility - Error Standardization -
ModuleErrorwith code + message for consistent error handling - Dynamic Loading - Registry pattern enables runtime module discovery
- Hot Reload Ready - Optional hooks for live code updates
- Zero Dependencies - Only
serdeandserde_jsonas external crates
Implementing Modules
The following crates implement RyditModule:
| Crate | Module | Description |
|---|---|---|
| ry-anim | AnimModule |
Animation system (Disney principles) |
| ry-physics | PhysicsModule |
Physics simulation |
| ry-gfx | GfxModule |
Graphics rendering |
| ry-lexer | LexerModule |
Tokenizer for scripting |
| ry-parser | ParserModule |
AST parser for scripting |
Performance
- Zero allocations in trait methods (static dispatch)
- 9 unit tests ensuring correctness
- Minimal dependencies - only serde + serde_json
- 429 lines of focused, production-ready code
Dependencies
| Crate | Version | Purpose |
|---|---|---|
serde |
1.0 (derive) | Serialization macros |
serde_json |
1.0 | JSON value type |
Roadmap
- Async module execution
- Module dependency resolution
- Version compatibility checking
- Module lifecycle management (init, shutdown)
- Sandbox execution with resource limits
Contributing
Contributions are welcome! This crate is part of the Ry-Dit game engine project.
- Repository: https://github.com/lapumlbb18-blip/Ry-dit
- Issues: https://github.com/lapumlbb18-blip/Ry-dit/issues
- Pull Requests: Welcome!
Please read CONTRIBUTING.md for guidelines.
License
MIT License - See LICENSE for details.
ry-core - The foundation of Ry-Dit's modular game engine 🔧
9 tests · 429 lines · RyditModule trait · ModuleRegistry