Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

mahjong-recreation-start.html 7.9KB

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