YaGames - Yandex.Games SDK for Defold

The new version 0.4.2 has been released! It adds support of:

The key feature is the optional payload parameter, which can be used for social features, i.e. inviting friends in your .io game session.

6 Likes

Version 0.5.0 has been released!
It implements the newest Feedback API and has updated docs with examples of how to style banner ads.

11 Likes

+1 game at Yandex :partying_face:

15 Likes

Yay! It’s still a damn good game!

7 Likes

Another Defold game on Yandex.Games:

10 Likes

Hi
Thanks for the excellent plugin!
Really a timesaver
I am having an issue though

DevTools failed to load source map: Could not load content for https://s3.mdst.yandex.net/games/source-maps/v6634140/sdk/v2-proxy.js.map: Connection error: net::ERR_CONNECTION_TIMED_OUT

DevTools failed to load source map: Could not load content for https://s3.mdst.yandex.net/games/source-maps/v6634140/sdk/v2.js.map: Fetch through target failed: Session is unregistering, can’t dispatch pending call to Network.loadNetworkResource; Fallback: Connection error: net::ERR_CONNECTION_TIMED_OUT

DevTools failed to load source map: Could not load content for https://s3.mdst.yandex.net/games/source-maps/v6634140/sdk/v2.js.map: Connection error: net::ERR_CONNECTION_TIMED_OUT

I asked our publisher about it, they said the issue is on the engine side. I guess what they mean is the dev’s problem, not theirs. I wonder if anyone has the solution for this?

Your publisher is wrong.

These messages are warnings from Chrome DevTools. It tries to download source maps for minified javascript files when you open DevTools. It seems Yandex doesn’t provide source maps for their private SDK, i.e. the files are absent or the URL to the source maps are invalid. That’s why you see these warnings. And they don’t affect the game in any way.

Does your game not run well because of these messages in Chrome DevTools Console?

5 Likes

I see, so that’s what that warning meant.

The game just wont’ run
See screenshot, it’s just black after Loading scene is finished

What if you upload a debug build, does the log say anything then?

2 Likes

You could try to run a local HTML5 build to find out the issue with your game. It’s a debug build, i.e. you’ll see possible errors and the print output in Chrome DevTools. Even outside the Yandex.Games platform it will run just fine (with some errors from Yandex.Games SDK, of course, without ads and other API).

image

If you’re sure that there is a problem with the Defold engine, you can upload the prebuilt YaGames demo project (download link) to your draft to check that.

2 Likes

I’ll give it a try, thanks! :slight_smile:
It’s odd because the same game has been uploaded to GameDistribution and widely distributed without any problems. I’ve only seen this problem working on Yandex build. Not sure yet what may cause it. I guess the only way to check would be to sign up as Yandex dev so we can access the dashboard ourselves.

Yes! This is a great idea.

Also, you can set up a custom error handler to log Lua errors to the browser console in the release build:

local function setup_error_handler()
    if html5 and not sys.get_engine_info().is_debug then
        sys.set_error_handler(function(source, message, traceback)
            local s = source:gsub("'", "\\'"):gsub("\n", "\\n"):gsub("\r", "\\r")
            local m = message:gsub("'", "\\'"):gsub("\n", "\\n"):gsub("\r", "\\r")
            local t = traceback:gsub("'", "\\'"):gsub("\n", "\\n"):gsub("\r", "\\r")

            local pstatus, perr = pcall(html5.run, "console.error('LUA ERROR: (" .. s .. ")\\n" .. m .. "\\n" .. t .. "')")
            if not pstatus then
                -- Never happens
                print("FATAL: html5.run(..) failed: " .. perr)
            end
        end)
    end
end

-- do this in the main script of your bootstrap collection
function init(self)
    setup_error_handler()
end
6 Likes

Ah apparently it’s just a silly mistake on our end
A function was defined after the line where it’s called, that’s why it stuck at Black screen

Thanks @aglitchman @Mathias_Westerdahl , really appreciate all your help :slight_smile:

4 Likes

Yandex.Games has updated the full-screen ads algorithm.

Previously, the SDK limited fullscreen ad impressions to «once every three minutes». We are now moving to the «once every two minutes» limitation.

We will continue to experiment with these ad limitations so that user metrics donÊŒt drop and game developers’ earnings increase.

Please note: we recommend that developers call the display of full-screen ads in the game without taking into account the limitation, that is, as often as possible, but in suitable places in the game — so that the user understands that this is not a part of the game, but an ad unit. Do this in logical pauses in the game, for example: before starting the game, when moving to the next level, after losing.For example, inserting an ad unit is appropriate after going to the next level by pressing a button, and not appropriate in the middle of a level, when an ad suddenly appears under the playerÊŒs finger.

Important! High ad unit clicks that result in bounces on advertisers’ landing pages negatively impact user experience and undermine advertisers’ trust in the platform. Therefore, games with a high proportion of unmotivated/random clicks automatically receive less revenue and may be blocked by moderators.

3 Likes

Hey, guys! We have released the new game recently - Fish Eat Fish.

It’s a game for 1-3 players, and the main task is to eat smaller fish to grow. Currently, the game is only available in Russian.

*The development had started a long time before the announcement of YandexGames Jam, and the game doesn’t participate in the contest :hugs:

fish_eat_fish_hvideo1

14 Likes

Yandex.Games has started restricting the number of calls to cloud save functions (i.e. like set data, increase stats, etc). The current limit is 5 requests per 5 minutes. The point is that your game doesn’t pass the moderation if you don’t limit the request count internally in your game.

So, I extracted a small example from our games to show how to postpone a call to yagames.player_set_data if you hit the limit:

local throttled_player_save = {
    -- Last queued data
    queued = nil,

    -- Counters
    requests = 0,
    reset_time = 0,

    -- Consts
    MAX_REQUESTS = 5,
    RESET_PERIOD = 60 * 5,
}

-- @param data table
function throttled_player_save.queue(data)
    assert(type(data) == "table")

    local self = throttled_player_save

    self.queued = data
end

-- Call this function in script's update() function
function throttled_player_save.update()
    local self = throttled_player_save

    if not self.queued then
        return
    end

    local self = throttled_player_save
    local now = socket.gettime()

    if self.reset_time < now then
        -- i.e. do reset
        print("Reset counters")
        self.requests = 0
        self.reset_time = now + self.RESET_PERIOD
    end

    if self.requests >= self.MAX_REQUESTS then
        return
    end

    print("Save data (" .. (self.MAX_REQUESTS - self.requests) .. " requests left)")

    yagames.player_set_data(self.queued, false, function() end)
    self.requests = self.requests + 1
    self.queued = nil
end

-- # How to use
-- ------------
-- 
-- Call `throttled_player_save.update()` in your global script in the `update()` function.
-- Call `throttled_player_save.queue(data)` to save player's data to cloud, 
-- i.e. do that instead of directly calling `yagames.player_set_data()`.

8 Likes

Yandex Games has changed the limits for the all API calls, and they are now:

Player’s data

  • player_set_data(), player_get_data(): 100 req / 5 min.
  • player_set_stats(), player_get_stats(), player_increment_stats(): 60 req / 1 min.

Leaderboards

  • leaderboards_get_description(), leaderboards_get_player_entry(): 60 req / 5 min.
  • leaderboards_set_score(): 60 req / 1 min.
  • leaderboards_get_entries(): 20 req / 5 min.

All others

20 requests per 5 minutes.

4 Likes

This week, Yandex Games introduced the “Flags” panel in the Developer Console.

With these flags, new game features can now be enabled without additional updates or going through moderation. In fact, this is a remote configuration and you no longer need to use third-party services to remotely manage your game’s parameters.

Version 0.10.0 of the unofficial SDK for Defold has been released, and it implements the new remote config feature - Remote Config - SDK methods | Yandex Games SDK

Usage example:

    local options = { defaultFlags = { test1 = "A" }, clientFeatures = { { name = 'levels', value = '10' } } } -- also, options can be `nil`
    yagames.flags_get(options, function(self, err, result)
        -- `result` is a table
    end)
5 Likes