1.0 Introduction
The Multiplayer Synchronized Ragdoll plugin is capable of achieving network synchronization functionality for up to 30 ragdolls. This plugin provides two types of network synchronization modes to meet the differentiated requirements of synchronization accuracy and efficiency. The network part of this plugin is based on Photon, while the ragdoll part is based on Ramecan Mixer.
2.0 Quick Start
STEP1: Preparing the Doll Character
A structure is required for separating the doll and the model.
Step 2: Mount the Ragdoll Synchronizer Script
Mount the Ragdoll Synchronizer on Root and choose the mode to be used.
Full Body Mode:
The Full body mode does not require any special settings, you just need to name the state well.
Key Bones Mode:
For key bones mode, we need to specify the key skeletons that need to be synchronized and also specify the name of the state.
STEP3:Configure Photon PUN
Open the Photon Server Settings configuration window and fill in your PUN App Id in the corresponding position.
STEP4:run the program
After the program runs, it will automatically generate characters. Press the “R” key to turn on and off the doll’s status.
3.0 Implementation Principles
3.1 Full Body Synchronization:
In order to achieve more accurate effects, we choose full-body synchronization and do not enable physics simulation for the copied objects.This way, the pressure on player devices is low, each person only performs their own physical simulation, but the network pressure is relatively high. Once there is network jitter, all ragdolls except for the player’s own will freeze or behave strangely.After testing, the upload traffic of each client almost reaches 10-20kb/s, which is slightly high, but the effect is excellent.We directly synchronize the position, rotation on each bone of the ragdoll.
However, such a crude scheme will have some issues:
The network synchronization frequency (about 10 times per second) is much lower than the refresh rate, and the local simulation results are biased, leading to jitter.The Photon component takes into account the interpolation problem, as the still-present jitter is due to excessive physical calculation deviation.It requires simultaneous synchronization of data for 20 bones, posing high requirements for network traffic.
3.2 Key Bones Synchronization:
For network performance, sacrifice a portion of the doll network synchronization accuracy, only sync the key skeletons, and enable all dolls in the client to run physical simulations.The pressure on player equipment is high, each client needs to run physical simulations for all dolls, which has low network pressure.After testing, the upload speed per client is almost only 3-8kb/s.Sync the key skeletons and perform physical simulations for the remaining skeletons.
The synchronization effect is very good, with only minor jitters in the key skeletons that may occur in more significant jitters under complex collision scenarios.
The synchronization quantity further decreases.