選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

168 行
8.0KB

  1. <!DOCTYPE html>
  2. <head>
  3. <meta charset="utf-8" />
  4. <!-- Set the viewport width to device width for mobile -->
  5. <meta name="viewport" content="width=device-width" />
  6. <title>Mahjong recreation start</title>
  7. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/normalize.css" />
  8. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/foundation.min.css" />
  9. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/style.css" />
  10. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/pygments.css" />
  11. <script src="http://opengamestudio.org/theme/js/custom.modernizr.js"></script>
  12. <!-- So Firefox can bookmark->"abo this site" -->
  13. <link href="feeds/all.atom.xml" rel="alternate" title="Opensource Game Studio" type="application/atom+xml">
  14. </head>
  15. <body>
  16. <!-- Nav Bar -->
  17. <nav>
  18. <!-- Show menu items and pages -->
  19. <div class="row">
  20. <div class="large-12 columns top-bar">
  21. <h1><a href="http://opengamestudio.org">Opensource Game Studio</a></h1>
  22. </div>
  23. </div>
  24. <div class="row top-menu">
  25. <div class="large-12 columns">
  26. <a href="/pages/games.html" class="menu-button secondary">Games</a>
  27. <a href="/pages/education.html" class="menu-button secondary">Education</a>
  28. <a href="/pages/about.html" class="menu-button secondary">About</a>
  29. </div>
  30. </div>
  31. </nav>
  32. <!-- End Nav -->
  33. <!-- Main Page Content and Sidebar -->
  34. <div class="row">
  35. <!-- Main Blog Content -->
  36. <div class="large-9 columns">
  37. <article>
  38. <header>
  39. <h3 class="article-title"><a href="http://opengamestudio.org/mahjong-recreation-start.html" rel="bookmark"
  40. title="Permalink to Mahjong recreation start">Mahjong recreation start</a></h3>
  41. </header>
  42. <h6 class="subheader" title="2018-01-26T00:00:00+03:00">Пт 26 января 2018
  43. <a class="button secondary small translation-button" href="http://opengamestudio.org/mahjong-recreation-start-ru.html">ru</a>
  44. </h6> <p><img alt="Screenshot" src="http://opengamestudio.org/2018-01-26-mahjong-recreation-start.png"></p>
  45. <p>This article describes the start of Mahjong game recreation.</p>
  46. <p><strong>Plan</strong></p>
  47. <p>We started Mahjong recreation endeavour by composing a brief plan to get gameplay with minimal graphics:</p>
  48. <ul>
  49. <li>Load single layout</li>
  50. <li>Place tiles in layout positions</li>
  51. <li>Distinguish tiles</li>
  52. <li>Implement selection</li>
  53. <li>Implement matching</li>
  54. </ul>
  55. <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>
  56. <p><strong>Problem №1: provide binary resources across supported platforms</strong></p>
  57. <p>Mahjong is going to be available on desktop, mobile, and web. Each of these platforms has its constraints on accessing external files:</p>
  58. <ul>
  59. <li>Desktop can access almost any file</li>
  60. <li>Android/iOS have limited access to file system</li>
  61. <li>Web does not have any file system at all</li>
  62. </ul>
  63. <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>
  64. <p><a href="https://bitbucket.org/ogstudio/mjin-resource">mjin-resource</a>:</p>
  65. <ul>
  66. <li>converts binary files to C header files with the help of <strong>xxd</strong> utility</li>
  67. <li>generates MJIN project that contains generated headers to be compiled into static library</li>
  68. <li>provides C++ interface for accessing generated resources</li>
  69. </ul>
  70. <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/mahjong">mahjong</a> project.</p>
  71. <p><strong>Problem №2: load PNG images across supported platforms</strong></p>
  72. <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.
  73. 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>
  74. <p><strong>Development</strong></p>
  75. <p><a href="http://opengamestudio.org/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/mahjong">mahjong repository</a>.</p>
  76. <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>
  77. <ul>
  78. <li>education: show how development looks like internally</li>
  79. <li>accessibility: provide older versions for comparison</li>
  80. </ul>
  81. <p><strong>Current Mahjong game status</strong></p>
  82. <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>
  83. <p>Once we finish tile matching implementation, we are going to publish the intermediate result for all supported platforms.</p>
  84. <p>That's it for describing the start of Mahjong game recreation.</p>
  85. <p class="subheader">Category: <a href="http://opengamestudio.org/category/news.html">News</a>
  86. </p>
  87. </article>
  88. </div>
  89. <!-- End Main Content -->
  90. <!-- Sidebar -->
  91. <aside class="large-3 columns">
  92. <!--k
  93. <h5 class="sidebar-title">Site</h5>
  94. <ul class="side-nav">
  95. <li><a href="http://opengamestudio.org/archives.html">Archives</a>
  96. <li><a href="http://opengamestudio.org/tags.html">Tags</a>
  97. <li><a href="http://opengamestudio.org/feeds/all.atom.xml" rel="alternate">Atom feed</a></li>
  98. </ul>
  99. <h5 class="sidebar-title">Categories</h5>
  100. <ul class="side-nav">
  101. <li><a href="http://opengamestudio.org/category/news.html">News</a></li>
  102. </ul>
  103. -->
  104. <h5 class="sidebar-title">Ads</h5>
  105. <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  106. <!-- ogs2 -->
  107. <ins class="adsbygoogle"
  108. style="display:block"
  109. data-ad-client="ca-pub-4473792248813084"
  110. data-ad-slot="9024247127"
  111. data-ad-format="auto"></ins>
  112. <script>
  113. (adsbygoogle = window.adsbygoogle || []).push({});
  114. </script>
  115. </aside> <!-- End Sidebar -->
  116. </div> <!-- End Main Content and Sidebar -->
  117. <!-- Footer -->
  118. <footer class="row">
  119. <div class="large-12 columns">
  120. <hr />
  121. <div class="row">
  122. <div class="large-7 columns">
  123. <p>Proudly powered by <a href="http://getpelican.com">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.</p>
  124. </div>
  125. </div>
  126. </div>
  127. <script type="text/javascript">
  128. var _gaq = _gaq || [];
  129. _gaq.push(['_setAccount', 'UA-3773114-1']);
  130. _gaq.push(['_trackPageview']);
  131. (function() {
  132. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  133. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  134. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  135. })();
  136. </script>
  137. </footer>