Event RadialDamage not firing in multiplayer game

So I’ve been trying to figure this out for a few days now. Basically I have a multiplayer game with a ship firing a projectile at a simple target. When the projectile hits it applies radial damage. But the target never fires Event RadialDamage. The visibility channel is blocked and the target actor has take damage enabled. Apply Radial Damage is also only called on the server.

Target BP

Target Collision Settings

Projectile BP

Projectile Collision Settings

What I’ve tried

  • Enabling both generate hit/overlap events on both the projectile and target.
  • Changing the Object Type of the target to pawn, physics body, and world dynamic.
  • I even attempted to do point damage and that didn’t work.

Any help would be greatly appreciated.

I don’t know your sequence of events but I suspect that your “DamageStarfighter” event is not running server side. As you can tell by the server icon at the top right of the “Apply Radial Damage” node, this node only runs if it’s executed on the server side.

It seems like you’re aware of this as you have a “OnServer” check. A more appropriate way to handle that is to use the node “HasAuthority”. Where is “DamageStarfighter” being called? This seems like an event that should be set to run server side. Click on the event and change the replication to “Run on Server”. I would also put a print as the very first node of the event in order to see who is actually calling it and where it’s being called from (server or client).

Food for thought…

The typical design pattern for something like this is that the client version of an actor wishes to fire. To do so it reaches out to the server version to start this interaction using a server side event (Run on Server). That server side event checks to see if it can fire (ie it has ammo) and if it can it spawns a projectile (all server side). That projectile is set to replicate so it spawns on the server AND each client. Now you have a version of the projectile running on the server and on each of the clients. The server version is the only one that “matters”. Meaning any collision or damage application happens on that version of the projectile. There are a couple of ways to skin this cat but that is the typical way to handle it.

I tried setting the damage starfighter event to run on server but that didn’t do anything. The reason I don’t use HasAuthority is because of how I’m spawning projectiles. I spawn a projectile locally then ask the server to fire, which calls a multicast, spawning separate projectiles on the server and all other clients. The projectile on the server is the only one that handles damage because of the check I put in place. If I use has authority (since each projectile is spawned separately) it always returns true. I do this so the projectile dosen’t have to replicate which counteracts lag (to a degree). Below is a picture of BP_Starfighter_Launcher where I spawn projectiles (BP_Starfighter_Launcher is replicated). I even printed the value of on server after setting it to confirm that the clients have a OnServer value of false, and the server has an OnServer value of true.

BP_Starfighter_Launcher

The projectile even prints the name of the target when it hits it and draws a debug sphere where it should be. Also when placing a breakpoint on ApplyRadialDamage it only trips once on the server projectile. I honestly have no idea what this could be. At first I thought it was a collision problem, but it could be a replication error I’m just not catching.

Ok, couple of questions/thoughts…

  1. Have you tried the IsServer node? Might be a cleaner check than what you currently have
  2. Out of curiosity, is there a reason you orchestrated this method versus the typical replication paradigm? You seem to be jumping through a couple of book keeping hoops which can be avoided by allowing the replication system to do what it does.

That being said, you believe (via printouts) that the server version is in fact the one making the impact and calling “Apply Radial Damage”. I’ll believe that with you for the moment, so let’s focus on the actual damage call. There’s a boolean return value on that node that tells you if it believes it has hit something. What is this returning for you?

The bool returns true. The reason I’m doing this is because I set the engine to simulate network conditions with a slightly below average connection and experienced a delay in spawning when using the standard replication route. I looked at lag compensation for projectiles on a couple of forums and this method seemed like the simplest.

That’s what I suspected, just needed to hear it.

Ok, enough of that rabbit hole for the moment. Let’s focus on “Apply Radial Damage”. What I suspect is going on is that the radial damage is hitting your actual projectile and stopping there. To test this theory, go ahead and add “self” to the actors to ignore…like so

image

That was the problem. Thank you so much for the help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.