Actor(character) rotation not working in multiplayer.

I have a small problem with trying to build in networking into my project.

The problem is, I can see the other player moving, but the rotation is not shown. So the place in the world is perfoect, but the rotation isnt.
I got a tank as the playable character, and i got this problem with the hull, turret and barrel (all seperate components of the tank)

Neither the server nor the client sees the other player rotating.

I also noticed that when shooting a missile with the server, the missile is actually going the way it should (even if it looks like it’s coming out of the side because the rotation is not shown on the client).
But when I shoot with the client (so watching on the server screen), the missile is always going the same way (starting position) even if I turned.

I’m not really sure what blueprint screenshots or other info you guys need, but please just ask me if you need more info on this to be able to help me out.

The character has the ‘replicates’ checkbox ON.

It clearly sounds like its a problem with your replication. The rotation is probably not setup for proper replication thereof not being seen on the other characters.
If you could provide screenshots on all the parts where the rotation handling is taking place it would help a great deal in trying to get it right for you :slight_smile:

The same with all other parts that isn’t shown on the clients.

The basic thing that isn’t working for you is that the “Replicates” checkbox only allows the actor to be replicated. Then you have to add the other stuff you want replicated for it to happen to everyone.
The basic flow for this in Unreal should be Client -> Server -> All clients. Where the actor you are rotating in this case asks the server if it can [Insert you action] then the server says yes/no and performs the action and replicates it to all other clients for it to be shown on in their game (ex. rotating).

If you want to take a stab at making it rotate yourself here is a great start:

Thanks for the info.
I will post a screenshot once I get home (at work now).

I’ve been looking at these videos, but still can’t figure it out completely. I must be overlooking something, so I hope you can help me when i post the screenshots of the movement parts in the blueprint.

Sure! I’ll give it a try when I have seen the blueprints :slight_smile:

well, while I was searching for some more info I found out that the add movement input replicates automatically. Which would explain the behaviour.

I have not build in any server nodes yet for movement since It looked like it would be automatic (same as the starting templates). But this does not seem to be the case.

I would still love to get a hint / tip on where to start with getting networking into my movement blueprints, so I will post the blueprints requested anyway :slight_smile:

Great, I will have look a bit later tonight. I’m away right now so can’t really help you from here. But if nobody else has already helped you I’ll check it when I’m back home again :slight_smile:
But great that you have started to find your way around it a bit, even though I gladly help people its most of the time much better if people try and find it themselves first, I think you learn more from at least giving a good try first!

Ok made a small edit now, and now the server can see the client rotating. But the client does not see the server rotating. So I’m getting closer now :stuck_out_tongue_winking_eye:

Ok then, lets have a look at this. From what I can see nothing is replicated in those pictures more than a variable or two.
I sadly don’t have the time to show you how to do that exactly in those examples, but I will try and give you a way to do it so perhaps you can figure it out yourself.

First thing we need to when the input button is pressed is to tell the server you have pressed that button and then the server will make/replicate the rotation to all the clients.

In this picture I make a custom event that is set to Run on server in the details panel (on the right side default) and the Reliable checkbox is set to true as well.
Then on the server I set a bool called Sprinting, after a branch that checks what state the bool is in. The Sprinting bool is also set to RepNotify in the details panel.
This is one of the magic tricks that is crucial to know in Unreal when working with Replication. This will trigger a function automatically when changed and that function is replicated to all clients from the server.
A very good thing to know as well is that all variables only replicates Server->Client and not the other way. So you have to execute everything you want changed on the server.

This is my On Rep Sprinting-function that is called when the Sprinting bool with RepNotify is changed. This will run on all clients now so that what you actually did is changed for all players. This example I got together here is not the best one in reality as you could move more things into the server side of things. But I just wanted to throw a quick one together for you :slight_smile:

Haha, you wrote that while I was making my post :wink: Hopefully you will get some help with it from my small “tutorial” :slight_smile:
You also have to replicate some appropriate variables depending on what you change on the server/RepNotify (If you use repnotify that is, there is other ways to do it as always) :slight_smile:

I will look into it tomorrow. Thanks for the help already.

No problems man, just glad if I can help a fellow Unreal users in need of a guiding hand :slight_smile:

Ok been busy with your tips, but I can;t get it to work just yet. I might overlook something.

The current (non replicated) way of turning is looking like this:

And with replication I tried to create it like the following:
And the repnotify function:

It seems like the custom server node is not being called when I debug the blueprint.
What is wrong here?

Hey Multensor, so unfortunately i’m still not to knowledgeable on networking so a lot of this is still experimentation and learning on the go, but I think I’ve got something that will hopefully further the conversation.

I’ll preface by saying that I am using a pawn instead of a character, so some things might be a bit different, but hopefully the concept is still the same.

So first here is the node setup that seems to have finally worked for me. I assume basically whats happening here is that first, Input Turn is being set and it’s rep notify is being called (you can see it’s functionality in the next image). Then we tell the server to do the same. The thing is is that I can’t help but feel like something isn’t quite right here, and yet it works (sort of. I’ll get to that later).

Here is the OnRepNotify function that is called when Input Turn is set. All it does is rotate the tank hull as usual, except instead of using GetTurn for the rotation amount, I just use my Input Turn variable. Also don’t mind the extra Turn function I made, I just got tired of copy pasting the same set of nodes while experimenting :slight_smile:

And finally here are the rest of the components of the tank using the same setup.

Now back to why there is something not quite right here. The tanks seem to have differing rotation and movement speeds, and I don’t know why. My current theory is that maybe delta seconds is messing with something, or this node setup is simply wrong in some way. So hopefully someone can let us know whats wrong here.

P.S. The custom events are set to Run on Server and Reliable.

I had a problem that might take its source from the same thing.

We discussed it on this answer hub.

Here are the leads I followed:

  • Multicast the rotation update
  • Find out if we messed up some of the Rotation / Movement Replication presets
  • Cast on Client the rotation update
  • Update locally on event tick the rotation update through replicated rotation variable
  • Find out if we are locally overriding the rotation
  • Find out if there’s simply a bug in the Set Rotation Replication behaviour
  • Update the rotation locally
  • Toy around with the Character Movement Component properties “IgnoreBaseRotation” / “UseControllerDesiredRotation” / “OrientRotationToMovement”

Finally I managed to deal with my problem in a very ugly way:

  • Your rotation event triggers => send the rotation you want to a Server Event.
  • The Server Event sets the rotation of your Character (using “Set Actor Rotation”). Then stores the given rotation in a replicated Variable (lets say “MyRotation”).
  • Then on an event tick I’m casting on the client (Remote Authority) Set Rotation to “My Rotation”.

Hopfully i’ve got some time tonight to test this out. Will let you know. Thanks guys!

okaaay no time the last couple of days. I tried your method RO10 and it seems to be working, yet i got the same problem. The client is turning much slower than the server.

Anyone got an idea about that?