Mahjong recreation start
This article describes the start of Mahjong game recreation.
Plan
We started Mahjong recreation endeavour by composing a brief plan to get gameplay with minimal graphics:
- Load single layout
- Place tiles in layout positions
- Distinguish tiles
- Implement selection
- Implement matching
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:
- Desktop can access almost any file
- Android/iOS have limited access to file system
- Web does not have any file system at all
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.
mjin-resource:
- converts binary files to C header files with the help of xxd utility
- generates MJIN project that contains generated headers to be compiled into static library
- provides C++ interface for accessing generated resources
mahjong-data is an example of such generated MJIN project that is referenced by mahjong project.
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.
Development
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:
- education: show how development looks like internally
- accessibility: provide older versions for comparison
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.
The year of lessons
So, the year 2017 is approaching its finale, the year's results have already
been summed up. We're going to take a break from igniting the fireworks or
preparation of the champagne so that we can designate our goal for the
following year.
As it may be clear from ...
Read More
2017 summary
It's time to step back to see our accomplishments in 2017 and how they connect to the overall goal of Opensource Game Studio project.
Brief history
Opensource Game Studio project is 12 years old now.
2005. We started the project with a fanatic call to create the best game ...
Read More
Back to the Static
We have been using Wordpress as our website engine for more than seven years. And now it's time to move forward. Or backward.
For some time we've been tracking the development of the new breed of website engines - static site generators.
It seems that this is the technology ...
Read More
The birth of MJIN world
This article describes the birth of MJIN world in August 2017.
mjin-player
As you know, we spent July to research scripting. We found a solution that satisfies the following criteria. Scripts should:
- run unchanged on all supported platforms
- allow extending C++ code
We have verified the second criterion by writing ...
Read More
Scripting research
This article describes scripting research in July 2017.
Our first goal of using a scripting language was to have a platform-independent code that runs unchanged on every supported platform.
OGS Editor 0.10 supports Python for such a code thanks to SWIG. SWIG provides a way to wrap almost any ...
Read More
OpenSceneGraph cross-platform guide
This article summarizes the work we did to produce OpenSceneGraph cross-platform guide.
June marked the finish of OpenSceneGraph cross-platform guide with the publishing of the last (initially planned) tutorial. The tutorial describes how to build and run sample OpenSceneGraph application in Web using Emscripten.
In case you missed it, here ...
Read More
iOS tutorial
This article describes problems we faced during the creation of iOS tutorial in May 2017.
This February we managed to get simple model rendered under iOS in just a few days. We expected to finish iOS tutorial in no time. However, the reality reminded us: it's easy to come ...
Read More
OpenSceneGraph sample
This article describes creation of the tutorials for building sample OpenSceneGraph application under Linux, macOS, Windows, and Android in April 2017.
Previous tutorials described how to install OpenSceneGraph under Linux, macOS, Windows and render a model using the standard osgviewer tool. This time we worked on a sample OpenSceneGraph application ...
Read More
It's all fine
This article describes creation of the first four OpenSceneGraph tutorials in March 2017.
The first four OpenSceneGraph tutorials explain how to create a cube model with Blender and display the model under Linux, macOS, or Windows using OpenSceneGraph tool called osgviewer.
The whole process of creating a single tutorial turned ...
Read More