Best Solution for Multiplayer Shooting

Hello, I’m in the middle of creating a small online game, multiplayer is something I have worked with before and it’s going quite well atm. I just got had a little wondering which of these solution or another would be the better for doing shooting in the game. The game is a 2D, top down game and most weapons uses a projectile type so it can be dodged, collision is detected on the client side, which might not be the best solution, but it works atm. It is a fast paced space shooter so being a little off, might not have huge consequence.

The thing I am wondering is, some of the weapon can shoot fairly fast around 2~8 (rough estimate) projectiles per second, if not faster. So would you rather use a more precious solution like using RPC sending very little needed data to all clients and make sure everyone receives the messages. Or use a bool which are serialized between the clients and whenever it is true it would fire the weapon.

I constantly think RPC’s are expensive to use, and if you would send 5 of them from one client each second or something like that, wouldn’t it be a better solution to just use a serialized bool and maybe some of the projectiles gets lost? Especially if you are suppose to be around 6-10 people in a single room. One of the big problem is I wish to add a spread on some of the weapons and using a bool in that scenario I can’t figure out how to sync the bullet spread across the server and think that a RPC with the bullet spread would sync in across the server, for much more reliable projectiles.

What would your solution be in such a scenario? One of these or do you have something better I could look into? I am using PUN (Photon Unity Networking) for networking, if anyone would be wondering, since it is what I am most experienced in.

Kind regards
Gnome

you dont have sync all the rpcs to all the clients you can check if two players are in radius close enough to see each other. if they are close then you can send or you just dont have to send any data.