Today in the release - the story of the technical director of the game company Play4fun about the development of the recent slot game on Unity and WebGL.
Play4fun was founded in 2011. The first game we released Slots Discovery immediately thwarted the applause of users and was permanently entrenched in the tops of mobile shops and gaming databases https://bettingcasinoslots.com/10-no-deposit-slot-bonus/ that reviewed the game and offered to play for free or for bonuses provided by online casino operators. However, we understood that the success of one project should find a logical continuation in new products. So the idea of hardcore slots for the male audience - Over Slot, which became our first project on Unity.
Slots were launched in December 2014. From the idea to the soft-launch on iOS was only three months. In April, the game was seen by Android users. And recently the list of mobile platforms has replenished Amazon Fire OS.
The first difficulties arose when it was time to release Over Slot on the web platform. Since the company already had experience launching a test project on Unity WebPlayer, we had an idea of the main pitfalls:
problems with speed;
problems with the correct display of graphic elements;
Low level of conversion of clicks to installations due to the need to download Unity Web-Player, which made most of the traffic sources unprofitable.
In addition to everything, Google has blocked the NPAPI (Netscape Plugin Application Programming Interface) in Chrome. Since Chrome is the main browser for the vast majority of our audience, the implementation of the game on Unity WebPlayer was immediately discarded. So it was decided to use WebGL.
And so go on
In general, the development of the web-version with all the optimization moments took about a month.
The first launch of the application, of course, was a lump. But, looking through the logs in the browser console, we immediately found the cause of the problems and after an hour saw the game download screen. It was just an incredible breakthrough in such a short time.
Over Slot were originally designed for the ability to go offline by synchronizing the player's data with the server. However, in the case of the web, I had to transfer some of the logic to the server, because it is currently impossible to store data on the user's computer (because of the additional security measures that the browsers use to the executable content from the iframe).
The next step was to revise each stage of the game launch and replace all calls to the file system (which was an indispensable part of offline mode in the mobile version) to access the server.
The logic of working with AssetBundle (resources) was completely the same as on mobile devices. The only difference was that the downloaded resources were cached by the browser, and not stored on disk. The maximum size of a single downloadable resource was reduced to 10 MB so that all supported browsers accurately cached it.
Once we figured out the consequences of moving offline logic to the server and uploading and storing resources, our goal came close to arm's length. We saw the lobby of the game and even managed to enter the slot. Particularly pleased that due to an optimized rendering of Unity for WebGL, the performance and performance of the game were at a level, even though using shaders that require quite a lot of calculations.
Almost all UI games (except for animations, about them later) earned immediately - also a considerable relief for us after problems with different resolutions on mobile devices. But not without a fly in the ointment - on mobile platforms, there is no need for a button guidance state.
In the browser, it was a logical and necessary correction.
Especially a lot of time was spent on working with animations. Slot game uses a huge number of large frame animations that have become incorrectly displayed due to memory problems.
For some time, attempts to find the optimal solution was in vain. For support, they turned to Unity Support, who advised to squeeze problem animations using the Crunch method, added to Unity 5.1. This additionally reduced the size of atlases (collections of sprites) by half with a slight loss of quality (up to 10-15% of the original). As a result, we were able to optimize animations more than four times, and they began to work as consistently and qualitatively as on mobile versions of the application.