x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 : alt text

How could I make it ?

Thank you !

Product Version: UE 4.12
Tags:
blueprint1.jpg (517.7 kB)
more ▼

asked Sep 29 '16 at 03:07 PM in Blueprint Scripting

avatar image

Waz0
6 2 5

avatar image Waz0 Oct 07 '16 at 05:04 PM

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 : alt text

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.

avatar image MacDx Oct 07 '16 at 05:15 PM

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?

avatar image Waz0 Oct 07 '16 at 05:31 PM

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.

avatar image MacDx Oct 07 '16 at 05:25 PM

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

avatar image Waz0 Oct 07 '16 at 05:32 PM

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...)

avatar image Waz0 Oct 07 '16 at 05:51 PM

I managed to simplify the blueprint thanks to your comment alt text

avatar image MacDx Oct 07 '16 at 07:16 PM

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

avatar image Waz0 Oct 07 '16 at 08:10 PM

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 ?

avatar image MacDx Oct 07 '16 at 09:13 PM

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

avatar image Waz0 Oct 07 '16 at 09:31 PM

Nice thanks !

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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

alt text

example.png (295.0 kB)
more ▼

answered Oct 07 '16 at 09:51 PM

avatar image

MacDx
600 17 9 32

avatar image Waz0 Oct 07 '16 at 10:26 PM

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

avatar image MacDx Oct 07 '16 at 10:45 PM

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.

avatar image Waz0 Oct 07 '16 at 11:02 PM

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 :)

avatar image MacDx Oct 07 '16 at 10:51 PM

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.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question