By Björn Ritzl on Apr 21, 2021
Yandex.Games is a catalog of browser-based online games that can be played on smartphones or desktop devices and require no installation. Most games are also available offline (code for these games is added to the device cache during the first gaming session).
Games from the catalog are displayed in Yandex recommendation systems (for example, in the Yandex app feed and in Yandex Browser), which have a total audience of more than 50 million users per month.
In this blog post we’ll look at how to add the Yandex.Games SDK to a Defold game and how to submit your game to the Yandex.Games catalog.
Are you ready? Ok, let’s go!
Before anything else you need to create a Yandex account. Head over to the registration page to get started.
Next you also need to create a developer account for Yandex.Games.
The two steps above are also described in the official Yandex documentation in case you need to go back and verifying anything.
Once you have a Yandex.Games developer account you have access to the Yandex.Games dashboard from where you can submit games. The only requirement to release a game on Yandex.Games is that the game integrates the Yandex.Games SDK. Let’s see how this is done!
The first step to integrating the Yandex.Games SDK is to add the Defold version of the SDK to your project. Open your project in the Defold editor and open the game.project file and in the Dependencies field in the Project section add:
https://github.com/indiesoftby/defold-yagames/archive/refs/heads/master.zip
Your game now has the Yandex.Games SDK integrated and it is ready for release to the Yandex.Games portal. Before you release the game it is recommended that you also configure your game to show ads and earn some money!
Before you can use the Yandex.Games SDK in Defold you need to initialise it:
local yagames = require("yagames.yagames")
local function init_handler(self, err)
if err then
print("Something went wrong:", err)
end
end
function init(self)
yagames.init(init_handler)
end
Yandex supports a number of different ad formats, each with their own use-case. The supported ad formats are:
When showing interstitial and rewarded ads it is important that you pause your game and mute sounds while the ad is shown.
Interstitial ads are displayed in full-screen mode. To make ads less obtrusive, Yandex recommends that you limit ads to three inserts: before the game starts, before the user proceeds to the next level, and at the end of the game (for example, after the user has lost).
You show an Interstitial Ad like this:
local yagames = require("yagames.yagames")
local function adv_open(self)
-- You should switch off all sounds!
end
local function adv_close(self, was_shown)
-- You can switch sounds back!
end
local function adv_offline(self)
-- Internet is offline
end
local function adv_error(self, err)
-- Something wrong happened :(
end
yagames.adv_show_fullscreen_adv({
open = adv_open,
close = adv_close,
offline = adv_offline,
error = adv_error
})
The different callback functions works as follows:
open
- Called when an ad is opened successfully.close
- Called when an ad is closed, an error occurred, or on ad failed to open due to too frequent calls. Used with the was_shown argument (type boolean), the value of which indicates whether an ad was shown.offline
- Called when the network connection is lost (when offline mode is enabled).error
- Called when an error occurs. The error object is passed to the callback function.The close callback is called in any situations, even if there was an error.
Rewarded ads are video ads used to give the player a reward or in-game currency for watching an ad. As opposed to the limitations on frequency of interstitial ads you can show rewarded ads as often as you want.
You show a Rewarded Ad like this:
local yagames = require("yagames.yagames")
local function rewarded_open(self)
-- You should switch off all sounds!
end
local function rewarded_rewarded(self)
-- Add coins!
end
local function rewarded_close(self)
-- You can switch sounds back!
end
local function rewarded_error(self, err)
-- Something wrong happened :(
end
yagames.adv_show_rewarded_video({
open = rewarded_open,
rewarded = rewarded_rewarded,
close = rewarded_close,
error = rewarded_error
})
The different callback functions works as follows:
open
- Called when a video ad is displayed on the screen.rewarded
- Called when a video ad impression is counted. Use this function to specify a reward for viewing the video ad.close
- Called when a user closes a video ad or an error happens.error
- Called when an error occurs. The error object is passed to the callback function.The close callback is called in any situations, even if there was an error.
Showing banner ads is a little bit more involved and it is recommended that you check the official documentation to learn how to set this up in your game.
The Yandex.Games SDK contain many additional features besides ads. You can use the SDK to do user authentications, read player information and handle payments and sale of in-game goods.
Learn more about the full capabilities in the documentation of the Yandex.Games SDK integration for Defold.
When your game has integrated the Yandex.Games SDK and implemented the functionality to initialise the SDK and show ads it is ready to be submitted to Yandex.Games. Before you can submit the game you need to register the game on the Yandex.Games developer dashboard. Login to the Yandex.Games developer dashboard and select the “Add app” option and fill out the form. All of the field of the form are described in the “Add new game” manual in the official documentation.
Once the game has been submitted it must pass moderation before it can be added to the Yandex.Games catalog. This will take up to three business days. Make sure your game follows the Yandex.Games requirements. You should also test your game before sending it for moderation to catch simple mistakes.
To open a game in test mode:
More on testing in the official Yandex.Games documentation.
It is highly recommended that you translate your game to Russian for the best performance on Yandex.
We hope this tutorial will kickstart your journey towards success on Yandex.Games. If you have any questions be sure to reach out to us on the Defold forum.
Below you will find a list of games made with Defold on Yandex. We wish you good luck with your own game!