Introduction
For the third week of our group game development project, my primary focus was designing and implementing a networked enemy spawner. This system introduces enemies into the game world when a player triggers a specific object (such as a trap). The spawner manages enemy instantiation at set intervals, enforces a maximum enemy limit, and synchronizes these events across all players using Photon Engine and Unity.
Design Rationale
Although my main responsibility is programming, I approached this task with a design-oriented mindset. My goals for the enemy spawner were to:
- React to player interaction by activating only when triggered.
- Enforce a maximum enemy count to maintain game balance and performance.
- Introduce a spawn delay to create tension and pacing.
- Synchronize enemy spawning across the network so all players share the same experience.
I collaborated with the design team to ensure the spawner’s behavior supports our weekly group objectives and enhances the intended gameplay loop.
Implementation
Below is the core script I developed for the enemy spawner. It leverages Photon Engine for networked object spawning and Unity’s game object system for positioning.
Key Features
- Trigger Activation: The enemySpawnerActivator flag is set by player interaction, ensuring the spawner only activates at the right time.
- Networked Spawning: Uses Fusion’s
Runner.Spawnto ensure all players see the same enemies. - Spawn Limiting: Checks the current enemy count before spawning new ones to maintain the maximum limit.
- Randomized Positioning: Spawns enemies at random points within a defined radius for unpredictability.
Part 1: Melee Attack System
At the design team’s request, I developed a prototype melee combat system for our close-range character. This required:
- Ensuring network-synchronized attack motions
- Distinguishing melee/ranged characters via
characterType - Creating a temporary weapon animation (pending final art assets)
Design Choices
- Positioned weapon via code (
characterTransform()) to support future art iteration - Created procedural weapon swing animation (arc rotation)
- Added attack delay to prevent spamming
- Used
Networkedproperties to sync attack states
Part 2: Mouse-Driven Player Rotation
To improve combat fluidity, I replaced keyboard-based rotation with mouse-aiming:
Key Features
- Ground-plane projection for consistent 3D aiming
- Smooth rotation interpolation (
Quaternion.Slerp) - Network-synced orientation using Fusion’s
[Networked]
Collaborative Process
Documented transform requirements for 3D artists
Design Coordination
- Worked with designers to balance attack speed/delay
- Created temporary visual feedback for testing (weapon arc)
Technical Challenges
- Synchronized animation states across network
- Resolved camera-raycasting issues in multiplayer
- Optimized
FixedUpdateNetworkfor input responsiveness
Art Pipeline Preparation
- Structured code to easily replace procedural animation with future art assets
Reflection & Iteration
What Worked Well
- Hybrid approach (code-driven animation + network sync) accelerated prototyping
- Mouse rotation significantly improved playtest feedback (“More intuitive than keyboard turning”)
Areas for Improvement
- Current weapon reset uses linear interpolation – could benefit from animation curves
- Networked rotation occasionally jitters at high latencies
Next Steps
- Collaborate with artists to replace procedural animation
- Implement hit detection with enemy spawner system
- Add visual/audio feedback for attacks
References
- Photon Engine. (2025). Fusion 2 Introduction. Retrieved May 2, 2025, from https://doc.photonengine.com/fusion/current/fusion-intro
- Unity Technologies. (2025). Unity Engine. Retrieved May 2, 2025, from https://unity.com/products/unity-engine
- ShareX. (2025). 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



