How to make client have no authority over server-spawned actor

Bold Dog
Wed, 23 Aug 2017 13:07:03 +0000
Multiplayer & Networking

Hi All,

I’ve come up against a really simple problem that I can’t seem to find the answer to after googling around.

In the game I’m making, when the character presses a button it spawns a rock that flies through the air. This rock needs to do things when it hits targets. I want all of the code for this done on server-side, as this is intended to be a multiplayer game and it all needs to be synchronised.

The server spawns the rock from the player pawn as shown here. The rock is not set to replicate.

This seems to function fine, and clients & server both see the rock behave correctly and only 1 rock is spawned in any instance.

However, it seems that the clients have “authority” over their own versions of the rock that are spawned, even though it was a server ‘execute on all’ that spawned them, as shown here in the rock’s blueprint:

I want the server to handle the hit when it occurs. However, as the client seems to have authority over its own rock instance, whenever I try to get the server to handle the hit (again, using an ‘execute on all’ after the authority check), all of the logic is applied twice because the client also runs the code. This means, for example, that dealing damage to a player with the rock happens twice.

How do I stop the client from having authority over the rock? Is there a way to prevent code from running on a client separately from the ‘authority’ check? Also, why does the client have authority over the rock in the first place given that the server spawned it? My understanding was that the server basically has authority over everything it spawns.

I’d appreciate any enlightenment at all as this is driving me insane!

2 posts - 1 participant