Client cannot perform special actions

Hello everyone,

I created some classic movements for players as the dash or 2jump, but client can’t use it, and only run and jump like a basic tps character. So I know that there’s a loooot of post relating about that on this forum, working with the “Switch has authority”, but I don’t understand how to use it properly. I probably have to make more functions to run with, but some times I need events, that are not present in the function graphic.

Here’s some screens of my blueprints :

How could I make it ?

Thank you !

Ok so I’ve seen many tutorials since my last post, and I’m sure I’m pretty close to the solution.
Here’s another action that I’ve tested networking on :

http://image.noelshack.com/fichiers/2016/40/1475859795-blueprint4.jpg

I made a “DashEvent” multicast replicated, and my “RIsPressed” variable is set on replicated (although I don’t know if it’s needed). I builded it following the “Replicating Function in Blueprints” tutorial. But the fact is it still doesn’t work. I don’t know if I’m searching in the right direction, because replication is used to display an action to chosen players/server, right ? And in my case the client just cannot perform the action…

What am I doing wrong ?

Edit: when I set my “DashEvent” to “Run on Server” like in many tutorials, the client can make the server dash, so in a way it’s working. I don’t get it.

When you say

Edit: when I set my “DashEvent” to “Run on Server” like in many tutorials, the client can make the server dash, so in a way it’s working. I don’t get it.

Do you mean it works on the server window but not in the client window?

Oh wait I just noticed that you are using GetPlayerPawn always on index 0. What kind of blueprint are you working on in that image? Is it a controller? Because if you are working with gameplay input I would suggest doing it inside your character blueprint, so you can use a reference to self instead of the GetPlayerPawn node

Nope, the action is diplayed on both windows. But the action is not exactly the same : instead of dashing, the server do some sort of quick run. Also, I don’t know if it’s usefull but the project was setup from the unreal multiplayer blueprint.

Yes I’m working on my character blueprint, named 0_base like in the unreal multiplayer tutorial

Edit: 0_base is not the character used in game, it replicates all the blueprint inside it in the others character blueprint (or something like that…)

I managed to simplify the blueprint thanks to your comment

http://image.noelshack.com/fichiers/2016/40/1475862852-blueprint5.jpg

Ok I think maybe this is the problem. The character movement component is not replicated. So when you tell the server to do a dash you are changing the Ground friction in the server but not back to the client, so you need to also set the ground friction before calling dash event

ok thanks, when I don’t use the ground friction my client is able to dash, but it does in the opposite direction… And I need to set the ground friction while calling the dash event because it checks if the player is dashing. Is there really no way to replicate the character movement ?

Not really. Give me a few mins and I can post some screenshots of how I would do it

Nice thanks !

okay reaaally nice it works fine now !

So yep i have some questions for you :

  • Why do you set the ground friction twice to 0 ? since you told me that it can only be set before the dash event

  • Add Impulse also use character movement as target, does it’s replication not matter because it’s not part of character movement ?

  • Doesn’t SetClientFriction owning client event risk hack from client ? and if not
    why the ServerDash event is not on owning client too ?

I know I ask a lot, so thank you already for your help

Much more clear now, I will use your explanations as a base for all the others custom actions !

Thank you very much for your help and time, I had a hard time computing all these new networking process in my brain, but I have the feeling it’s gonna be a bit easier now :slight_smile:

Here it is. This is how I would do it. Tell me if you have any questions!

Why do you set the ground friction twice to 0 ? since you told me that it can only be set before the dash event

I said that you needed to set it also before the dash event. Ok technically I set it 4 times. The first one, right after the input, happens on the client version of your actor actor, then inside the serverDash event I set it 2 times once before the impulse and one .25 seconds after that. This 2 that are set inside the serverDash event are happening only in the server version of the actor. And finally I set it a fourth time but I’m doing it back in the client actor.

Add Impulse also use character movement as target, does it’s replication not matter because it’s not part of character movement ?

I’m not really sure what you are asking. But in reality I don’t know the real reason why character movement component is not replicated by default I guess it has to do with how you are supposed structure your code.

Doesn’t SetClientFriction owning client event risk hack from client ? and if not why the ServerDash event is not on owning client too ?

I don’t think so. Because even if a hacker managed to call the SetClientFriction with his own custom value it would only execute on his client, so the server would still have the correct friction.

If you are worried about security and players seting the friction value you could do the following:

  • Have your own friction variable and
    make sure it’s replicated.
  • Inside the tick function set the value of characters movement’s friction with
    your replicated friction.

This way, even if they manage to change the value on their client it will only last one frame in their client.

Also

If you are really worried about security I suggest stop using blueprints and go for C++. There’s a lot more ways to handle this kind of problems in actual code. With C++ you can tell your RPC’s (Remote Procedure Calls AKA the execute on server function, multicast, etc.) to disconnect a client if the value the function received is out of some boundaries or any check you want to do to the value really.