2. You integrate our login system

Login Overview

If you wish to publish your game DRM free, you can skip the login system integration. If not, login integration is compulsory.

Your game is now available at our launcher in test mode with the following parameters, that we add for developers to test the game prior to release.

PARAMETER NAMEDESCRIPTION
idctkToken that identifies a start session at the game
idcgameidUnique game identifier
idcuuidIdentifies the machine from which the session was started (only necessary if developers don't use the IDC Games library to retrieve the user ID
resultValues: 0 (OK) or 1 (USER INVALID)

Once these parameters are retrieved, the game can access the information in 2 ways:

  • 1. Calling the GetAccessData function at our DLL idclib.dll/idclib64.dll.
  • 2. Making an HTTP request to and URL that will retrieve the necessary data. This is recommended for games that prefer to make a server to server call from the game's server to IDC's. In this case, developers have to notify IDC Games the IP/IPs from which they will launch the request.

Login with Unity

You can download the Unity login package here.

How to integrate the IDC Login prefab for Unity:

1. Drag IDCLoginManager prefab to your scene.

2. Select IDCLoginManager object and set your game "secret" at the Inspector.

Unity prefab integration

3. You can retrieve if a user is logged in with the IsLogged property.

4. Retrieve advanced user data by adding the following code at your scripts:

```csharp
string userId = IDCLoginManager.instance.UserId;
string country = IDCLoginManager.instance.Country;
string language = IDCLoginManager.instance.Language;
string currency = IDCLoginManager.instance.Currency;
string nick = IDCLoginManager.instance.Nick;
string email = IDCLoginManager.instance.Email;
string status = IDCLoginManager.instance.Status;
string avatar = IDCLoginManager.instance.Avatar;
string custom = IDCLoginManager.instance.Custom;
```

Login with C#

You can download the DLL here.

Example:

==

Login with C++/Unreal

You can download the DLL here.

Example:

```csharp
#if _WIN32 || _WIN64
#if _WIN64
#define ENV64BIT
BOOL GetProcAddresses(HINSTANCE *hLibrary, LPCWSTR lpszLibrary, INT nCount, ...)
{
    va_list va;
    va_start(va, nCount);

    if ((*hLibrary = LoadLibrary(lpszLibrary))
        != NULL)
    {
        FARPROC * lpfProcFunction = NULL;
        LPSTR lpszFuncName = NULL;
        INT nIdxCount = 0;
        while (nIdxCount < nCount)
        {
            lpfProcFunction = va_arg(va, FARPROC*);
            lpszFuncName = va_arg(va, LPSTR);
            if ((*lpfProcFunction =
                GetProcAddress(*hLibrary,
                    lpszFuncName)) == NULL)
            {
                lpfProcFunction = NULL;
                return FALSE;
            }
            nIdxCount++;
        }
    }
    else
    {
        va_end(va);
        return FALSE;
    }
    va_end(va);
    return TRUE;
}
#else
#define ENV32BIT
BOOL GetProcAddresses(HINSTANCE *hLibrary, LPCSTR lpszLibrary, INT nCount, ...)
{
    va_list va;
    va_start(va, nCount);

    if ((*hLibrary = LoadLibrary(lpszLibrary))
        != NULL)
    {
        FARPROC * lpfProcFunction = NULL;
        LPSTR lpszFuncName = NULL;
        INT nIdxCount = 0;
        while (nIdxCount < nCount)
        {
            lpfProcFunction = va_arg(va, FARPROC*);
            lpszFuncName = va_arg(va, LPSTR);
            if ((*lpfProcFunction =
                GetProcAddress(*hLibrary,
                    lpszFuncName)) == NULL)
            {
                lpfProcFunction = NULL;
                return FALSE;
            }
            nIdxCount++;
        }
    }
    else
    {
        va_end(va);
        return FALSE;
    }
    va_end(va);
    return TRUE;
}
#endif
#endif


private void idcfunctions()
{
    /*char buff[100];
    std::cin >> buff;*/
    //int(__stdcall* GetUserProfileInfo)(int, char*, char*, char*, char*, char*, char*, char*, char*, char*);
    int result;

    //GetAccessData Parameters
    int idcgameid;
    char idctk[1024];
    char idcuuid[1024];
    int userid;
    char usercrc[1024];
    char country[3];
    char language[3];
    char currency[3];


    //GetUserProfileInfo Parameters
    //int userid = 1; //userid is already defined for GetAccessData
    char secret[] = "test";
    char nick[80];
    char email[320];
    char status[1024];
    char avatar[1024];
    char custom[1024];

    typedef int (WINAPI *GETACCESSDATA)
        (int, LPCSTR, LPCSTR, int*, LPCSTR, LPCSTR, LPCSTR, LPCSTR);
    GETACCESSDATA GetAccessData = NULL;
    typedef int (WINAPI *GETUSERPROFILEINFO)
        (int, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPCSTR, LPCSTR);
    GETUSERPROFILEINFO GetUserProfileInfo = NULL;
    HINSTANCE hLib;
    //Params: Instance, libname, number of functionts to import, function pointer 1, function name 1, function pointer 2, function name 2...
    if(GetProcAddresses(&amp;hLib, L"idclib.dll", 2, &amp;GetAccessData, "GetAccessData", &amp;GetUserProfileInfo, "GetUserProfileInfo"))
    {
        gameid = 1;
        char idctkaux[1024] = "ae854aeb5b7397da99b5c8aed5eb8cea";
        strcpy_s(idctk, strlen(idctkaux) + 1, idctkaux);
        char uuidaux[1024] = "6022DAAE-03F7-11E9-BB88-E86A6485A3C7";
        strcpy_s(uuid, strlen(uuidaux) + 1,uuidaux);
        result = GetAccessData(idcgameid, idctk, idcuuid, &amp;userid, usercrc, country, language, currency);
        if (result == 0) {
            //Success
            result = GetUserProfileInfo(userid, secret, nick, email, status, avatar, custom, country, language, currency);
            if (result == 0) {
                //Success
            }
        }
    }
    if (hLib != NULL)
        FreeLibrary(hLib);
}
```

Login with HTTP

==

Parameters of the request

  • &idctk is obtained from idctk parameter
  • &idcgameid unique game identifier obtained from idcgameid parameter
  • &idcuuid obtained from idcuuid parameter

Parameters of the answer

PARAMETER NAMEDESCRIPTION
resultValues: 0 (OK) or 1 (USER INVALID)
useridUser identifier within the IDC Games platform
usercrcfor security reasons we add a CRC that always will match the userid, it can be used to avoid man-in-the-middle securiy problems.
language2 letters that indicate the language of the user (ISO 639-1)
country2 letters that indicates the country code (ISO 3166-1)
currency3 letters indicating the curreny that the user has used to buy in the platfotm (ISO-4217)

Example of the request

```http
https://www.idcgames.com/unilogin/getAccessData.php? idctk=6ae4e9d12e76438eb41955c09c9369ef&idcgameid=999&idcuuid=6022DAAE-03F7-11E9-BB88-E86A6485A3C7
```

Example of the answer

==

Login with Web Service Definition Language (WSDL)

The WSDL to retrieve the available web services is at the following URL:

```http
https://www.idcgames.com/unilogin/idcws.php?wsdl
```

The web services available are GetAccessData and GetUserProfileInfo and the parameters of the answer are the same as explained at the Login Overview section above.

Request extra user's info in C#

Method definitions:

=

At the class that calls the method:

```csharp
IntBuilder nick = new IntBuilder(80);
StringBuilder email = new StringBuilder(320);
StringBuilder avatar = new StringBuilder(2048);
StringBuilder status = new StringBuilder(256);
StringBuilder custom = new StringBuilder(256);
Int result = getUserProfileInfo (userid, apisecret, nick, email, avatar, status, custom);
```

Request extra user's info in HTTP

```http
https://www.idcgames.com/unilogin/getUserProfileInfo.php?
```

Parameters of the request:

  • &userid
  • &apisecret with the following values: 0 (OK) or 1 (USER INVALID)
  • nick: user's nick
  • email: user's email address, of provided
  • avatar: URL to the user's avatar's image
  • status: conexion status of the user: online, offline, etc.
  • custom: custom user's status message