Implementing Weapon Mechanics
With health systems in place, I focused on developing core combat mechanics. To support diverse playstyles, I created a modular playerShooter script that allows players to switch between pistol, shotgun, and rifle weapon types. Each weapon has unique fire rates, projectile patterns, and cooldowns.
Projectile Lifetime and Damage
Projectiles require careful network synchronization. I implemented a ProjectileCode class that automatically despawns after 2 seconds and handles damage calculation on enemy collision:
Loot System with Rarity Scaling
To support roguelike progression, I created an RNGSystem that generates randomized weapons with rarity-based stat scaling:
Enemy AI and Navigation
Enemies use Unity’s NavMesh to pathfind toward the nearest player. The EnemyScript includes XP rewards and loot dropping functionality:
Design Thinking
Combat Flow Design:
- Weapon Differentiation: Shotguns reward positioning, rifles enable sustained fire, pistols offer precision
- Risk vs Reward: High-damage enemies require teamwork to defeat but drop better loot
- Network Optimization: Projectile collision is authority-managed to prevent cheating
Technical Considerations:
Separated visual effects from network-critical code to maintain performance
Used Fusion’s TickTimer for framerate-independent cooldowns
Implemented object pooling for projectiles to reduce GC pressure
Reflection and Next Steps
Progress:
- Established core combat loop (shoot → loot → upgrade)
- Validated networked weapon behavior with 3 distinct types
- Implemented basic enemy AI that scales to 4 players
Immediate Challenges:
Optimizing NavMesh recalculation for large enemy counts
Balancing weapon stats across different rarities
Preventing projectile collision false positives in crowded battles
References
Unity Technologies. (2024). Rigidbody Physics System. Retrieved May 2, 2025, from https://docs.unity3d.com/Manual/class-Rigidbody.html
Unity Technologies. (2025). NavMesh Agent Documentation. Retrieved May 2, 2025, from https://docs.unity3d.com/Manual/nav-AgentTypes.html
Photon Engine. (2025). Networked Object Pooling Best Practices. Retrieved May 2, 2025, from https://doc.photonengine.com/fusion/current/manual/network-objects
ShareX Team. (2025). ShareX: Free and Open Source Screenshot Tool for Windows. Retrieved May 2, 2025, from https://getsharex.com
Imgur. (2025). Online Image Sharing and Hosting Service. Retrieved May 2, 2025, from https://imgur.com







