Download

Replicating too many variables?

Hi All,

I seem be constantly end up replicating quite a few variables for my Multiplayer animation setup and I am wondering if I just think about it all in the wrong way.
I’m worried about adding lag for doing too much over network and also about just jamming the network with too much data.

I start with just one or two bools, say moveForward and isMoving, but then I have these other ones that also control my animation system that also needs to be set in a reliable manner for all clients.
Ending up with 10-20 variables that get reliably replicated.

Is this ok?

Or should I just replicate some ‘gate keeping’ variables (the bools?) and then do the others locally?

I sort of lose track of why I am doing all this in the first place! :slight_smile: Why all this replication? What is really important?

Someone said in a thread to think of it as in the non server clients just being input devices + monitor. Is that correct?
Then I do end up sending everything to the server and the server has to do most of the work for all players.

I have done the tute videos a couple of times but they don’t do very detailed animation setups, and the youtube animation controller videos I find seem to be mainly single player so not sure how much I should trust those for what I am doing.
It also gets confusing with what should I do in the Character Blueprint, and the Animation Blueprint, what should be Montage slot playing and what should be state machines. Too many options.

Would anyone be able to give a philosophical framework for how to think about this?

Sorry for the wooly question.

Cheers
Fred

Although it has been quite a while since you have asked this question, I too am interested in the answers to this. I am experiencing exactly the same problems. Fred did you manage to find some useful information to share? Or maybe somebody else is able to provide some insight!

Thank!

This is a pretty wide question.

To me it looks like you have too many replicated variables indeed.

Think of it this way: each replicated / repNotify / Multicast event is a gate through the network and you’ll have to use as few as possible to get your multiplayer game working.

An example of this:
You have a “bIsMoving” boolean variable in your Animation Blueprint and right now it is replicated. So we can consider this a networking gate.
But you actually already have a networking gate that allows you to check if a character is moving, on any machine.

I think your movement input looks like this:
ActionInput->Pressed->AddMovementInput.

I also suppose, your Character has the boolean “ReplicatesMovement” equals true. In this case, the MovementInput is already sent to the Server (it’s coded and optimized by Unreal in the CharacterMovement component) and the Character is moving on every machine.

If something is moving, it’s likely to have a Velocity (a Vector property you can get on anything that inherits from Actor) that tells you in what direction your Character is moving.

If this vector = zero, it means the character is not moving, if not it means he is.

This is a gate that allows you to turn off the replicate of your “bIsMoving” boolean. And you can apply the same thought process to every variable you have: “do I have a networking gate before this?”.