Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

mahjong-recreation-start.html 6.4KB

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