You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove deprecated stuff and add extesion properties (#46)
* Add extension properties file
* Remove deprecated Service Worker and related files; update README and build scripts for new demo structure.
* Update README to enhance clarity on SDK initialization and advertisement implementation steps.
if [ "${BOB_LOCAL_SHA1}" != "${BOB_SHA1}" ]; then wget --progress=dot:mega -O build/bundle/bob.jar "https://d.defold.com/archive/${BOB_SHA1}/bob/bob.jar"; fi
Copy file name to clipboardExpand all lines: README.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,23 +29,25 @@ You can use it in your own project by adding this project as a [Defold library d
29
29
- Icon 512 x 512 px.
30
30
- Cover 800 x 470 px.
31
31
- Screenshots.
32
-
4. Add [the extension](https://github.com/indiesoftby/defold-yagames/archive/master.zip) as a Defold library dependency to your project.
33
-
5. Enable monetization and earn revenue from placing ad blocks in your game. Ad blocks are available in the following formats:
32
+
4. Add [the extension](https://github.com/indiesoftby/defold-yagames/archive/master.zip) as a Defold library dependency to your project.
33
+
5. Initialize the SDK in your game - see [Initialization](#-initialization-docs) section below for the API details.
34
+
6. Implement advertisement in your game - see [Advertisement](#-advertisement-docs) section below for the API details.
35
+
7. Enable monetization and earn revenue from placing ad blocks in your game. Ad blocks are available in the following formats:
34
36
-**Interstitial blocks**: ad blocks that completely cover the app background and show up at certain points (for example, when accessing the next game level). *Important: Mute sounds before showing the ad!*
35
37
-**Rewarded videos**: blocks with video ads that the user can choose to view and earn a reward or in-game currency. *Important: Mute sounds before showing the ad!*
36
38
-**Sticky banners**: banner ads, super easy to setup.
37
39
-**In-game purchases**: earn revenue by providing paid services to your users.
38
-
5. You can [publish your game on Yandex.Games](https://games.yandex.ru/console/) from this moment.
40
+
8. You can [publish your game on Yandex.Games](https://games.yandex.ru/console/) from this moment.
39
41
40
42
### Best Practices & Tips
41
43
42
44
1. The YaGames extension imitates a real API on *non-HTML5* platforms. The idea is to allow to you quickly implement API on your favourite platform (macOS, Windows, Linux) and don't spend time on slowly rebuilding/uploading the game to the Yandex.
43
-
2. The code from `yagames/manifests/web/engine_template.html` is always added to your HTML5 template. This behaviour can't be disabled. Tip: use Git-branching for every HTML5 platform and do not mix platform-specific code between them.
45
+
2. The code from `yagames/manifests/web/engine_template.html` is always added to your HTML5 template. **This behaviour can't be disabled.** Tip: use Git-branching for every HTML5 platform and do not mix platform-specific code between them.
44
46
3. You don't need to set up any cache-busting techniques, since Yandex.Games hosts each version of your game in separate paths.
45
47
46
48
## Code Examples
47
49
48
-
Take a look at the demo project inside `example` directory. It has quite a few buttons to test all APIs. You can use it in your game as a debug screen or simply [download/upload a pre-built .zip archive](https://github.com/indiesoftby/defold-yagames/blob/gh-pages/demo_no-sw_no-native-cache.zip?raw=true) to make sure that you implemented SDK in the right way.
50
+
Take a look at the demo project inside `example` directory. It has quite a few buttons to test all APIs. You can use it in your game as a debug screen or simply [download/upload a pre-built .zip archive](https://github.com/indiesoftby/defold-yagames/blob/gh-pages/demo.zip?raw=true) to make sure that you implemented SDK in the right way.
49
51
50
52

51
53
@@ -3212,28 +3214,28 @@ end
3212
3214
```ini
3213
3215
[yagames]
3214
3216
sdk_url = /sdk.js
3215
-
sdk_init_options = {}
3216
-
sdk_init_snippet = console.log("Yandex Games SDK is ready!");
3217
+
sdk_init_options = { signed: false }
3218
+
sdk_init_snippet = console.log("Yandex Games SDK is ready!", ysdk);
3217
3219
service_worker_url = sw.js
3218
3220
```
3219
3221
3220
3222
*`sdk_url` - Sets the URL of the Yandex.Games SDK. In July 2024 the platform changed the URL of its SDK and now it can be of two kinds. First is the local `/sdk.js` for games you upload as an archive (default, **suitable for 99% of games**). The second is for iFrame games - `https://sdk.games.s3.yandex.net/sdk.js`.
3221
-
*`sdk_init_options` - JavaScript Object that is passed as-is into the Yandex Games SDK initialization options for [the JS `YaGames.init` function](https://yandex.ru/dev/games/doc/dg/sdk/sdk-about.html?lang=en). Example: `{ orientation: { value: "landscape", lock: true } }`.
3223
+
*`sdk_init_options` - JavaScript Object that is passed as-is into the Yandex Games SDK initialization options for [the JS `YaGames.init` function](https://yandex.ru/dev/games/doc/dg/sdk/sdk-about.html?lang=en). Example: `{ signed: true }`.
3222
3224
*`sdk_init_snippet` - JavaScript code that is passed as-is and called when the `ysdk` variable becomes available. Example: `console.log(ysdk);`. **Use with care, and don't forget to put a semicolon `;` at the end.**
3223
-
*`service_worker_url` - Relative URL to the Service Worker file. Usually it's `sw.js`. Set the URL to enable Service Worker.
3225
+
*`service_worker_url` - (deprecated) Relative URL to the Service Worker file. Usually it's `sw.js`. Set the URL to enable Service Worker.
3224
3226
3225
3227
### Misc
3226
3228
3227
3229
> [!TIP]
3228
3230
> We don't use these features in our games as we don't see any improvements in our games metrics, and the complexity of its integration and support is quite high.
3229
3231
3230
-
#### Service Worker How-To
3232
+
#### Service Worker
3231
3233
3232
-
Yandex dropped the Service Worker description page in their docs, but it still allows to integrate Service Worker into your game to be able to run both offline and online.
3234
+
Yandex dropped the Service Worker description page in their docs, but it still allows to integrate Service Worker into your game to be able to run both offline and online. This feature is deprecated and will be removed in the future.
3233
3235
3234
3236
1. Set the path to the file `sw.js` in the `game.project` settings.
3235
3237
2. Copy the `yagames/manifests/web/sw.js` file to the root directory of your release build.
3236
-
3. Edit the list of all game files inside your `sw.js`. Omit `sw.js` and `yandex-manifest.json`.
3238
+
3. Edit the list of all game files inside your `sw.js`. Omit `sw.js`.
3237
3239
4. You should increment the version inside `sw.js` on every update of your game on Yandex.Games.
0 commit comments