Search Unity

Feedback How to protect games

Discussion in 'Multiplayer' started by coding_storm, Mar 28, 2021.

  1. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    People how should i make my unity game secure like is there any tool which will secure my game from getting hacked .It is a DESKTOP game as of now.
     
  2. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Would you mind providing some detail instead of just saying hacked?
    Also seeing you just joined just a few days ago, how come you created a game that's being hacked? o_O
     
    Joe-Censored likes this.
  3. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Sorry for the tittle ,auctully I got scared because I am creating a game and suddenly a thought popped up that does unity have some sort of protection for their games .I googled it and the first result which came was unity games can be easily hacked so I got even more scared.I know about the Ixgaurd but it is for mobile application.
     
    Last edited: Mar 29, 2021
  4. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Ruchir do you know about anything which will help ?
     
  5. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    I myself am not really an expert in this matter but there are a few common practices you can follow:
    Like instead of storing your health as
    Code (CSharp):
    1. int heath = 100;
    You do:
    Code (CSharp):
    1. private float _health; // This is health + 5 (or any other no.)
    2. public int Health
    3. {
    4.     get => (int)(health - 5);
    5.     set => health = value + 5;
    6. }
    This will discourage player from using things like cheat engine,
    Also, There's this asset https://assetstore.unity.com/packages/tools/utilities/anti-cheat-toolkit-152334
    you can search for what you are specifically looking for too
    Also, for multiplayer, you can look into server authoritative designs
     
    Last edited: Mar 29, 2021
    coding_storm likes this.
  6. rangolee302

    rangolee302

    Joined:
    Feb 1, 2018
    Posts:
    22
    AFAIK the major way to hack your game is using debugging assembly tools like dnspy to get your source code from your compiled game. There are even tutorials on Youtube to learn how. Now I heard that using LI2CPP will prevent that since there are no convenient ways to decompile your game. But since this is posting on Multiplayer, I guess you need to host a dedicated authoritative server for your game.
     
    coding_storm likes this.
  7. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    mischa2k and coding_storm like this.
  8. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    So LI2CPP will not work for multiplayer games ? If it will then how to implement it in the game ?
     
  9. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Well I am new to unity so how should I implement the authoritative design in game ?
     
  10. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Any idea about guardingpearsoftware free assets productivity ?
     
  11. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    My advice would be go ahead and make the game regardless.

    If it gets so popular that hacking becomes a problem, then you'll be making enough money from it by then that you can pay someone to make it secure.
     
    coding_storm and BenniKo like this.
  12. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    What kind of hacking are you worried about? If you're talking about typical multiplayer cheats, like flying through the air, shooting through buildings, etc, you best protect against that by not trusting any information from the client. You do the simulation on the server, and just take inputs from the client. You also verify all of those client inputs on the server.

    But that only covers a specific kind of hacking.
     
    coding_storm likes this.
  13. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Look at this
     
    coding_storm likes this.
  14. Xentios

    Xentios

    Joined:
    Jan 15, 2019
    Posts:
    17
    Trust me this is the best advice here for you

    My advice would be go ahead and make the game regardless.

    If it gets so popular that hacking becomes a problem, then you'll be making enough money from it by then that you can pay someone to make it secure.
     
    coding_storm likes this.
  15. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    I am not do worried about them but those ones which interfere with the game codes
     
  16. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Very informative thanks
     
  17. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Yeah I know but if know all of this right now I can implement them when I building the game
     
  18. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Ok guys I was scrolling the project settings and found something called save file names as hashes ,so I wanted to know what does it do if I enable it
     
  19. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    @Ruchir @Xentios @rango302 how can I enable LI2CPP in game or check if it is there because the articles I read resulted that it is a good way of protecting the game
     
  20. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    You can enable IL2CPP in Build Settings > Player Settings > Other Settings by selecting IL2CPP in the Scripting Backend dropdown (You'll find it under the Configuration heading).
     
    coding_storm likes this.
  21. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Thank you.:)
     
  22. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    IL2CPP Isn't a form of game protection. It just makes getting to your code slightly less trivial compared to a mono build.
     
    coding_storm likes this.
  23. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Oh ok
     
  24. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Thank you everyone for your help really appreciated :)
     
    Joe-Censored and Ruchir like this.
  25. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    If you use IL2CPP, make sure to encrypt your metadata file. Tools exist that create all the dlls you are trying to protect using GameAssembly.dll and global-metadata.dat.

    Genshin Impact for example has extra protection so you can't just reverse it with a few clicks. It's still possible, but it adds another wall. Which is what this is all about, since everything can be reverse engineered. Although this is especially effective against script kiddies.

    Search for a IL2CPP dumper, to know what the majority use.
     
    coding_storm likes this.
  26. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Can you share some tools with me please, I found fairguard but the website was not secure
     
  27. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
  28. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
  29. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Ok so how do I download it and any other you would recommend ? Any tool for pc games
     
    Last edited: Apr 3, 2021
  30. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
  31. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Pretty sure you can. I can't help you any further, although I have messed around with dumping il2cpp, I haven't encrypted it before. But there are games that do it, Genshin, Rust for example.

    The link I posted here a while ago talks about encrypting metadata, to prevent easy dumping of il2cpp.
    Good luck.
     
    coding_storm likes this.
  32. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Oh ok ,thanks for your help ,really appreciated .What I understood is that I should obfuscate the meta file code and I already have an awesome asset for it called guardian pear software
     
    PutridEx likes this.
  33. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Thanks dude :)
     
  34. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
  35. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    Joe-Censored, coding_storm and Ruchir like this.
  36. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Yeah very sorry.
     
  37. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Sorry guys for the inconvenience I caused :( ,I promise it will not happen again
     
    Joe-Censored likes this.
  38. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Personally I think all this is a fools errand. If your game is single player, then you shouldn't waste so many cycles trying to restrict how players choose to play the game. If they want to cheat, change how the game plays, or skip right to the end, so what?

    If your game is networked multiplayer, then focus your efforts on locking down the server and not trusting anything coming from the client (go server authoritative for as much as possible, and be careful about not providing the client with too much information). None of this involves local binary or meta file obfuscation.

    edit: Just realized that last message was about getting attention to another thread instead of the meta file obfuscation issue. Oops, but I stand by my comment anyway :p
     
    mischa2k and Munchy2007 like this.
  39. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Hahaha :D , thanks for the reply
     
    Joe-Censored likes this.
  40. ep1s0de

    ep1s0de

    Joined:
    Dec 24, 2015
    Posts:
    168
    I agree with him about the online game... You should not care what the cheater does with the game client, you can make a shadow ban when detecting cheats and let him think that he hacked the game
     
  41. coding_storm

    coding_storm

    Joined:
    Mar 26, 2021
    Posts:
    34
    Oh ok thanks
     
  42. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    Any chance you could expand on what you mean by this?
     
  43. ep1s0de

    ep1s0de

    Joined:
    Dec 24, 2015
    Posts:
    168
    After detecting cheats, do not change the player's statistics, do meanness, collect all cheaters on one server (or lobby)
     
    Ubrano likes this.
  44. mhnec

    mhnec

    Joined:
    Aug 13, 2023
    Posts:
    1