Skip to content

SARD Game Client Integration (Custom Engine)

This document provides a complete guide for integrating SARD Anti‑Cheat into any custom game engine using the official C++ API.


Overview

SARD provides a lightweight and secure client-side runtime module (armour.dll) that loads directly inside the game process.
Developers integrate SARD through a compact and stable C++ API supplied as:

  • sardIntegration.h — public API header
  • sardIntegration.cpp — implementation layer (armour.dll loader + API wrappers)

No DLL injection, patching, or executable modification is required.

Once initialized, SARD automatically performs:

  • Memory integrity verification
  • Process & module validation
  • Anti-debugging and anti-tamper protection
  • Telemetry and behavioural analysis
  • Secure Session ID handling
  • Relogin / account-switch management
  • Full lifecycle management (Initialize → runtime → Finalize)

All communication with the SARD backend occurs automatically after initialization.
Your game must only call the provided API functions at the correct moments.


Downloading the Integration Files

Direct Download

A packaged ZIP containing:

  • sardIntegration.h
  • sardIntegration.cpp
  • usage examples

Download:
/sard_client_sdk.zip (TBD)

1. Preparing the SARD Updater

1.1 Create the SARD Folder

Inside your main game directory, create a folder named:

SARD

This folder must be located next to your main game executable.

Example:

`<GameFolder>`/
   TheGame.exe
   /SARD/

1.2 Download SardUpdater.exe

Download latest SARDUpdater.exe from here

Place the updater into:

`<GameFolder>`/SARD/SardUpdater.exe

1.2.1 Optional: Logging Mode (armour.dll)

For integration verification and troubleshooting, SARD supports a logging-enabled mode via armour.dll (64-bit).

Purpose:

Validate correct initialization of SARD Diagnose startup or runtime issues Capture detailed execution logs

Setup:

`<GameFolder>`/
   TheGame.exe
   /SARD/
       SardUpdater.exe
       armour.dll

Notes:

Intended for testing and staging environments only May generate log files inside the /SARD/ directory or game folder Should not be used in production builds unless explicitly required

1.3 Start Your Game Using the Updater

Launch:

SardUpdater.exe

with required Parameters

-sardKey — Your unique SARD game environment key

  • This key is found in the SARD Integration page.
  • Each game environment (prod / qa / dev) has its own unique key.

-sardGame — Relative path to your game executable
Example: ..\Game.exe

Example Usage:

cmd
SardUpdater.exe -sardKey `<YOUR-SARD-KEY>` -sardGame "..\Game.exe"

Passing Additional Game Arguments

Arguments after required params are passed to the game unchanged.

Example:

cmd
SardUpdater.exe -sardKey `<YOUR-SARD-KEY>` -sardGame "..\TheGame.exe" -SomeArgument SomeValue

What the Updater Does

  • Validates the provided SARD key
  • Creates the required /SARD directory structure
  • Downloads all necessary runtime files (armour.dll, launcher.exe, and the SARD driver)
  • Ensures all components are on the correct version
  • Launches the SARD Launcher, which then installs the SARD driver and starts the game under SARD protection (including all passed arguments)

2. Initialize SARD at Game Startup

Call as early as possible — ideally before any game systems, networking, or session logic begins.

To initialize SARD:

cpp
int result = sardInitialize(armour_dll_path, sessionId);

If armour_dll_path is nullptr, SARD will automatically search for:

<game_folder>/SARD/armour.dll

If the sessionId is not yet available, pass nullptr.
You can later provide the session ID using the Session ID function. Depending on your validation type, passing nullptr may also be acceptable when session-based validation is not required.

Return Codes

CodeMeaning
0Success
1armour.dll failed to load
2sardInitialize export not found

3. Set Player Information After Authorization

After the game server authorizes the player, you must provide the Player ID to SARD so the security module can bind the session to the correct user.

Set Player ID (ANSI)

cpp
sardSetUserId("12345ABC");
  • userId must be a null-terminated const char*

Set Player ID (Unicode)

cpp
sardSetUserIdW(L"12345ABC");

Both ANSI and wide-char versions are supported.


When to Call

  • Immediately after user authorization
  • Before gameplay starts
  • Before any session-based validation (if used)

Correct Usage Example

cpp
std::string uid = GetPlayerIdFromServer();
sardSetUserId(uid.c_str());

These functions must be called before gameplay begins and as early as possible after the authorization data becomes available.

4. Finalize SARD on Game Shutdown

SARD must be cleanly finalized when the game is closing — either during a normal exit or from a crash handler.
This ensures:

  • All telemetry is flushed
  • Internal buffers are written
  • Security session is properly closed
  • Loaded modules perform cleanup

Finalization Call

cpp
sardFinalize();

Call this in:

  • Game shutdown routine
  • Crash handler / unhandled exception filter
  • Any controlled restart flow

Example — Normal Shutdown

cpp
void OnGameExit()
{
    sardFinalize();
}

Example — Crash Handler

cpp
LONG WINAPI CrashHandler(EXCEPTION_POINTERS* info)
{
    sardFinalize();
    return EXCEPTION_CONTINUE_SEARCH;
}

5. Session ID Manipulation (Advanced Validation)

Session ID functionality is designed for advanced server-side validation.
If your integration does not require session-bound validation, you may safely skip this section.

When Session IDs Are Used

Session IDs are required when you want SARD to:

  • Bind anti-cheat telemetry to a server-validated session
  • Prevent session spoofing, replay, or duplicated sessions
  • Enable strong validation levels where the backend confirms session authenticity
  • Support parallel instances safely (each instance has its own SID)

5.1 Passing Session ID During Initialization (Optional)

If the server session is available at startup, you can pass it to sardInitialize:

cpp
int result = sardInitialize(nullptr, "SESSION_123456");

5.2 Setting or Updating Session ID After Initialization

If the session ID becomes available after the player is authorized by your game server:

cpp
sardSetSessionId("SESSION_123456");

Unicode version:

cpp
sardSetSessionIdW(L"SESSION_123456");

This binds the current SARD runtime to the active gameplay session.


5.3 Retrieving the Secure Session ID (Optional)

SARD generates from SARD server side a secure internal session identifier, used in certain high-security validation types.

cpp
const char* secureSid = sardGetSecureSessionId();

Notes:

  • You usually forward this value to your backend for correlation

6. Handling Relogin / Account Switch

If your game supports relogin without restarting:

cpp
sardRelogin("12345ABC", "NEW_SESSION_98765");

Unicode version:

cpp
sardReloginW(L"12345ABC", L"NEW_SESSION_98765");
  • Session ID parameter can be NULL
  • After calling sardRelogin, you should re-set SARD session ID if used, SARD Session ID changes after relogin

Best Practices Summary

Integration TypeRequired CallsNotes
Basic ValidationsardInitialize(..., nullptr) + sardSetUserId(...)Session optional
Advanced Session ValidationPass sessionId into sardInitialize, or set later via sardSetSessionIdRecommended for secure flows
Relogin / Account SwitchsardRelogin(...)sardSetSessionId(...)sardGetSecureSessionId()SARD Session ID is changing after Relogin

Recommendations

  • Always set User ID immediately after player authorization in your game
  • Only use Session ID if your server-side validation level requires it

Integration Checklist

  • [x] Include SardIntegration.h in your project
  • [x] Add sardIntegration.cpp to the build
  • [x] Call sardInitialize() at startup
  • [x] Set userID after login
  • [x] Set Session ID after login (required only for advanced validation)
  • [x] Retrieve Secure Session ID (required only for advanced validation)
  • [x] Implement relogin if game supports it
  • [x] Call sardFinalize() on shutdown
  • [x] Use SardUpdater for launching the game