• Hello
Search Results for

    Show / Hide Table of Contents

    Punisher

    A punisher is an automatic reaction to cheating, for example closing the game. You do not call it yourself.

    Each detector find adds to a threat score on the Anti-Cheat Monitor, the main object in your scene. A punisher runs when that score reaches the limit you set for it.

    Note

    Keep in mind: a punisher can be drastic. Closing the game on a false alarm hurts an honest player. Often it is better to watch first. Note that a player cheated, for example in a log or on your server, and decide on a punishment later. See Reacting to cheating.

    The Free version includes the Exit Game punisher. The other punishers need Pro.

    The Anti-Cheat Monitor lists the punishers on it. Here the Exit Game punisher runs at a threat score of 850.

    Add a punisher

    Each punisher comes as a ready-made prefab. Drag it onto the Anti-Cheat Monitor so it becomes a child. It then registers itself.

    The punisher prefabs in Assets/GUPS/AntiCheat/Resources/Prefabs/Punishers.

    You can add more than one. A soft punisher can run early, and a hard one later.

    How the score works

    • Each detector find adds to the score.
    • A find that is more likely to be a mistake adds less.
    • The Sensitive Level on the Anti-Cheat Monitor scales every find. A higher level means punishers run earlier.
    • The score slowly falls again over time. A one-off hitch does not keep punishing the player. A cheat that stays on keeps adding to the score.

    Set the limit

    Every built-in punisher has two fields in the Inspector:

    • Is Active: turns the punisher on or off.
    • Threat Rating: the limit. The punisher runs when the threat score reaches this number.

    The built-in punishers run only once per session.

    Use a high limit for a hard reaction, such as closing the game. Use a lower limit for a soft reaction. A false alarm should not kick an honest player.

    If you only want a warning or a log entry, you do not need a punisher. React to the detector yourself, as shown in Reacting to cheating.

    Built-in punishers

    Punisher Free Pro What the player sees Default limit
    Mirror camera + The view is flipped 450
    Reduce FPS + The game becomes very slow 550
    Exit game + + The game closes 850

    Write your own punisher

    Add the IPunisher interface to a MonoBehaviour. Put it on a child of the Anti-Cheat Monitor. It runs like a built-in punisher.

    public class LogPunisher : MonoBehaviour, IPunisher
    {
        public string Name => "Log Punisher";
        public bool IsSupported => true;
        public bool IsActive => true;
        public uint ThreatRating => 300;
        public bool PunishOnce => true;
        public bool HasPunished { get; private set; }
    
        public void Punish()
        {
            HasPunished = true;
            Debug.LogWarning("Possible cheating.");
        }
    }
    

    Next

    Guide: Punishing cheaters. It shows which detector finds reach which limit.


    Back to the overview.

    In This Article
    Back to top GuardingPearSoftware documentation