Host vs client, who should fire the bullet?

As the title suggests…whats the best approach to firing projectiles in a multiplayer game?

I was thinking

  • all clients can fire a projectile. Calling this rpc will trigger on everyone’s game
  • the projectile will impact and explode on every client, but only the host will calculate the damage, and send it back out to all clients
  • all clients can fire hitscan weapons, but the host again, will determine if the hitscan hit th target

Is this the right approach? Is there another?

Sounds about right. Reminds me that I still have to implement client-side projectiles, for the time being I just spawn them server side which works pretty well even with simulator set to create a 100ms RTT…

One thing to keep in mind: when the server projectile impacts, clients need to destroy their versions too because it may have missed. And vice versa: client side impact, but server side miss. That‘s why I went for the less complicated implementation for now. Probably best to not let client projectiles impact on client side to avoid this complication.

1 Like

aah yep good point on client projectile potentially missing! might be best to tell the server to explode it. (thing is, the projectile is NOT a network object. maybe it should be for this reason)