You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 line
6.6KB

  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <link rel="stylesheet" href="../../style.css">
  6. </head>
  7. <body>
  8. <script data-goatcounter="https://services.opengamestudio.org:443/count" async src="//services.opengamestudio.org:443/count.js"></script>
  9. <div id="header">
  10. <div>
  11. <strong id="title">Open Game Studio</strong>
  12. <div id="lang">
  13. <a href="../../en/news/mahjong-recreation-start.html">EN</a>
  14. <a href="../../ru/news/mahjong-recreation-start.html">RU</a>
  15. </div>
  16. </div>
  17. <div class="header2">
  18. <div class="menu">
  19. <a href="../../en/news/index.html">News</a>
  20. <a href="../../en/game/index.html">Games</a>
  21. <a href="../../en/tool/index.html">Tools</a>
  22. <a href="../../en/page/about.html">About</a>
  23. </div>
  24. <a class="discord" href="https://discord.gg/3A6THQabNf">
  25. <img src="../../images/discord.png"></img>
  26. </a>
  27. <div class="clear"></div>
  28. </div>
  29. </div>
  30. <h3 class="left_item_title">In the news...</h3>
  31. <center>
  32. <div class="news_item">
  33. <h2 class="news_item_title">
  34. <a href="mahjong-recreation-start.html">Mahjong recreation start</a>
  35. </h2>
  36. <p class="news_item_date">
  37. 2018-01-26 00:00
  38. </p>
  39. <div class="news_item_contents">
  40. <p><img src="../../images/2018-01-26-mahjong-recreation-start.png" alt="Spherical tiles in a Mahjong layout" /></p>
  41. <p>This article describes the start of Mahjong game recreation.</p>
  42. <p><strong>Plan</strong></p>
  43. <p>We started Mahjong recreation endeavour by composing a brief plan to get gameplay with minimal graphics:</p>
  44. <ul>
  45. <li>Load single layout</li>
  46. <li>Place tiles in layout positions</li>
  47. <li>Distinguish tiles</li>
  48. <li>Implement selection</li>
  49. <li>Implement matching</li>
  50. </ul>
  51. <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>
  52. <p><strong>Problem №1: provide binary resources across supported platforms</strong></p>
  53. <p>Mahjong is going to be available on desktop, mobile, and web. Each of these platforms has its constraints on accessing external files:</p>
  54. <ul>
  55. <li>Desktop can access almost any file</li>
  56. <li>Android/iOS have limited access to file system</li>
  57. <li>Web does not have any file system at all</li>
  58. </ul>
  59. <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>
  60. <p><a href="https://bitbucket.org/ogstudio/mjin-resource">mjin-resource</a>:</p>
  61. <ul>
  62. <li>converts binary files to C header files with the help of <strong>xxd</strong> utility</li>
  63. <li>generates MJIN project that contains generated headers to be compiled into static library</li>
  64. <li>provides C++ interface for accessing generated resources</li>
  65. </ul>
  66. <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>
  67. <p><strong>Problem №2: load PNG images across supported platforms</strong></p>
  68. <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>
  69. <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>
  70. <p><strong>Development</strong></p>
  71. <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>
  72. <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>
  73. <ul>
  74. <li>education: show how development looks like internally</li>
  75. <li>accessibility: provide older versions for comparison</li>
  76. </ul>
  77. <p><strong>Current Mahjong game status</strong></p>
  78. <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>
  79. <p>Once we finish tile matching implementation, we are going to publish the intermediate result for all supported platforms.</p>
  80. <p>That's it for describing the start of Mahjong game recreation.</p>
  81. </div>
  82. </div>
  83. <div id="disqus_thread"></div>
  84. <script>
  85. var disqus_config = function () {
  86. this.page.url = "https://opengamestudio.org/en/news/mahjong-recreation-start.html";
  87. this.page.identifier = "mahjong-recreation-start.html";
  88. };
  89. (function() { // DON'T EDIT BELOW THIS LINE
  90. var d = document, s = d.createElement('script');
  91. s.src = 'https://opengamestudio.disqus.com/embed.js';
  92. s.setAttribute('data-timestamp', +new Date());
  93. (d.head || d.body).appendChild(s);
  94. })();
  95. </script>
  96. <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  97. <div id="footer">
  98. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  99. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  100. </div>
  101. </center>
  102. </body>
  103. </html>