home..

Network Synchronized Multiplayer Boss Encounters

game development netcode

Disclaimer: The text in this post is generated by an AI chatbot based on a few bullet points.

In the world of multiplayer online gaming, one of the most exciting and challenging aspects is the ability to engage in boss encounters with your friends. These epic battles require precise synchronization of abilities and movements across all players to ensure a seamless and immersive experience. In my game, Mad Adventures, a multiplayer online party game featuring mini-games and boss fights, achieving network synchronized boss encounters was a crucial goal. In this blog post, I will delve deeper into the techniques and systems I implemented to accomplish this feat.

Leveraging the Power of Mirror

To achieve seamless multiplayer experiences, I relied on Mirror, a high-level Networking library specifically designed for Unity. Mirror offers optimized ease of use and a high probability of success when it comes to networked gameplay. By utilizing Mirror, I was able to establish connections between clients and efficiently send data across the network.

NAT traversal, the process of establishing connections between clients that are behind Network Address Translations (NATs), can be a complex challenge. To overcome this hurdle, I employed the SteamWorks API matchmaking and networking interface, which seamlessly integrates with Mirror. This combination allowed players to connect and communicate with each other, even if they were behind different NATs. In each party, one player was assigned as the host, acting as both a client and a server, while the remaining players served as clients.

Robust Event and Animation System

Synchronizing the abilities and movements of a boss character across multiple clients requires a robust event and animation system. To address this, I developed a system that could withstand potential network time skips, ensuring consistent and accurate synchronization.

Mirror takes care of synchronizing a time variable across the network, which I utilized to animate the boss NPC. The first step in achieving synchronization is determining which event is currently active based on the network time. This allows all clients to be aware of the current state of the boss encounter. Once the active event is identified, we calculate how far along we are within that event in terms of time. This information is vital for properly animating the boss character on each client’s screen, ensuring all players observe the same sequence of movements.

Physics Integration for Interactive Animations

Incorporating physics into animations adds an extra layer of realism and interactivity to boss encounters. For instance, you may have moving platforms or other physics-driven objects in your boss battles. However, handling physics objects in a networked environment requires careful consideration to maintain synchronization across all clients.

To achieve synchronized physics interactions, I adopted an approach that prioritizes using forces to drive the behavior of physics objects, as opposed to directly setting their positions and rotations. In this setup, the drawing mesh serves as the target for collision meshes. By applying spring forces to the collision meshes, we can ensure they follow the drawing mesh’s position and rotation accurately.

This method not only facilitates the synchronization of physics-driven animations but also enhances the overall gameplay experience by allowing players to interact with dynamic elements within the boss encounters.



© 2023 Lionel Pigou