Week 4: Implementing a Networked XP System

Introduction

This week, I focused on developing a server-authoritative XP system to support our game’s progression mechanics. The system includes:

  • A networked XP counter with scaling level thresholds
  • A global UI slider visible to all players
  • Foundation for future stat-selection mechanics

I ensured this system aligns with our core gameplay loop of combat → rewards → character growth.

Design Rationale

The system was designed to:

  • Maintain Performance: Uses Photon Fusion’s [Networked] properties for efficiency.
  • Sync Across All Players: Server-managed values prevent cheating or desynchronization.
  • Scale with Progression: Level-up thresholds increase by 100 XP per level.
  • Support Future Features: Built to integrate with unassigned stat upgrades (design placeholder).

Implementation

1. Server-Managed XP Slider (Client-Side UI)

Above is the core implementation of the XP_Slider script:

Key Features:

  • Automatic reference to the networked XP_System
  • Real-time UI updates via Update()
  • TextMeshPro for crisp text rendering

2. Networked XP Logic (Server-Authoritative)

Above is the core implementation of the XP_System script:

Key Features:

  • Network-safe value modification (StateAuthority only)
  • Event-driven XP allocation via onEnemyKilled
  • Linear threshold scaling for predictable progression

Collaborative Challenges

Provided test build with debug XP gain shortcuts

UI Synchronization:

  • Initial client-side slider jitter resolved with Networked properties

Event System Refinement:

  • Created custom onEnemyKilled event to avoid GameObject searches
  • Worked with combat programmer to standardize XP values per enemy type

Design Coordination:

  • Documented API for future stat-selection UI integration

Reflection

What Worked Well

  • Networked properties simplified state synchronization
  • Linear XP scaling provided clear progression pacing
  • Decoupled UI system allows easy art replacement

Areas for Improvement

  • Level-up events lack visual/audio feedback (placeholder only)
  • Current UI doesn’t show “XP to next level” numerically

Next Steps

Player Feedback:

  • Add particle effects on XP gain (collaborate with VFX team)
  • Implement “level up” sound

Stat Selection System:

  • Develop upgrade menu interface
  • Create [Networked] stat modifiers (attack speed, health, etc.)

References

Leave a comment

Design a site like this with WordPress.com
Get started