|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <!DOCTYPE html>
- <html>
- <meta charset="utf-8">
- <head>
- <style>
- #header
- {
- background: #2BA6E3;
- padding: 0.7em;
- text-align: left;
- }
- #header a
- {
- color: white;
- text-decoration: none;
- padding: 0.5em 1em 0.5em 1em;
- }
-
- #lang
- {
- float: right;
- }
-
- .news_item
- {
- background: #FFFFFF;
- width: 720px;
- padding: 1em;
- margin-top: 2em;
- margin-bottom: 2em;
- border: 1px solid #E0E0E0;
- text-align: left;
- }
- .news_item_contents
- {
- color: #444;
- line-height: 1.5em;
- }
- .news_item_date
- {
- margin-bottom: 2em;
- color: #aaa;
- }
-
- html
- {
- font-family: sans-serif;
- }
- body
- {
- background: #FAFAFA;
- }
- code, pre
- {
- font-family: monospace, serif;
- font-size: 1em;
- color: #7f0a0c;
- }
- img
- {
- width: 720px;
- }
- a
- {
- color: #3A91CB;
- }
-
- table
- {
- border-collapse: collapse;
- }
- table, th, td
- {
- border: 1px solid #aaa;
- padding: 0.5em;
- margin-top: 0.5em;
- margin-bottom: 0.5em;
- }
- </style>
- </head>
- <body>
- <script data-goatcounter="https://services.opengamestudio.org:443/count" async src="//services.opengamestudio.org:443/count.js"></script>
- <div id="header">
- <strong id="title">Open Game Studio</strong>
- <a href="../../en/news/index.html">News</a>
- <a href="../../en/game/index.html">Games</a>
- <a href="../../en/tool/index.html">Tools</a>
- <a href="../../en/page/about.html">About</a>
- <div id="lang">
- <a href="../../en/news/mahjong-recreation-start.html">EN</a>
- <a href="../../ru/news/mahjong-recreation-start.html">RU</a>
- </div>
- </div>
- <center>
- <h1>In the news...</h1>
- <div class="news_item">
- <h2 class="news_item_title">
- <a href="mahjong-recreation-start.html">Mahjong recreation start</a>
- </h2>
- <p class="news_item_date">
- 2018-01-26 00:00
- </p>
- <div class="news_item_contents">
- <p><img src="../../images/2018-01-26-mahjong-recreation-start.png" alt="Spherical tiles in a Mahjong layout" /></p>
- <p>This article describes the start of Mahjong game recreation.</p>
- <p><strong>Plan</strong></p>
- <p>We started Mahjong recreation endeavour by composing a brief plan to get gameplay with minimal graphics:</p>
- <ul>
- <li>Load single layout</li>
- <li>Place tiles in layout positions</li>
- <li>Distinguish tiles</li>
- <li>Implement selection</li>
- <li>Implement matching</li>
- </ul>
- <p>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.</p>
- <p><strong>Problem №1: provide binary resources across supported platforms</strong></p>
- <p>Mahjong is going to be available on desktop, mobile, and web. Each of these platforms has its constraints on accessing external files:</p>
- <ul>
- <li>Desktop can access almost any file</li>
- <li>Android/iOS have limited access to file system</li>
- <li>Web does not have any file system at all</li>
- </ul>
- <p>To provide a unified way for accessing resources, we decided to include them into final executable. This decision led to the birth of <strong>mjin-resource</strong> and <strong>mahjong-data</strong> projects.</p>
- <p><a href="https://bitbucket.org/ogstudio/mjin-resource">mjin-resource</a>:</p>
- <ul>
- <li>converts binary files to C header files with the help of <strong>xxd</strong> utility</li>
- <li>generates MJIN project that contains generated headers to be compiled into static library</li>
- <li>provides C++ interface for accessing generated resources</li>
- </ul>
- <p><a href="https://bitbucket.org/ogstudio-games/mahjong-data">mahjong-data</a> is an example of such generated MJIN project that is referenced by <a href="https://bitbucket.org/ogstudio-games/ogs-mahjong">mahjong</a> project.</p>
- <p><strong>Problem №2: load PNG images across supported platforms</strong></p>
- <p>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 <strong>libpng</strong>, which OpenSceneGraph build script can't detect. We had to work around several OpenSceneGraph checks to successfully build the plugin for Emscripten.</p>
- <p>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 <a href="https://github.com/ogstudio/openscenegraph-cross-platform-guide">OpenSceneGraph cross-platform guide</a> to cover PNG image loading. We already got a <a href="https://github.com/OGStudio/openscenegraph-cross-platform-guide/issues/4">request to describe image loading</a>.</p>
- <p><strong>Development</strong></p>
- <p><a href="lets-go.html">As you know</a>, 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 <a href="https://bitbucket.org/ogstudio-games/ogs-mahjong">mahjong repository</a>.</p>
- <p>We also provide <a href="http://ogstudio.github.io/game-mahjong">version history and web releases of each internal version</a> for the following reasons:</p>
- <ul>
- <li>education: show how development looks like internally</li>
- <li>accessibility: provide older versions for comparison</li>
- </ul>
- <p><strong>Current Mahjong game status</strong></p>
- <p>As of the time of this writing, we have implemented tile selection. <a href="https://ogstudio.github.io/game-mahjong/versions/010/mjin-player.html">Try it in your browser!</a></p>
- <p>Once we finish tile matching implementation, we are going to publish the intermediate result for all supported platforms.</p>
- <p>That's it for describing the start of Mahjong game recreation.</p>
- </div>
- </div>
- <div id="footer">
- The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
- from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
- The site is hosted by <a href="https://pages.github.com">GitHub Pages</a>.
- </div>
- </center>
- </body>
- </html>
|