Skip to main content

Custom Engine Integration

During the initial phase, it’s required to integrate the source code into the game and configure the necessary SARD components. You can do that by following steps outlined bellow.

  1. Copy the code snippet that matches your game's programming language (either C# or C++) and paste it into the game's source code
  2. Call sardInitialize() function at the very beginning of your game's code.
  3. Call setUserName() function after player is authorized by game-server. Note: An argument should be attributed to setUserName() function.
  4. Call sardFinalize() function on game exit and as a part of crash handling.
static HMODULE sard_lib = 0;
static void (*SardSetUserName)(const char*);
static void (*SardFinalize)();

static void finish()
{
if (SardFinalize)
{
SardFinalize();
}
}

static void setUserName(const char* name)
{
if (SardSetUserName)
{
SardSetUserName(name);
}
}

static void SardInit(const char* dllPath)
{
sard_lib = LoadLibraryA(dllPath);
if (sard_lib)
{
SardSetUserName = (void (*)(const char*)) GetProcAddress(sard_lib, "sardSetUserName");
SardFinalize = (void (*)()) GetProcAddress(sard_lib, "sardFinalize");

void (*SardInitialize)() = (void (*)()) GetProcAddress(sard_lib, "sardInitialize");

if (SardInitialize)
{
SardInitialize();
}
}
}

Building the solution

  1. Build your project
  2. Download Sard-Updater.exe and put it in SARD folder in the same directory as your game .exe
  3. Launch the SardUpdater.exe with following parameters
    • sarkKey: the key that could be obtained in your title at admin panel (please refer to admin panel guide for details).
    • sardGame: relative path to the game executable
    • Example: SardUpdater.exe -sardKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -sardGame "..\xxxx.exe"
  4. SardUpdater will download necessary files including armour.dll (that's why set such path in Dll Path inside the sample code)
  5. Shortly after completing these steps functionality of admin panel should be unlocked, confirming the success of integration