Game Security

To prevent users from manipulating game config through some 3rd party tool, we must secure the game config variables. One of the ways is to use the Anti Cheat ToolKit.

  1. Please use Obscured type for all the possible variables. For example:

ObscuredInt seed = int.Parse(configData["seed"].ToString()); 
ObscuredFloat speed = float.Parse(configData["speed"].ToString()); 
  1. After changing data type to obscured type, we will now encrypt the variables. For example:

public void EncyptData() 
{				
    seed.RandomizeCryptoKey(); 
    speed.RandomizeCryptoKey(); 
}
  1. Now subscribe to Hack Event.

void SetUpHackEvent() 
 { 
    SpeedHackDetector.StartDetection(HackEvent.instance.OnCheaterDetected);  
    ObscuredCheatingDetector.StartDetection(HackEvent.instance.
    OnCheaterDetected);
 }  
  1. Add the SetUpHackEvent() method in the Start() method of WinzoManager.cs. Like

void Start()
{					
    Dictionary<string, string> scenename = new Dictionary<string,string>(); 
    scenename.Add(IntegrationEvents.SceneName,SceneNames.WINZO_GAME_SCENE);  
    WinzoEventManager.StartListening(IntegrationEvents.SetUpGam,SetUpGame); 
    WinzoEventManager.TriggerEvent(IntegrationEvents.GameLoaded,scenename);
    
    // subscribe hack event here
    SetUpHackEvent();
} 
  1. And call EncyptData() method at the end of SetUpGame() method.

public void SetUpGame(IDictionary gamedata) 
{ 
   Dictionary<string, object> configData = new Dictionary<string,
   object>();
   foreach (DictionaryEntry d in gamedata) 
   { 
       configData.Add((string)d.Key, d.Value); 
   } 
- -
- -
   // Secure your all config data like
   // 
   ObscuredInt seed;
   ObscuredFloat speed;
   seed = int.Parse(configData["seed"].ToString()); 
   speed = float.Parse(configData["speed"].ToString()); 
- -
- -
   EncyptData();
}

Last updated