How to call a RPC function by a Multicast ? (OnTakeDamage->LaunchChar not smooth with ping)

Hello,

I know the basics for the Multicast, Run On Server, for example, this is how i would do a basic Dash :

But now, i have a problem that i dont know how to deal with.

When, my IA attacks a local player, i call “Apply Damage”, and then, i use "Launch Character " on the damaged actor with “OnTakeDamage”, and it works less and less as the ping goes up.

And i know why, its because de Launch Character is called by the server, and not locally.

For example :

• Get damaged by an AI on Client with 0ms → Launched, smooth, perfect
• Get damaged by an AI on Client with 100ms → Got teleported in air, not smooth at all
• Get damaged by an AI on Client with 200-300 ms → Not moving at all

I know what is happening with 200-300ms, its because on the server, the client already jumped from the TakeDamage function and has already landed.

I’m really struggling, and i dont know what i’m doing wrong, how could i Launch smoothly, and locally, the damaged client ?

Thanks a lot for your help !

Do you have network emulation disabled in editor preferences?

Have you tried tweaking your blueprints network update frequency?

Yes Network Emulation is disabled, i use the console command NetEmulation.PktLag to add ping

i’ve tried a little but it didn’t changed anything, the server always teleport the client to where it should be…

It is about Network Emulation on editor preferences ?

I’m sorry if i’m not clear, the problem is not the lag itself, because i’m adding it to see if it is playable at 200ms,
and for now, my jumps, attacks, and dash works perfectly, even with 200ms, because i can call them locally (on the owner) and on server + multicast

But when my Enemy’s attack Multicast call a damaged actor’s function “TakeDamage”, it do not call it locally, and so what, i cannot make a RPC for the Launch Character function to be smooth on the client.


Okay, i tried everything i could, and it’s working now, but i dont know if it’s the way to do it

It’s the “Owning Client Only” was i needed ? to, then, call the server things ?

Thanks !

That’s great! If you’re experiencing/adding 200ms of lag you’re likely to have quite a bit of stuttering/ rubber banding on the client in any case lol. That just about should result in client disconnection from the server and people are gonna have a hard time playing with that guy.

Network emulation in the editor preferences simulates network conditions/lag, but I believe it doesn’t just push through a consistent packet loss, but varies the loss much like a typical connection.

Yep i know but i want to make my game “”""“playable”""" at 300, but yes, it’s obvioulsy gonan stutter with latency, but with client prediction it’s really helping to deal with that.

Now the Launch Character is called on client THEN on Server+Multicast, so, with the client prediction, it’s almost not visible that it have 300ms !

Thank you for your help, have a good day/night !!!

1 Like