您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

mahjong-recreation-start.html 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <style>
  6. #header
  7. {
  8. background: #2BA6E3;
  9. padding: 0.7em;
  10. text-align: left;
  11. }
  12. #header a
  13. {
  14. color: white;
  15. text-decoration: none;
  16. padding: 0.5em 1em 0.5em 1em;
  17. }
  18. #lang
  19. {
  20. float: right;
  21. }
  22. .news_item
  23. {
  24. background: #FFFFFF;
  25. width: 720px;
  26. padding: 1em;
  27. margin-top: 2em;
  28. margin-bottom: 2em;
  29. border: 1px solid #E0E0E0;
  30. text-align: left;
  31. }
  32. .news_item_contents
  33. {
  34. color: #444;
  35. line-height: 1.5em;
  36. }
  37. .news_item_date
  38. {
  39. margin-bottom: 2em;
  40. color: #aaa;
  41. }
  42. html
  43. {
  44. font-family: sans-serif;
  45. }
  46. body
  47. {
  48. background: #FAFAFA;
  49. }
  50. code, pre
  51. {
  52. font-family: monospace, serif;
  53. font-size: 1em;
  54. color: #7f0a0c;
  55. }
  56. img
  57. {
  58. width: 720px;
  59. }
  60. a
  61. {
  62. color: #3A91CB;
  63. text-decoration: none;
  64. }
  65. table
  66. {
  67. border-collapse: collapse;
  68. }
  69. table, th, td
  70. {
  71. border: 1px solid #aaa;
  72. padding: 0.5em;
  73. margin-top: 0.5em;
  74. margin-bottom: 0.5em;
  75. }
  76. </style>
  77. </head>
  78. <body>
  79. <div id="header">
  80. <strong id="title">Open Game Studio</strong>
  81. <a href="../../en/news/index.html">News</a>
  82. <a href="../../en/game/index.html">Games</a>
  83. <a href="../../en/tool/index.html">Tools</a>
  84. <a href="../../en/page/about.html">About</a>
  85. <div id="lang">
  86. <a href="../../en/news/mahjong-recreation-start.html">EN</a>
  87. <a href="../../ru/news/mahjong-recreation-start.html">RU</a>
  88. </div>
  89. </div>
  90. <center>
  91. <h1>In the news...</h1>
  92. <div class="news_item">
  93. <h2 class="news_item_title">
  94. <a href="mahjong-recreation-start.html">Mahjong recreation start</a>
  95. </h2>
  96. <p class="news_item_date">
  97. 2018-01-26 00:00
  98. </p>
  99. <div class="news_item_contents">
  100. <p><img src="../../images/2018-01-26-mahjong-recreation-start.png" alt="Spherical tiles in a Mahjong layout" /></p>
  101. <p>This article describes the start of Mahjong game recreation.</p>
  102. <p><strong>Plan</strong></p>
  103. <p>We started Mahjong recreation endeavour by composing a brief plan to get gameplay with minimal graphics:</p>
  104. <ul>
  105. <li>Load single layout</li>
  106. <li>Place tiles in layout positions</li>
  107. <li>Distinguish tiles</li>
  108. <li>Implement selection</li>
  109. <li>Implement matching</li>
  110. </ul>
  111. <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>
  112. <p><strong>Problem №1: provide binary resources across supported platforms</strong></p>
  113. <p>Mahjong is going to be available on desktop, mobile, and web. Each of these platforms has its constraints on accessing external files:</p>
  114. <ul>
  115. <li>Desktop can access almost any file</li>
  116. <li>Android/iOS have limited access to file system</li>
  117. <li>Web does not have any file system at all</li>
  118. </ul>
  119. <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>
  120. <p><a href="https://bitbucket.org/ogstudio/mjin-resource">mjin-resource</a>:</p>
  121. <ul>
  122. <li>converts binary files to C header files with the help of <strong>xxd</strong> utility</li>
  123. <li>generates MJIN project that contains generated headers to be compiled into static library</li>
  124. <li>provides C++ interface for accessing generated resources</li>
  125. </ul>
  126. <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>
  127. <p><strong>Problem №2: load PNG images across supported platforms</strong></p>
  128. <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>
  129. <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>
  130. <p><strong>Development</strong></p>
  131. <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>
  132. <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>
  133. <ul>
  134. <li>education: show how development looks like internally</li>
  135. <li>accessibility: provide older versions for comparison</li>
  136. </ul>
  137. <p><strong>Current Mahjong game status</strong></p>
  138. <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>
  139. <p>Once we finish tile matching implementation, we are going to publish the intermediate result for all supported platforms.</p>
  140. <p>That's it for describing the start of Mahjong game recreation.</p>
  141. </div>
  142. </div>
  143. <div id="footer">
  144. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  145. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  146. The site is hosted by <a href="https://pages.github.com">GitHub Pages</a>.
  147. </div>
  148. </center>
  149. </body>
  150. </html>