Replace locally spawned actors with server equivalents?

I’m attempting to accomplish lag free actor spawning from clients.

I’m going about this by calling Multicast on the client, and the server. This obviously spawns two copies of the actor on client machines - one locally, and one replicated. My question is - Is there a way for the replicated versions of the actor to destroy/override the local actors?

Alternatively - Is there a common best practice for tackling this issue/related lag compensation methods?

Did you ever find a good answer to this? In my case it’s for projectiles, so I was considering maybe sending the WorldTime with the firing command to the server, have the server move the projectile forward to account for the elapsed latency time, then send an RPC to the client to inform him to delete his rocket. Then, hopefully the replicated projectile would reach the client at the same time as the delete RPC.

Not a big fan of trusting the client with the time though, so maybe use average latency for the last few frames instead.

I have a rough method but I dont know how much I like it (untested at the time I am writing this). So in my case why I started also thinking about how to achieve this. I wanted to drop a user picked amount of an object from a stack in the players inventory. I did all the visual stuff and spawned it locally with the amount that was dropped. Then the idea I had was what if I sent the object to the server as a referance. I then do all the serverside variant of the code and spawn the object. I then send an RPC to run on owning client with the object ref to delete itself.

This should in theory spawn an object locally then spawn one serverside. As long as the object is replicated or you make a multicast RPC it will then go out to everyone. Then the one the local owner spawned to flow visually will then be deleted as the new one is spawned.

The only problem I can see is obviously that the object the client spawned wouldnt exist. So say given latency and what not if they then repickup said object. If they do that before the server gets done doing its calculations. Then the object ref or however you store your objects for your inventory wouldnt exist and would have to be replaced with the new info.

Hmm maybe if you replicated the variable holding your inventory obejct ref or did a repnotify. That might replace it to be accurate with what the server side would have dropped and picked back up. Repnotify might be best in this case to call and replace what your visuals might be holding say if you also stored a ref of the object in UMG.

But that’s my scenario so it depends on what the OP was trying to do this for. This was just my thoughts as I was trying to figure this out for myself and stumbled across this post.