- Home /
Multiplayer Estruture
What is better for less hackers and good script estruture ?
1- Press Fire1 on player script to call shooting function that is on GameController script
or
2- Call a shooting function directly from player script
Answer by IvovdMarel · Jun 25, 2014 at 04:48 PM
First of all, to prevent hacking, you should code/verify on the server side rather than the client side. Anything on the clientside can potentially be hacked. Moving things from class to class makes no difference at all, so always try to make it as logical as possible.
In this case, I would say call Fire1 on the player script that call shooting on GameController-script. Actually rename your GameController-script to Avatar-script. This way, when you make AI, you can re-use your avatar script and replace the player controls with AI controls. This is just a wild guess though, since I am assuming here that your AI and Player are similar character-types. It really depends on your game.
Code on the server side can only be hacked if hackers get the access to your server. With a proper security system, this is almost impossible.
Code on the client on the other can always(!) be hacked, since it's on the users own device.
However, it really depends on your game if you want to put that much effort into security. $$anonymous$$any games choose not to. Who cares really if people hack your game?
Your answer
![](https://koobas.hobune.stream/wayback/20220613152507im_/https://answers.unity.com/themes/thub/images/avi.jpg)