Search Unity

Resolved How can I make an Anti-Cheat for a Clicker?

Discussion in 'Multiplayer' started by apollo_wayne, Apr 22, 2021.

  1. apollo_wayne

    apollo_wayne

    Joined:
    Dec 26, 2020
    Posts:
    27
    Hi! I want to make a clicker, but I'm afraid people will cheat... because if everything is happening in the client it's easy to cheat.

    I have an idea of an Online Database that will check the values in the client and compare them to the ones in the Cloud, if the difference is too big, the player's account will get terminated. (It's an online game, if there's no connection it won't work)

    The problem is.... I don't know how to do it

    Do you have any suggestions?

    And no, giving up on this project is not an option :)
     
  2. ep1s0de

    ep1s0de

    Joined:
    Dec 24, 2015
    Posts:
    168
    The meaning of anti-cheat in an offline game?
    The purpose of the anti cheat is to prevent cheating by players in online games

    You can of course change the value in memory using the Xor operation

    my_value = value ^ key
    where value is your value, key is the key to the value
     
    Joe-Censored likes this.
  3. apollo_wayne

    apollo_wayne

    Joined:
    Dec 26, 2020
    Posts:
    27
    I want this game to be online at a certain point in time
     
  4. ep1s0de

    ep1s0de

    Joined:
    Dec 24, 2015
    Posts:
    168
    Just do not trust the client with some game actions, transfer them to the server side. You should not care what the player does with the game client...
     
  5. apollo_wayne

    apollo_wayne

    Joined:
    Dec 26, 2020
    Posts:
    27
    How can I do this?
     
  6. ep1s0de

    ep1s0de

    Joined:
    Dec 24, 2015
    Posts:
    168
    Since you're asking such a question, then I don't need to tell you how to do it
     
  7. apollo_wayne

    apollo_wayne

    Joined:
    Dec 26, 2020
    Posts:
    27
    Oof :)

    I'm new into this, that's why I asked for help
     
  8. u-doug

    u-doug

    Joined:
    Jun 6, 2017
    Posts:
    11
    If you want it to be cheat proof and online, but don't need real time multiplayer, you need a BaaS - see my post here for example. All actions that the player takes need to be authenticated by the online backend to make it cheat-proof.

    There are a few, but personally I use PlayFab which is easy to get started with and is free up until a point. Once you have learnt the basics by authenticating a user, you there is an economy page here with useful information on things like virtual currency and a catalogue of items.

    It's a lot to learn if you haven't used an online backend before, but you need some kind of backend to store player data and authenticate transactions for this type of game if you want it online and cheat-proof.
     
  9. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You simulate everything you can on the server instead of the client. Anything on the client is subject to cheating. The server also trusts the client inputs as little as possible, and provides the client with as little extra information about the game state that the client doesn't need as is possible.
     
  10. apollo_wayne

    apollo_wayne

    Joined:
    Dec 26, 2020
    Posts:
    27
    Hi guys! Thank you so much!

    One more question, if I don't figure out how to do it on the server, can I just encrypt the values?
     
  11. u-doug

    u-doug

    Joined:
    Jun 6, 2017
    Posts:
    11
    There are ways to increase the difficulty of someone cheating in your game, but the more popular your game gets the harder it becomes. Instead of encrypting values a more painless place to start would be with something like the Anti-Cheat Toolkit on the asset store, alongside something which obfuscates your code.

    If you don't do anything online, then there is rarely any point in trying to making it cheat proof. If you do make it online then the server has authoritative last say in what the player is allowed to do, and generally stores the state of that players economy.

    By doing server side checks on what the player is allowed to do, you make it much harder for someone to cheat.
     
    Last edited: Apr 25, 2021
  12. fsluvehh

    fsluvehh

    Joined:
    Aug 12, 2023
    Posts:
    2
  13. dfaeojl

    dfaeojl

    Joined:
    Sep 5, 2023
    Posts:
    4
    nice