# C++ Skill System Evaluation for League of Legends Deployment ## Executive Summary This document evaluates the Perfect World C++ skill system architecture to determine its suitability for deploying League of Legends-style skills. The analysis covers system capabilities, gaps, advantages, and disadvantages. **Verdict**: The system provides a **solid foundation** for basic skill mechanics but requires **significant enhancements** for full LoL-style deployment. --- ## Part 1: Current System Capabilities ### 1.1 Core Architecture The documented system follows a **server-authoritative** model: ``` Client Input → Server Validation → Server Broadcast → Client Execution → GFX Spawning ``` **Key Components:** - **Client Input Handler** (`EC_HostPlayer.cpp`): Handles skill hotkey presses, validates locally (range, cooldown, work state) - **Network Layer** (`EC_GameDataPrtc.cpp`): Routes packets between client/server - **Server Processing**: Validates MP, range, calculates damage, broadcasts results - **Client Execution** (`EC_Player.cpp`, `EC_ManAttacks.cpp`): Creates attack events, triggers GFX - **GFX System** (`EC_ManSkillGfx.cpp`, `A3DSkillGfxEvent2.cpp`): Manages visual effects with hook-based positioning ### 1.2 Supported Skill Types (From Documentation) **Currently Supported:** - ✅ **Targeted Skills**: Single target attacks (`c2s_CmdCastSkill` with `idTarget`) - ✅ **Multi-Section Skills**: Skills with multiple phases (`m_nSkillSection`) - ✅ **Projectile Skills**: Fly GFX with movement (`CGfxMoveBase`, `CGfxLinearMove`, `CGfxOnTargetMove`) - ✅ **Instant Skills**: `OBJECT_CAST_INSTANT_SKILL` packet type - ✅ **Position-Based Skills**: `OBJECT_CAST_POS_SKILL` packet type - ✅ **Weapon-Based Attacks**: Separate path for weapon projectiles - ✅ **Passive Skills**: `TYPE_PASSIVE` skill type mentioned **Skill Mechanics:** - ✅ **Cooldown System**: Client-side validation (`Validate: cooldown`) - ✅ **MP Cost**: Server-side validation (`cost MP`) - ✅ **Range Checking**: Both client and server (`check range`) - ✅ **Cast Time**: Incantation timer (`m_IncantCnt`) - ✅ **Damage Calculation**: Server-side (`Calculate damage and targets`) - ✅ **Multi-Target**: `targets` array in composer system ### 1.3 Visual System Capabilities **GFX Features:** - ✅ **Hook-Based Positioning**: Skeleton hooks for precise attachment points - ✅ **Fly/Hit GFX Separation**: Separate effects for projectile and impact - ✅ **State Machine**: Wait → Flying → Hit → Finished - ✅ **Frame-by-Frame Updates**: Position recalculation every frame - ✅ **Child Model Support**: Weapon/pet-mounted effects - ✅ **Reverse Mode**: Skills that travel from target to caster - ✅ **Tracing Targets**: Hit GFX can follow moving targets - ✅ **Resource Pooling**: `A3DGFXExMan` manages GFX lifecycle **Movement Types:** - ✅ **Linear Movement**: Straight-line projectiles - ✅ **On-Target Movement**: Projectiles that track moving targets - ✅ **Configurable Speed**: `attack_speed` parameter --- ## Part 2: League of Legends Requirements ### 2.1 Skill Types in LoL | Skill Type | Description | Current System Support | |------------|-------------|------------------------| | **Targeted** | Click on enemy to cast | ✅ Supported (`idTarget` parameter) | | **Skillshot** | Aimed projectile with hitbox | ⚠️ Partial (projectiles exist, but no hitbox system) | | **Area (AoE)** | Ground-targeted area effect | ⚠️ Partial (`OBJECT_CAST_POS_SKILL` exists, but limited) | | **Channeled** | Continuous cast over time | ❌ Not supported (no channeling state machine) | | **Toggle** | On/off persistent effect | ❌ Not supported | | **Passive** | Automatic effects | ✅ Basic support (`TYPE_PASSIVE`) | | **Dash/Blink** | Movement abilities | ❌ Not supported (no movement skill type) | | **Shield/Buff** | Non-damage effects | ⚠️ Partial (damage-focused, buffs not documented) | ### 2.2 Critical LoL Mechanics **Projectile System:** - ✅ Projectiles exist (`Fly GFX`) - ❌ **Missing**: Hitbox/collision detection during flight - ❌ **Missing**: Piercing projectiles (hit multiple targets) - ❌ **Missing**: Projectile width/radius for collision - ❌ **Missing**: Projectile blocking by minions/terrain **Area Effects:** - ⚠️ Position-based casting exists - ❌ **Missing**: Circular/rectangular area indicators - ❌ **Missing**: Delayed AoE (damage after delay) - ❌ **Missing**: Persistent AoE zones (damage over time) **Buff/Debuff System:** - ❌ **Missing**: Status effect framework - ❌ **Missing**: Stacking buffs/debuffs - ❌ **Missing**: Buff duration management - ❌ **Missing**: Buff visualization (icons, timers) **Channeling:** - ❌ **Missing**: Interruptible channeling state - ❌ **Missing**: Channeling progress UI - ❌ **Missing**: Movement restrictions during channel **Movement Abilities:** - ❌ **Missing**: Dash/teleport mechanics - ❌ **Missing**: Pathfinding for dashes - ❌ **Missing**: Collision with terrain during dash **Combat System:** - ✅ Damage calculation exists - ❌ **Missing**: Damage types (physical/magic/true) - ❌ **Missing**: Armor/MR calculations - ❌ **Missing**: Critical strikes - ❌ **Missing**: Lifesteal/spellvamp ### 2.3 Network Requirements **LoL Network Model:** - **Lockstep with Rollback**: Deterministic simulation with rollback on desync - **Client Prediction**: Immediate feedback with server correction - **Low Latency**: <50ms for competitive play - **Synchronization**: All clients see same game state **Current System:** - ✅ Server-authoritative (prevents cheating) - ⚠️ **Concern**: No client prediction mentioned - ⚠️ **Concern**: Fixed delays (`timeToBeFired = 200ms`) may feel laggy - ⚠️ **Concern**: No rollback mechanism documented - ✅ Broadcast system exists for synchronization ### 2.4 Visual Requirements **LoL Visual Features:** - ✅ Complex particle effects (supported via GFX system) - ❌ **Missing**: Skill range indicators - ❌ **Missing**: Hitbox visualization (for skillshots) - ❌ **Missing**: Area effect previews - ❌ **Missing**: Cooldown timers on UI - ✅ Projectile trails (supported via Fly GFX) --- ## Part 3: Gap Analysis ### 3.1 Critical Missing Features #### 3.1.1 Skillshot System **Gap**: No hitbox/collision detection during projectile flight **Required:** - Projectile collision detection (width, height, collision layers) - Piercing mechanics (hit multiple targets) - Blocking mechanics (minions block projectiles) - Ground-targeted skillshots (not just unit-targeted) **Impact**: **HIGH** - Most LoL skills are skillshots #### 3.1.2 Buff/Debuff System **Gap**: No status effect framework **Required:** - Status effect container on entities - Effect stacking rules - Duration management - Visual representation (icons, timers) - Effect application/removal hooks **Impact**: **CRITICAL** - Core LoL mechanic #### 3.1.3 Channeling System **Gap**: No channeling state machine **Required:** - Channeling state (casting but not finished) - Interrupt conditions (stuns, silences, movement) - Channeling progress tracking - UI for channeling progress **Impact**: **HIGH** - Many LoL ultimates are channeled #### 3.1.4 Movement Abilities **Gap**: No dash/blink/teleport system **Required:** - Movement ability type - Pathfinding integration - Collision during movement - Animation during dash **Impact**: **HIGH** - Many champions rely on mobility #### 3.1.5 Area Effect System **Gap**: Limited AoE support **Required:** - Shape definitions (circle, rectangle, custom) - Delayed damage application - Persistent zones (damage over time) - Area indicator visualization **Impact**: **MEDIUM** - Many AoE skills in LoL ### 3.2 Network Architecture Gaps #### 3.2.1 Client Prediction **Gap**: No immediate feedback system **Current**: Client waits for server response before showing effects **Required**: Client predicts outcome, server corrects if wrong **Impact**: **HIGH** - Responsiveness critical for competitive play #### 3.2.2 Rollback System **Gap**: No desync correction **Required**: Ability to rollback and replay game state when desync detected **Impact**: **MEDIUM** - Important for competitive integrity ### 3.3 Combat System Gaps #### 3.3.1 Damage Types **Gap**: No damage type differentiation **Required**: Physical, Magic, True damage types with separate calculations **Impact**: **MEDIUM** - Core LoL mechanic #### 3.3.2 Defense System **Gap**: No armor/magic resist system documented **Required**: Armor/MR calculations, penetration, reduction **Impact**: **MEDIUM** - Required for balanced combat ### 3.4 UI/UX Gaps #### 3.4.1 Skill Indicators **Gap**: No range/hitbox visualization **Required**: - Range circles - Skillshot hitbox previews - AoE area previews **Impact**: **MEDIUM** - Important for player experience --- ## Part 4: Advantages ### 4.1 Architecture Advantages #### ✅ **Server-Authoritative Design** - Prevents cheating and exploits - Single source of truth for game state - Consistent across all clients #### ✅ **Modular GFX System** - Clean separation between logic and visuals - Composer system allows data-driven skill effects - Hook-based positioning provides flexibility #### ✅ **State Machine Pattern** - Clear skill lifecycle (Wait → Flying → Hit → Finished) - Easy to extend with new states - Predictable behavior #### ✅ **Resource Management** - GFX pooling reduces allocation overhead - Efficient memory usage - Good performance characteristics #### ✅ **Multi-Section Skills** - Supports complex multi-phase skills - Useful for ultimate abilities #### ✅ **Frame-Perfect Updates** - Position recalculation every frame - Smooth visual effects - Accurate hook tracking ### 4.2 Performance Advantages #### ✅ **Efficient Network Protocol** - Separate packets for different events (`OBJECT_CAST_SKILL`, `HOST_SKILL_ATTACK_RESULT`) - Reduces unnecessary data transmission - Good for MMO-scale games #### ✅ **Delayed Execution** - `timeToBeFired` delay allows server synchronization - Reduces visual desync issues - Predictable timing #### ✅ **C++ Performance** - Native code performance - Low overhead - Suitable for real-time games ### 4.3 Development Advantages #### ✅ **Well-Documented Flow** - Clear separation of concerns - Easy to understand architecture - Good for team development #### ✅ **Extensible Design** - Composer system allows new skills without code changes - Hook system supports various attachment points - Movement system can be extended --- ## Part 5: Disadvantages ### 5.1 Architecture Limitations #### ❌ **No Client Prediction** - **Problem**: Fixed 200ms+ delay feels laggy - **Impact**: Poor responsiveness for competitive play - **Solution Required**: Implement client-side prediction with server correction #### ❌ **Rigid Timing System** - **Problem**: Fixed `timeToBeFired` and `timeToDoDamage` delays - **Impact**: Cannot support instant skills or variable timing - **Solution Required**: Make timing configurable per skill #### ❌ **Damage-Focused Design** - **Problem**: System assumes all skills deal damage - **Impact**: Cannot easily support buffs, shields, movement skills - **Solution Required**: Abstract skill effects system #### ❌ **Limited Skill Types** - **Problem**: Only supports targeted and position-based skills - **Impact**: Cannot implement skillshots, channels, toggles - **Solution Required**: Expand skill type system ### 5.2 Missing Core Systems #### ❌ **No Buff/Debuff Framework** - **Problem**: No way to apply status effects - **Impact**: Cannot implement most LoL mechanics - **Solution Required**: Complete buff/debuff system #### ❌ **No Collision Detection** - **Problem**: Projectiles don't check for hits during flight - **Impact**: Cannot implement skillshots properly - **Solution Required**: Physics/collision system integration #### ❌ **No Channeling System** - **Problem**: Cannot interrupt or track channeling - **Impact**: Missing critical LoL mechanic - **Solution Required**: Channeling state machine #### ❌ **No Movement Abilities** - **Problem**: No dash/blink/teleport support - **Impact**: Cannot implement mobility skills - **Solution Required**: Movement ability framework ### 5.3 Network Limitations #### ❌ **No Rollback System** - **Problem**: Cannot recover from desync - **Impact**: Competitive integrity issues - **Solution Required**: Deterministic simulation with rollback #### ❌ **High Latency Feel** - **Problem**: Server round-trip before visual feedback - **Impact**: Feels unresponsive - **Solution Required**: Client prediction ### 5.4 Combat System Limitations #### ❌ **No Damage Type System** - **Problem**: All damage treated the same - **Impact**: Cannot balance physical vs magic - **Solution Required**: Damage type framework #### ❌ **No Defense Calculations** - **Problem**: No armor/MR system documented - **Impact**: Cannot implement proper defense - **Solution Required**: Defense stat system ### 5.5 UI/UX Limitations #### ❌ **No Skill Indicators** - **Problem**: Players cannot see ranges/hitboxes - **Impact**: Poor player experience - **Solution Required**: Range/hitbox visualization system #### ❌ **No Cooldown UI** - **Problem**: No visual cooldown timers mentioned - **Impact**: Poor player feedback - **Solution Required**: UI system for cooldowns ### 5.6 Development Complexity #### ❌ **C++ Complexity** - **Problem**: Manual memory management, complex debugging - **Impact**: Slower development, more bugs - **Mitigation**: Requires experienced C++ developers #### ❌ **Tight Coupling** - **Problem**: GFX system tightly coupled to attack system - **Impact**: Hard to reuse for non-damage effects - **Solution Required**: Abstract effect system --- ## Part 6: Suitability Assessment ### 6.1 For Basic LoL-Style Skills **Suitable For:** - ✅ Simple targeted abilities (e.g., Annie Q, Garen Q) - ✅ Basic projectiles with single target (e.g., basic attacks) - ✅ Simple AoE damage (with modifications) **Not Suitable For:** - ❌ Skillshots (no collision detection) - ❌ Channeled abilities (no channeling system) - ❌ Movement abilities (no dash system) - ❌ Buff/debuff abilities (no status effect system) - ❌ Complex ultimates (missing multiple systems) ### 6.2 Required Modifications for Full LoL Support **Critical (Must Have):** 1. **Buff/Debuff System** - Core mechanic 2. **Skillshot Collision** - Most common skill type 3. **Client Prediction** - Responsiveness 4. **Channeling System** - Many ultimates 5. **Movement Abilities** - Many champions **Important (Should Have):** 6. **Damage Types** - Combat balance 7. **Defense System** - Combat balance 8. **Area Effect System** - Many skills 9. **UI Indicators** - Player experience 10. **Rollback System** - Competitive integrity **Nice to Have:** 11. **Toggle Skills** - Some champions 12. **Advanced Projectile Mechanics** - Piercing, blocking ### 6.3 Effort Estimation **To Support Basic LoL Skills (50% of champions):** - **Effort**: 3-6 months - **Team**: 2-3 engineers - **Changes**: Moderate (new systems, modifications) **To Support Full LoL Skills (100% of champions):** - **Effort**: 12-18 months - **Team**: 4-6 engineers - **Changes**: Major (architectural changes, new systems) --- ## Part 7: Recommendations ### 7.1 Short-Term (Quick Wins) 1. **Add Client Prediction** - Predict skill outcome locally - Correct when server responds - Immediate visual feedback 2. **Expand Skill Types** - Add skillshot type - Add channeling type - Add movement type 3. **Basic Buff System** - Simple status effect container - Duration tracking - Basic visual representation ### 7.2 Medium-Term (Core Features) 1. **Collision Detection System** - Projectile hitboxes - Collision layers - Piercing mechanics 2. **Channeling Framework** - Channeling state machine - Interrupt conditions - Progress tracking 3. **Movement Abilities** - Dash/blink system - Pathfinding integration - Collision handling ### 7.3 Long-Term (Full Support) 1. **Complete Buff/Debuff System** - Stacking rules - Complex interactions - Full UI support 2. **Combat System Overhaul** - Damage types - Defense calculations - Critical strikes 3. **Network Architecture** - Rollback system - Deterministic simulation - Advanced prediction ### 7.4 Architecture Recommendations **Suggested Refactoring:** 1. **Abstract Skill Effects** ``` ISkillEffect (interface) ├── DamageEffect ├── BuffEffect ├── MovementEffect ├── ShieldEffect └── VisualEffect ``` 2. **Separate Logic from Visuals** - Skill logic runs independently - Visuals are just presentation - Easier to test and modify 3. **Event-Driven Architecture** - Skills emit events - Systems subscribe to events - Loose coupling --- ## Part 8: Conclusion ### 8.1 Summary The Perfect World C++ skill system provides a **solid foundation** with: - ✅ Server-authoritative architecture - ✅ Robust GFX system - ✅ Good performance characteristics - ✅ Clear separation of concerns However, it **lacks critical features** for League of Legends: - ❌ No buff/debuff system - ❌ No skillshot collision - ❌ No channeling system - ❌ No movement abilities - ❌ No client prediction ### 8.2 Final Verdict **Is it enough to deploy LoL-style skills?** **Answer: NO, not without significant modifications.** **For Basic LoL Skills (30-40% of champions):** - ⚠️ **Possible** with 3-6 months of development - Requires: Buff system, skillshots, client prediction **For Full LoL Skills (100% of champions):** - ❌ **Not feasible** without major architectural changes - Requires: Complete overhaul of multiple systems - Timeline: 12-18 months ### 8.3 Recommendation **Option 1: Extend Current System** - Pros: Reuse existing architecture - Cons: Significant development time - Best for: Long-term project with dedicated team **Option 2: Hybrid Approach** - Use current system for basic skills - Build new systems for advanced skills - Pros: Faster initial deployment - Cons: Two systems to maintain **Option 3: New Architecture** - Build LoL-specific system from scratch - Pros: Optimized for requirements - Cons: Lose existing work - Best for: Greenfield project --- ## Appendix A: Skill Type Comparison Matrix | LoL Skill Type | Current Support | Gap | Priority | |----------------|-----------------|-----|----------| | Targeted | ✅ Full | None | - | | Skillshot | ⚠️ Partial | Collision detection | CRITICAL | | AoE | ⚠️ Partial | Shape system, indicators | HIGH | | Channeled | ❌ None | Channeling system | HIGH | | Toggle | ❌ None | Toggle state | MEDIUM | | Passive | ✅ Basic | Advanced triggers | LOW | | Dash/Blink | ❌ None | Movement system | HIGH | | Buff/Debuff | ❌ None | Status effect system | CRITICAL | | Shield | ❌ None | Non-damage effects | MEDIUM | --- ## Appendix B: Network Latency Analysis **Current System:** - Client input → Server: ~50-100ms (network) - Server processing: ~10-20ms - Server → Client: ~50-100ms (network) - Client delay (`timeToBeFired`): 200ms - **Total**: ~310-420ms before visual feedback **LoL Requirement:** - Client prediction: 0ms (immediate) - Server correction: ~50-100ms (network) - **Total**: ~50-100ms perceived latency **Gap**: ~260-320ms additional latency in current system --- *Document Generated: 2025-01-27* *Based on: Skill Flow Documentation.md*