Health System

Options
I want to implement health system and some other systems that each client doesn't update their stats by themselves for preventing cheating.

I know there is a way to handle all these systems by master client and send information to other clients by RPC but when master client leaves the room or disconnect, other clients lose information.

I want to find another better way to implement these systems. I've tried to search too much but didn't find any other way.

I think I can send and receive these stats by photon view but I'm not sure about it and don't want to send them multiple times in second, want it whenever values change.

Comments

  • ATHellboy
    Options
    I've tried to find out how to use sending and receiving via PhotonView and OnPhotonSerializeView and it solved my problem but i'm not sure about security because each player sends its health by itself. Is it secure ? if it's not, what is the solution ?
  • Hi @ATHellboy,

    you sadly can't prevent people from cheating, they will always find a new way to do so. Your approach works fairly well for players who are not cheating, but I wouldn't say that it is 'secure' at all. Hackers can access and modify their current health value easily which then gets synchronized across all clients. Sadly you can't prevent them from do so, unless you either have server-side logic which does something if it detects invalid modifications or have a client you always trust (for example the MasterClient). Please note that both approaches aren't 'secure' solutions, too.
  • ATHellboy
    ATHellboy
    edited November 2017
    Options
    In PhotonView component, I set Observe Option as Unreliable OnChange but according to sending rate each photon view writes these values but I want to write those values just when they are changed and just want to write the value that is changed. Is it possible by OnPhotonSerializeView or I need to use RPC ?
  • You can do this by implementing a custom OnPhotonSerializeView function. To check if the health value has been modified recently just add a bool value which notifies about that modification and tells the function to send the data. If it's just one value you want to send, this should be easily done, if you however want to synchronize more values you also need to send another value, telling the receiving client what he actually received.

    You can of course do the synchronization by using a RPC.