#Client Auth projectiles

5 messages · Page 1 of 1 (latest)

keen fable
#

Hey all, I'm making a game where players are able to fire slow(er than bullets) moving projectiles. My current setup has clients tell the server when they'd like to spawn a projectile, mask the RTT with some animation, then use NetworkServer.Spawn on a server method to spawn the projectiles on the server.

I'd like to move to a client authoritative spawning method in order to make client gameplay snappier and more responsive. Is there any existing pattern built into mirror for this? I know I can't use NetworkServer.Spawn from a client. Is there any workaround to yield similar results to that though? Ideally, I'd instantiate a projectile from a client and then my client would tell all other players to instantiate the same projectile as well as send updates on position. The local player would have more responsive projectiles and other players versions would be delayed, but that is better than the alternative that I'm in now.

keen fable
#

I've been playing around with setting the projectiles to client Auth in their network transform and NetworkServer.Spawn(gameObject, NetworkConnection) to assign client as the owner. The results are promising...the spawn time of course is still delayed, but at least the trajectory and position updates feel less laggy for clients.

I'd still like a way to mask that spawn lag time as this game is pretty fast paced and not super suited to long windup attack anims. But at least this is better than before.

keen fable
#

OH. Perhaps pooling of client Auth server spawned projectiles on the network. Then the client can just set their position and activate them when needed.

rigid anchor
#

@keen fable did you not think of using an rpc and handling the movement of the projectile deterministically?

keen fable
#

Hey other max, I did think of it but had it as a last resort because it sounded like it was going to be the trickier option to set up. So far, the pooling has been working well.

The player prefab specifies what server objects it needs pooled, sends a list to the server when they connect, the server spawns them into the pool all and assigns the authority to the corresponding player. Upon spawning, the projectiles then use an rpc to pool locally on the client. Then clients grab from that pool without delay when needing projectiles