ISSUN-CORE: Engine-Agnostic Game Mechanics Library
This crate provides a policy-based design for composable game mechanics. It uses Rust's generic type system to enable zero-cost abstractions while maintaining complete separation from any specific game engine.
Architecture
ISSUN-CORE follows a Policy-Based Design pattern:
- Mechanics: High-level game systems (e.g., contagion, economy)
- Policies: Trait-based "slots" for customizable behavior
- Strategies: Concrete implementations of policies
- Composition: Combine strategies via generics to create custom mechanics
Design Principles
- Zero-Cost Abstraction: All composition happens at compile time
- Engine-Agnostic: No dependencies on Bevy, Unity, Godot, etc.
- Static Dispatch: No
dyn Trait- everything is monomorphized - Composability: Mix and match strategies to create custom behaviors
Quick Start
use *;
use ;
// Option 1: Use a preset
type MyVirus = ZombieVirus; // Explosive spread + hard to resist
// Option 2: Use default generics
type SimpleVirus = ContagionMechanic; // LinearSpread + ThresholdProgression<10>
// Option 3: Fully customize
type CustomVirus = ;
// 2. Create configuration (shared across all entities)
let config = ContagionConfig ;
// 3. Create per-entity state
let mut state = default;
// 4. Prepare input for this frame
let input = ContagionInput ;
// 5. Create an event emitter
#
#
let mut emitter = TestEmitter ;
// 6. Execute the mechanic
step;
// 7. Check results
if state.severity > 0
Module Organization
- [
mechanics]: Core trait definitions and mechanic implementations- [
mechanics::contagion]: Disease/infection spreading system
- [
- [
prelude]: Convenient re-exports of commonly used items
For Engine Adapters
If you're building an engine adapter (e.g., issun-bevy), you'll typically:
- Query ECS data to construct
Inputstructs - Call
Mechanic::step()with that input - Listen to emitted events and update the game world
See the issun-bevy crate for a complete example.