Introduction
Before integrating the JOGOS_SDK, please be sure to follow our requirements. It will guide you on the best practices for using the JOGOS_SDK and provide direction on technical, game content, advertising, and account integration requirements. Apart from Unity and Cocos, which can use their dedicated SDKs, your other engines can integrate these features via the HTML5 version, as most game engines supporting WebGL have ways to interact with JavaScript when running in a browser.
The JOGOS_SDK includes the following modules:
| Module | Description | SDK Support | Integration Suggestion |
|---|---|---|---|
| JOGOS_SDK.init | Initialize the SDK | 🟩 Fully Supported | ☑️ Mandatory, detailed below |
| JOGOS_SDK.game | Game Behavior | 🟩 Fully Supported | ☑️ Mandatory, inform us about your game's load, start, or pause |
| JOGOS_SDK.user | Interact with logged-in users | 🟩 Fully Supported | 🔳 Optional, required if using the user system |
| JOGOS_SDK.banner | In-game banner ads | 🟩 Fully Supported | 🔳 Optional, if your game has Banner ads |
| JOGOS_SDK.ad | Rewarded video and interstitial ads | 🟩 Fully Supported | 🔳 Optional, if your game has video ads |
| JOGOS_SDK.data | Cloud save | 🟩 Fully Supported | 🔳 Optional, if you need to use Jogos cloud storage |
| JOGOS_SDK.friend | Friends and groups | 🟦 Coming Soon | 🔳 Optional, if your game requires a player interaction system |
| JOGOS_SDK.payment | In-app purchases and buy-to-play | 🟩 Fully Supported | 🔳 Optional, if your game has in-app purchases or is buy-to-play |
| JOGOS_SDK.active | Achievements and leaderboards | 🟩 Fully Supported | 🔳 Optional, if you need to use Jogos' achievements and leaderboard system |
| JOGOS_SDK.cdkey | CDKey functionality | 🟩 Fully Supported | 🔳 Optional, if you need Jogos to manage CDkeys for you |
| JOGOS_SDK.gameItem | Items & Store | 🟩 Fully Supported | 🔳 Not required for single-player games if Jogos manages item lists & paid purchases |
| JOGOS_SDK.room | Battle Room | 🟨 Not Supported | 🔳 Not required if LAN multiplayer is supported and platform provides online rooms |
Getting Started
This section explains how to get started and run the JOGOS_SDK within your engine.
Please add the following script inside the body of your game's index.html file to import the JOGOS_SDK:
<script src="https://www.jogos.com/sdk/jogos-sdk-v1.js"></script>Promise
The vast majority of methods in JOGOS_SDK are asynchronous and can be called using await:
try {
const user = await JogosSDK.getUser();
console.log(user);
} catch (err) {
console.log('Get user failed: ', err);
}
//Equivalent Promise calling method:
JogosSDK
.getUser()
.then((user) => console.log(user))
.catch((err) => console.log('Get user failed: ', err));Download the sample scene for reference: HTML5_Demo.zip
SysInfo Information
After successful initialization callback, you can obtain SysInfo information. Please do not miss this part, as it contains important information about the game engine you are using; you can get the language type used by the platform user; automatically match the localization language when players enter your game. Update the real server time in your game, etc.
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"; // OS and version
"browser": "Chrome 10.0"; // Browser and version
"serverTime": number; // Current server timestamp
"bannerIntervalTime": number;//Interval display time for game banner ads
"MidgameIntervalTime": number;//Interval display time for mid-game interstitial ads
}Development and Testing
During development, you will execute the JOGOS_SDK in different environments:
localhost: When debugging locally, theJOGOS_SDKwill attempt to simulatevideo ads/bannersand other behaviors, and will not interact with the service or load real ads.Preview tool: OurQAenvironment provides real preview and testing functionality. After integrating theJOGOS_SDKinto your game, you can preview your game on the Developer Portal once you have created a new game and uploaded the relevant game resource files.