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 | 🟩 Fully Supported | 🔳 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 the initialization success callback, do not miss the SysInfo object you can obtain, which contains important information about your game engine:
- If you want to automatically optimize the control interface based on player device type, use the
deviceTypefield. - If you want to dynamically sync server time to ensure event fairness, use the
serverTimefield. - If you want to automatically switch localization text based on player language setting, use the
languagefield. - If you want to flexibly control the display frequency of banner ads, use the
bannerIntervalTimefield. - If you want to implement inviting platform friends in multiplayer game scenes, use the
invateArgsfield. - If you want to optimize compatibility performance for different OS versions, use the
osfield.
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
"gamePrice": number;//One-time purchase game price
"invateArgs": number;// Invitation Parameter
}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.