Issues when releasing an XNA / KNI game on Yandex Games

In this post, I want to talk about the issues I faced when releasing a game on a web portal like Yandex Games.

About

I always wanted to use MonoGame, but the lack of support for web platforms stopped me from doing so. However, I found that KNI solved this issue, allowing me to create a web game with it. I didn’t want to make a standard web game; I wanted to make a game for Yandex Games.

Then I thought that making a web game with KNI might be risky since I didn’t know how it works on the web, so I decided to find an open-source game and port it. Luckily, I found one on itch.io called "Snowtime Delivery”, which originally you can play on itch.io.

I’ve ported it to Yandex Games, and now you can play it right in the browser on a computer or a mobile phone. Here is its repository.

Issues

These issues are related to the web build.

1. IO functions don’t work

Content.Load works fine, but I can’t read a file with File.ReadAllText and that is why I added this workaround.

2. Gamepads are not supported

When I try to read a gamepad state, the game throws an exception. I added defines and moved all code to the separate file.

3. Music is not started automatically, user input is necessary

It is not a problem of KNI, it is a general problem of web games. But KNI does nothing that allows you to start playing music as soon as possible. I added a check for user input and delay.

4. Touches are not working

I looked at KNI source code and it looks like the touch support is there, but I didn’t know why it is not working. I added custom handling of user input on mobile phones here and here.

5. Some weird window scale issues

I automatically scale the canvas to preserve constant aspect ratio, maybe that is why some weird scale behavior appeared in the game. I adjusted the scale values that work correctly on the web.

6. When music is playing the system player appears

KNI uses HTMLAudioElement for playing music, but it triggers the system player and it violates the 1.6.1.6 rule of Yandex Games. I added custom support for playing music via Web Audio API that is mimicking MediaPlayer here. I also faced the problem with delay when music starts playing, that is why I download it at the start of the game.

Conclusion

That is it all. I hope my post is helpful and someone could also release an XNA / KNI game on web portals too.

Links:

@nkast, what do you think about these issues?

1 Like