Download

Spawning Actor Client-Side

In a networked game I am working on, I want to spawn a projectile that is replicated over the network. I know that the usual way of doing this is simply to send a request to the server to spawn this projectile for the client. However, if there is a significant amount of latency, the client will see a delay between firing and seeing the projectile.

To ensure fluidity, I would like to spawn this projectile on the client-side, give that particular client authority over the object and replicate it to other clients. How may I go about doing this? I have had this problem for quite a while and cannot seem to find any posts relating to it.

TLDR: How to spawn projectile on client side?

I believe for an actor to be replicated to all clients, it has to be spawned by the server. Spawning a temporary project client-side that does not run game-state affecting logic and is removed later could probably work.

NisshokuZK is correct, you have no choice but to spawn on the Server if you want it to replicate properly. You should do this anyway, because giving a client complete control over creating the projectile would allow players to cheat, and also give different results on each client.

There are two ways to get around the latency. The first is to simulate all effects such as muzzle flashes and SFX instantly, and hope that the latent projectile doesn’t look too out of place. The other way is to do that and spawn a ‘fake’ projectile on the client, then sync it up to the ‘Master’ projectile when it receives that from the Server. UT does a mix of both of these, ShooterGame only does the first.

Welcome to Multiplayer Programming :smiley:

Thanks alot for the replies guys :slight_smile: been trying to get decent replies on this question for months :smiley: