Skip to content

Introduction

Before integrating JOGOS_SDK, please be sure to follow our requirements. It will help you use JOGOS_SDK in the best way and provide guidance on technical, game content, advertising, and account integration requirements. In addition to Unity and Cocos which can use their exclusive SDKs, your other engines can integrate these functions through the HTML5 version, because most game engines that support WebGL have ways to interact with JavaScript when running in a browser.

JOGOS_SDK includes the following modules:

ModuleDescriptionNative HTML5CocosUnity
JOGOS_SDK.userInteraction with logged-in users🟩 Fully supported🟩 Fully supported🟩 Fully supported
JOGOS_SDK.gameGame behaviors🟩 Fully supported🟩 Fully supported🟩 Fully supported
JOGOS_SDK.bannerIn-game banner ads🟩 Fully supported🟩 Fully supported🟩 Fully supported
JOGOS_SDK.adVideo ads🟩 Fully supported🟩 Fully supported🟩 Fully supported
JOGOS_SDK.dataCloud save🟦 Coming soon🟦 Coming soon🟦 Coming soon
JOGOS_SDK.friendFriends and groups🟨 Not supported yet🟨 Not supported yet🟨 Not supported yet
JOGOS_SDK.purchaseIn-app purchases and one-time purchases🟩 Fully supported🟩 Fully supported🟩 Fully supported
JOGOS_SDK.ActiveAchievements and leaderboards🟦 Coming soon🟦 Coming soon🟦 Coming soon

Getting Started

This section describes how to get JOGOS_SDK up and running in your engine.

Please add the following script to the body of your game's index.html file to import JOGOS_SDK:

html
<script src="https://www.jogos.com/sdk/jogos-sdk-v1.js"></script>
Manual Initialization

JOGOS_SDK needs to be initialized before use. Complete the initialization by calling the JOGOS_SDK.init method:

javascript
await window.JOGOS_SDK.init();

The JOGOS_SDK.init method is asynchronous, and any other method cannot be used until the JOGOS_SDK.init method is successfully executed. We strongly recommend that you do this before the game starts.

If other methods are called before JOGOS_SDK.init is successfully called, the exception "460 Can only be called after the successful call of the JOGOS_SDK.init method" will be thrown.

Promise

Most methods in JOGOS_SDK are asynchronous and can be called using await:

javascript
try {
  const user = await window.JOGOS_SDK.user.getUser();
  console.log(user);
} catch (err) {
  console.log('Get user error: ', err);
}

They can also be called using the Promise approach:

javascript
window.JOGOS_SDK.user
  .getUser()
  .then((user) => console.log(user))
  .catch((err) => console.log('Get user error: ', err));

You can download the sample scene for reference: HTML5_Demo.zip

Important Information

After the initialization is successfully callback, you can obtain SysInfo information. Please do not miss this part, which contains important information about the game engine you are using; you can get the language type currently used by platform users; let players automatically match the localized language when entering your game. Update the real server time in your game, etc.

javascript
SysInfo{
    "gameId": number;//Game Id
    "hasGameGroup":bool;//Whether group chat is enabled
    "deviceType": "desktop"// possible values: "desktop", "tablet", "mobile"
    "language": string;//Language type
    "os":"Windows 10"//Operating system and version
    "browser":"Chrome 10.0"//Browser and version
    "serverTime": number;//Current server time
}

Development and Testing

During development, you will execute JOGOS_SDK in different environments:

  • localhost When debugging and developing locally, JOGOS_SDK will try to simulate behaviors such as video ads/banners and others, and will not interact with the service or load real ads.
  • Preview tool provides real preview and detection functions in our QA environment. After the game is integrated with JOGOS_SDK, you can preview your game after creating a new game on the Developer Portal and uploading the relevant game resource files.