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:
Module | Description | Native HTML5 | Cocos | Unity |
---|---|---|---|---|
JOGOS_SDK.user | Interaction with logged-in users | 🟩 Fully supported | 🟩 Fully supported | 🟩 Fully supported |
JOGOS_SDK.game | Game behaviors | 🟩 Fully supported | 🟩 Fully supported | 🟩 Fully supported |
JOGOS_SDK.banner | In-game banner ads | 🟩 Fully supported | 🟩 Fully supported | 🟩 Fully supported |
JOGOS_SDK.ad | Video ads | 🟩 Fully supported | 🟩 Fully supported | 🟩 Fully supported |
JOGOS_SDK.data | Cloud save | 🟦 Coming soon | 🟦 Coming soon | 🟦 Coming soon |
JOGOS_SDK.friend | Friends and groups | 🟨 Not supported yet | 🟨 Not supported yet | 🟨 Not supported yet |
JOGOS_SDK.purchase | In-app purchases and one-time purchases | 🟩 Fully supported | 🟩 Fully supported | 🟩 Fully supported |
JOGOS_SDK.Active | Achievements 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
:
<script src="https://www.jogos.com/sdk/jogos-sdk-v1.js"></script>
Promise
Most methods in JOGOS_SDK
are asynchronous and can be called using await
:
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:
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.
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 asvideo ads/banners
and others, and will not interact with the service or load real ads.Preview tool
provides real preview and detection functions in ourQA
environment. After the game is integrated withJOGOS_SDK
, you can preview your game after creating a new game on the Developer Portal and uploading the relevant game resource files.