Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

mahjong-recreation-start.html 6.9KB

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