Download

Best way to cut off a replicated actor on the client?

In short, I am merging actors over the network to avoid delay. Pretty standard setup, client input spawns a local actor and calls a run on server event that spawns a replicated version of the actor, once the replicated actor arrives from the server, the client owning that local impostor actor destroys the impostor and the replicated version smoothly (with some interpolation logic) takes its place. The issue is that since some actors following this logic can spawn and be destroyed pretty fast, it can happen that the replicated actor arrives after the local impostor actor has already been destroyed (even at small latencies the replicated actor popping into existence for a few dozen milliseconds is noticeable). So far I’ve handled that by simply hiding the replicated actor on the client if the impostor is no longer valid, however this isn’t quite satisfactory as there is logic, sound, etc that will still run on the hidden actor.

Is there a way for a client to simply refuse the replicated actor, or otherwise ignore it? TearOff() only works on the server. An alternative would be to flip a non-replicated boolean on the replicated actor, but that would mean putting in a boolean check on just about every piece of logic it runs, which would be a lot of boilerplate code so I’ll leave this as last resort.