Pretty simple question: I’ve got a bunch of non-replicated turtle critters placed throughout the map in my multiplayer game (a few hundred). I want to delete them after a certain event (a huge explosion) but it seems impossible.
To be clear:
The server can delete them no problem, but this deletion obviously does not get propagated to the clients because we are dealing with non-replicated Actors in this case (on purpose, there’s too many to replicate).
Clients can normally delete local non-replicated Actors that they spawned, but that’s not the case here because the Actors are carefully placed throughout the level (not spawned at runtime) and Unreal says the client has no Authority over them. All DestroyActor calls are ignored.
Is there nothing that can be done? Non-replicated Actors placed in maps seem to be completely impossible to delete on a client computer.
On a side note, I feel like this used to be possible in earlier versions of Unreal. Was this feature just removed recently?
That’s a new problem I haven’t seen before. I wonder if because they’re placed in the level and the Server owns the level (I think), then it considers the server to own them even though they’re not replicated?
Just brainstorming here:
If on the client device you were to set the Owner of each Turtle to Player 0, I wonder if that would work.
Or maybe change their network role to Remote Authority or something like that.
I think you need to call “Tear Off” on server on those actors, this will complitly cut off actor from replication.
After that you just need to send function call to client using some different actor and make raise some event that will delete actors or even better use some already existing event that raises when you need it.
Unfortunately, “Tear Off” does nothing because the Actors are never replicated in the first place. They’re just ordinary non-replicated Actors placed throughout the level. A separate network event does arrive (via the level blueprint) which instructs them all to delete themselves. I can confirm this event arrives successfully (it prints a message). Deletion succeeds on the server, but fails on the client, because it seems it’s impossible for clients to delete ordinary non-replicated Actors placed in a level…
You might be right. If you check (on client) using “has Authority” for non-replicated Actors placed in a level, the result is “Is Remote”. If the client spawns a non-replicated Actor itself, the result of the Authority check is “Has Authority”. The client seems to believe it has no Authority over ordinary non-replicated Actors placed in the level (only the Actors it spawns itself).
Sadly, setting the owner to the local player-controller seems to have no effect. I’m not sure about trying to have the client change the RemoteRole. I’m currently in a Blueprints project, and there seems to be no way to set those values directly.
Ironically, the client can do everything else to placed Actors (set invisible, disable collision, disable Actor Tick, scale down to zero, move 100 miles away) but it can’t actually delete them. For now, making these Actors invisible and non-interactive seems to be the only workaround.
If the actors are not replicated then they will not be able to refer to each other across the network. But you can do things to FIND them after a multicast for example.
In the case of a large explosion you can check if they’re overlapping a spherical collision volume, or if they’re within a certain radius distance.
For specific objects you can use object names or Tags to find them and then perform the action on them.
I bet there is a better way but those are two work arounds I have thought of.