⚔️

Miyoo Extraction RPG

Phase 2: Combat & Abilities

3–4 weeks

Phase 2 brings the game to life with real-time, server-authoritative combat. You will implement the three classes (Warrior, Mage, Rogue), their starter abilities and self-heals, enemy AI, projectiles, and the full hit-detection loop — all while keeping the Miyoo client responsive through prediction and reconciliation.

🎯 Goal

Build responsive, satisfying real-time combat that feels great on the Miyoo while remaining fully authoritative on the Rust server.

✅ Final Deliverable

A complete combat loop on real hardware: choose a class, fight enemies with melee and spells, use self-heals/potions, see health bars and damage numbers, and feel smooth movement even in WiFi multiplayer.

📋 Prerequisites — Complete Phase 0 & Phase 1 First

  • ✔️ Rust workspace with shared crate and working server
  • ✔️ Miyoo SDL2 client with chunk-based rendering
  • ✔️ Procedural dungeon generation and basic movement
  • ✔️ Hybrid TCP+UDP networking established
  • ✔️ 16×16 sprites for player, enemies, and projectiles

Detailed Steps for Phase 2

1

Expand Shared Crate with Combat Data Structures

In shared/src/lib.rs add structs for classes, abilities, and combat stats. This ensures the client and server speak the same language.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClassStats {
    pub health: f32,
    pub mana: f32,
    pub damage_multiplier: f32,
    // ... more per class
}

pub enum Ability {
    SecondWind,      // Warrior
    ArcaneRestore,   // Mage
    ShadowMend,      // Rogue
    // future abilities
}

Define base stats for Warrior (tank), Mage (burst/control), Rogue (mobility) here.

2

Server: Implement Combat Simulation Tick Loop

Create a 30–60 Hz tick in the Rust server using Tokio intervals. Every tick the server:

  • Processes all pending player inputs
  • Runs hit detection and damage calculation (authoritative)
  • Applies class modifiers, affixes, and augment bonuses
  • Broadcasts a compact WorldSnapshot via UDP

This is the heart of authority — the Miyoo never calculates damage itself.

3

Client: Ability Input Handling & Hotbar

On the Miyoo, add a hotbar (4–6 slots) mapped to face buttons + shoulder buttons. When a button is pressed:

  • Send an immediate UDP PlayerInput packet with ability ID
  • Play local animation immediately (prediction)
  • Wait for server confirmation to finalize or correct
4

Server & Client: Enemy AI & Projectiles

Simple chase-and-attack AI on server (move toward nearest player, attack when in range). Add projectile entities for spells. Server validates every hit; client only renders the results.

5

Implement Client-Side Prediction & Reconciliation

For snappy feel on WiFi:

  • Client predicts its own movement and basic attacks instantly
  • Server sends authoritative snapshots every tick
  • Client smoothly corrects position/animation if the server disagrees

This hides latency and makes combat feel console-quality on the Miyoo.

6

Visual Feedback: Health Bars, Floating Damage & Animations

Add:

  • Overhead health bars (simple SDL2 rectangles)
  • Floating damage numbers with color (red for damage, green for heal)
  • Class-specific attack animations using sprite sheets
7

Implement Class Starter Abilities & Self-Heals

Wire up the three abilities:

  • Warrior – Second Wind (burst heal + damage reduction)
  • Mage – Arcane Restore (mana + small heal, cast time)
  • Rogue – Shadow Mend (heal-over-time while moving)

All abilities are cooldown-based and fully simulated on the server.

8

Test on Real Miyoo Hardware

Run comprehensive tests:

  • Solo combat with each class
  • Multiplayer (2–4 players) to check sync
  • WiFi latency under load
  • Ensure 30+ FPS with multiple enemies and projectiles

✅ Phase 2 Complete When You Can:

  • ✔️ Fight enemies with melee and spells using all three classes
  • ✔️ Use class-specific self-heals and potions effectively
  • ✔️ See smooth combat with prediction, health bars, and floating damage
  • ✔️ Experience responsive, authoritative multiplayer combat on real Miyoo hardware

Combat now feels alive. You are ready for Phase 3 where the extraction loop and loot system come together.

Miyoo Extraction RPG • Phase 2 HTML • Generated April 2026