MirrorNetworking / Mirror

#1 Open Source Unity Networking Library
https://mirror-networking.com
MIT License
5.09k stars 757 forks source link

Attribute parameter for ClientRpc and Command to ignore authority #873

Closed BenWoodford closed 5 years ago

BenWoodford commented 5 years ago

Please explain the suggested feature in detail.

Basically, the ability to specify that a Command doesn’t have to be sent from the object’s owner (which it does right now, right?) and an Rpc can be sent from someone other than the server (less important but could be very useful)

How exactly does this keep you from releasing your game right now?

It doesn’t, but it does make developing things a lot more complex. While it seems a rather odd thing to do - letting clients do stuff to things they don’t own - there are a lot of instances where authority just gets in the way of development. A prime example being any public installation, like a multiplayer game/experience that is installed in a public setting so the user doesn’t really have the option to cheat as it’s a controlled environment.

Using that example, where we trust the clients 100%, imagine you’ve got an FPS with hitscan. If the client says they shot an enemy then they did. With authority you’d have to call a command on the shooter’s object, to run a method on the server to handle the damage to he enemy, which could have been just called directly by the player if authority was ignored as you could just call the command directly on the object at the client end and have the server run that.

It’s a relatively minor thing but you end up with quite a lot of proxy commands that just do little things like that everywhere, which makes getting track of what calls what a lot harder.

MrGadget1024 commented 5 years ago

As mentioned in the closed PR, stripping all the little scripts from all your scene objects and consolidating them into more general purpose code on your player prefab will result in a lot less code overall, and will be easier to maintain. Having a Cmd with an extra GameObject parameter for the target the player hit is all you need.

NLR-L commented 5 years ago

I don't agree with the design choise of putting all your code on the player prefab, but that's a personal preference. The statement that it would result in a lot less code overall is simply not true, as you can see in my latest comment.

miwarnec commented 5 years ago

sorry but we focus on server authoritative