Phase 2: Combat & Abilities
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.
Build responsive, satisfying real-time combat that feels great on the Miyoo while remaining fully authoritative on the Rust server.
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.
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.
Create a 30–60 Hz tick in the Rust server using Tokio intervals. Every tick the server:
This is the heart of authority — the Miyoo never calculates damage itself.
On the Miyoo, add a hotbar (4–6 slots) mapped to face buttons + shoulder buttons. When a button is pressed:
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.
For snappy feel on WiFi:
This hides latency and makes combat feel console-quality on the Miyoo.
Add:
Wire up the three abilities:
All abilities are cooldown-based and fully simulated on the server.
Run comprehensive tests:
Combat now feels alive. You are ready for Phase 3 where the extraction loop and loot system come together.