This article describes the start of Mahjong game recreation.
We started Mahjong recreation endeavour by composing a brief plan to get gameplay with minimal graphics:
Just like any other plan, this one looked fine at first sight. However, once you get down to work, new details start to come out. This plan was no exception. Below are a few problems that came out during development.
Problem №1: provide binary resources across supported platforms
Mahjong is going to be available on desktop, mobile, and web. Each of these platforms has its constraints on accessing external files:
To provide a unified way for accessing resources, we decided to include them into final executable. This decision led to the birth of mjin-resource and mahjong-data projects.
Problem №2: load PNG images across supported platforms
To load PNG, we use corresponding OpenSceneGraph plugin. We built it for desktop with no issues. Building for web (Emscripten) turned out to be more difficult: Emscripten provides its own version of libpng, which OpenSceneGraph build script can’t detect. We had to work around several OpenSceneGraph checks to successfully build the plugin for Emscripten.
Building the plugin for Android and iOS is still waiting for us. Once we get PNG plugin working across supported platforms, we are going to publish a new tutorial for OpenSceneGraph cross-platform guide to cover PNG image loading. We already got a request to describe image loading.
As you know, we published OpenSceneGraph cross-platform guide to make OpenSceneGraph community stronger. We value education, and we love to share our knowledge. That’s why we decided to develop Mahjong in small reproducible chunks uniquely identified by internal versions. These versions are available in mahjong repository.
We also provide version history and web releases of each internal version for the following reasons:
Current Mahjong game status
As of the time of this writing, we have implemented tile selection. Try it in your browser!
Once we finish tile matching implementation, we are going to publish the intermediate result for all supported platforms.
That’s it for describing the start of Mahjong game recreation.