Skip to content

Modules

TinyPlay edited this page Mar 9, 2023 · 5 revisions

About Modules

Pixel Security Toolkit contains a number of different modules for security, data management, as well as preventing cheating in your game. You can connect modules on demand, only the modules you need at the moment.

Add Module in the Game

In order to plug a module into the game, you must add it via the Generic method of the main PixelGuard class:

PixelGuard.Instance.SetupModule<MODULE_CLASS>(new MODULE_CLASS(MODULE_OPTIONS));

For Example:

SecuredMemory.ModuleOptions moduleSettings = new SecuredMemory.ModuleOptions{};
PixelGuard.Instance.SetupModule<SecuredMemory>(new SecuredMemory(moduleSettings));

Get Module

To get a module already initialized, you can use the construct:

SecuredMemory memoryProtector = (SecuredMemory)PixelGuard.Instance.GetModule<SecuredMemory>();
memoryProtector.DOSOMESTAFF();

Remove Module

You can also remove already installed module to your PixelSecurity Instance by this code:

PixelGuard.Instance.RemoveModule<SecuredMemory>();

Check Module Setup

If you need to check if a module is currently added, you can use the code:

bool isSetup = PixelGuard.Instance.HasModule<SecuredMemory>();

Cheating Detection Event

When one of any module detect cheating - PixelGuard Class was called an cheating warning event.

You need to subscribe on this event to get cheating messages:

PixelGuard.Instance.OnSecurityMessage.AddListener(YOUR_LISTENER);

Or use Cheating UI:
https://github.com/TinyPlay/PixelSecurityToolkit/wiki/Additional-Features#cheating-ui

Modules

Pixel Security Toolkit contains a lot of different modules for Anti-Cheat, Data Protection, UI Management etc.

Current Modules list in the Toolkit:

Secured Memory

This module provided Secured Types and Cheating detection. Can be used to protect your game from Artmoney / CheatEngine hacking.

When memory hack will be detected PixelGuard call an OnSecurityMessage event with message.

Detector Params

Param Type Usage
FloatEpsilon float Tolerance Level for Secured Value Type (float)
Vector2Epsilon float Tolerance Level for Secured Value Type (Vector2)
Vector3Epsilon float Tolerance Level for Secured Value Type (Vector3)
Vector4Epsilon float Tolerance Level for Secured Value Type (Vector4)
QuaternionEpsilon float Tolerance Level for Secured Value Type (Quaternion)
ColorEpsilon float Tolerance Level for Secured Value (Color)
Color32Epsilon float Tolerance Level for Secured Value (Color)

Injection Protector

Determines if dependencies are embedded while the application is running.

When injection protector detect hack - PixelGuard call an OnSecurityMessage event with message.
Important: You must enable the Injection Detector in the editor before using this function and add a dependency whitelist.

Speedhack Protector

Speed Hack Protector is designed to detect the presence of a hack that increases the player's speed. This is usually achieved by speeding up the game time.

To determine the hack - we always compare the in-game time with the real one.

Detector Params

Param Type Usage
Interval float Speedhack Detection Interval in seconds
MaxFalsePositives byte Max Available False Positive Detections
CoolDown int Speedhack Detection Cooldown

Teleport Protector

Determines if teleport hack are used for any object in the game. To determine this, it uses the maximum allowed motion distance of the player's movement in space.

Adding GameObject Teleport Seeking:

TeleportProtector teleportProtector = (TeleportProtector)PixelGuard.Instance.SetupModule<TeleportProtector>(new TeleportProtector());
teleportProtector.AddTarget(new TeleportTarget
{
    LastPosition = _player.transform.position,
    MaxDistancePerSecond = 20f,
    TargetTransform = _player.transform
});

When teleport protector hack will be detected PixelGuard call an OnSecurityMessage event with message.

Wallhack Protector

This module determines the presence of Wallhack for the player. Works with RigidBody or Character Controller. Cheating event will be sended to PixelGuard class.

When wallhack will be detected PixelGuard call an OnSecurityMessage event with message.

Detector Params

Param Type Usage
ModuleSpawn Vector3 Wall Hack protection spawn Position

Secured Time

Determines an attempt to hack the game by rewinding time. Can compare time within one session based on local time, or using time from the internet.

When Time changing (rewind) will be detected PixelGuard call an OnSecurityMessage event with message.

Detector Params

Param Type Usage
CheckInterval float Detect Time Hack every X seconds
AvailableTolerance int Available tolerance for Time compare in seconds
NetworkCompare bool Use Network time to compare with Locale
TimeServerUrl string Server for comparing time. By default uses https://worldtimeapi.org/api/timezone/Europe/London
TimeServerMethod string Request method. By default "GET"

Privacy Module

This module displays the privacy policy window for the end user of the game. You can use Prefab in the Pixel Security Toolkit folder to recapture the UI.

Module Params

Param Type Usage
ShowOnce bool Don't show window again, if Privacy accepted early. Stored the key in PlayerPrefs
WindowHeadlineText string Window Headline Text
PrivacyPolicyText string Privacy Policy Rich Text or "". If text is not specified or empty - will be loaded template from Resources.
ReadButtonText string Read More Button Text
AcceptButtonText string Accept Button Text
PrivacyUrl string URL for Read More Button. When button clicked - url was opened
OnUrlClicked Action Called after Read More Button clicked and URL was opened
OnAccepted Action Called after Accepted Button clicked

Terms of Service Module

This module displays the terms of services policy window for the end user of the game. You can use Prefab in the Pixel Security Toolkit folder to recapture the UI.

Module Params

Param Type Usage
ShowOnce bool Don't show window again, if Terms of Services accepted early. Stored the key in PlayerPrefs
WindowHeadlineText string Window Headline Text
TermsOfServiceText string Terms of Services Rich Text or "". If text is not specified or empty - will be loaded template from Resources.
ReadButtonText string Read More Button Text
AcceptButtonText string Accept Button Text
TermsOfServiceUrl string URL for Read More Button. When button clicked - url was opened
OnUrlClicked Action Called after Read More Button clicked and URL was opened
OnAccepted Action Called after Accepted Button clicked

Write own modules

You can write your own modules based on ISecurityModule interface:

namespace PixelSecurity.Modules.PrivacyAccepter
{
    public class MySecurityModule : ISecurityModule
    {
        [System.Serializable]
        public class ModuleOptions : IModuleConfig
        {
            // Module Options
        }
        private ModuleOptions _options;
        public ModuleOptions Options => _options;
       
        public MySecurityModule(ModuleOptions options = null)
        {
            if (options == null)
                _options = new ModuleOptions();
            else
                _options = options;
            
            // Module Initialization
        }

        /* Module Methods */
    }
}

Clone this wiki locally