Getting Started
Welcome to the Arkadium Game SDK! This guide is designed to help you quickly understand the core concepts of our SDK and how it can enhance your game development and integration within the Arkadium Arena.
What is the Arkadium Game SDK?
The Arkadium Game SDK is a comprehensive toolkit designed for developers to seamlessly integrate their web games into the Arkadium Arena. The Arena is an online platform that hosts a wide array of web games, providing gamers with a diverse gaming experience. Each game on the Arena is rendered within an iframe on the game page, ensuring a secure and isolated environment for gameplay.
The SDK serves as a bridge between your game and the Arena, facilitating communication and interaction. It abstracts the complexities of interfacing with the broader web environment and the Arena's specific features, allowing developers to focus on creating engaging gaming experiences without worrying about the underlying integration logistics.
Capabilities of the Arkadium Game SDK
The Arkadium Game SDK empowers developers with a suite of tools and services designed to enhance the functionality, user experience, and monetization of your games within the Arena. Here's a breakdown of what the SDK allows you to do:
- Ad Management: Easily integrate and manage advertisements within your games. The SDK provides tools for displaying ads at optimal times, enhancing player experience and maximizing revenue.
- Analytics Tracking: Gain insights into how players interact with your game. The SDK enables tracking of events, page views, and errors, helping you understand player behavior and improve your game based on real data.
- Authorization: Understand and interact with the user's state within the Arena. The SDK enables you to check if a user is authorized, access user profile information, and manage authentication flows. This ensures a personalized and secure experience for each player.
- Host functionality Access: Access the Arena's functionalities, including shop and query parameters. This allows for a seamless integration and interaction between your game and the Arena, enhancing user experience by leveraging the broader platform's capabilities.
- Persistence: Utilize local storage to save and load game states and access cookies. This feature ensures that players can resume their gameplay from any device, providing a convenient and consistent gaming experience.
By leveraging the Arkadium Game SDK, developers can not only streamline the integration process but also unlock advanced features and capabilities that enhance the overall quality and performance of their games within the Arena.
Installation
Our sdk is available via two options:
CDN
<script src="https://developers.arkadium.com/cdn/sdk/v2/sdk.js"></script>
<script>
document.addEventListener('DOMContentLoaded', async () => {
const sdk = await window.ArkadiumGameSDK.getInstance();
// use sdk here
sdk.lifecycle.onTestReady(); //called when game is ready to be shown
});
</script>
npm
npm install @arkadiuminc/sdk@^2
import { getInstance, Env } from '@arkadiuminc/sdk';
const sdk = await getInstance();
// use sdk here
sdk.lifecycle.onTestReady(); //called when game is ready to be shown
Always make sure to call the onTestReady()
event once the game is ready to be shown to the user.
Failing to do so will prevent the Game Loading overlay from being removed on the Arena, and the user will not be able to interact with the game.
Enable logs
sdk.debugMode(true);
Development
Your game runs on different domains during development and release, which the SDK considers to be different environments.
The localhost
and 127.0.0.1
domains are considered local environments.
Advertisements are not available. Instead, an overlay text will be displayed.
For other events such as happy time, gameplay start, etc. the console output can be consulted.
If you are using a different domain/IP for local development,
you can always enforce the local environment by appending the
?useLocalSdk=true
query parameter to the URL in your browser.
On Arkadium domains the SDK has the arkadium
environment, where it functions properly.
On any other domains (including your domain on which you may host your game) the SDK has the disabled environment. All the calls to the SDK methods will throw an error (or call the error callback). To prevent this, we recommend checking on which environment the SDK is running, and avoid making use of it outside local or arkadium environments.
When you upload your game we only look at your index.html file, and provide the game loader for you. The sdk.html page will not be used: keep any logic out of that file, and make sure that your index.html does not include the game loader.
Testing on Sandbox
To test your game using the Sandbox section, please refer to this section.