im making a multiplayer game with active ragdoll integrations.
to do that, i made a system to which the "host" client handles all the physics while the rest of the clients just recieve the bone poses and replicate them on a normal skeleton.
the inputs from the other clients work just fine, the host machine recieves them and handles them well. my problem comes from the pose synchronization. for this, ill need to explain the system further in detail.
each player will start with the "PlayerController" node, which contains a MultiplayerSynchronizer, a "ControlledBody" which is the one with the active ragdoll, a "SynchronizedBody" which will replicate the previous one's skeleton pose, and a "PlayerCamera" which... serves as a camera for the player (see the image for the complete structure). the MultiplayerSynchronizer has two variables synchronized: "input_sync_data", the input data, and "skeleton_sync_data", the skeleton pose data. both are PackedByteArrays
the player controller, when instantiated, will begin with its multiplayer authority being set and a "host" boolean, which indicates if it is in the host machine or not. then it will select one of the bodies to handle, the ControlledBody if host, the SynchronizedBody if not, and delete the other one in any of the cases.
in the process function, it will act differently depending on if it's host and if it's multiplayer authority:
- if it is multiplayer authority, it will take the input data and pack it inside the input_sync_data variable. if it's not, it will unpack it. the input data will be packed from and unpacked into dedicated input variables. as i said, this part works just fine
- if it is host, meaning it has the ControlledBody, it will call a function that packs the PhysicalBones data of it and store it in skeleton_sync_data. if it isnt, meaning it has the SynchronizedBody, it will take skeleton_sync_data and give it to a function inside the body, which will unpack the data and apply it to BoneAttachments
