You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

228 lines
13KB

  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>Opensource Game Studio</title>
  7. <link rel="stylesheet" href="https://ogstudio.github.io/theme/css/normalize.css" />
  8. <link rel="stylesheet" href="https://ogstudio.github.io/theme/css/foundation.min.css" />
  9. <link rel="stylesheet" href="https://ogstudio.github.io/theme/css/style.css" />
  10. <link rel="stylesheet" href="https://ogstudio.github.io/theme/css/pygments.css" />
  11. <script src="https://ogstudio.github.io/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="https://ogstudio.github.io">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. <a href="https://ogstudio.github.io/scripting-research.html"><h3 class="article-title">Scripting research</h3></a>
  38. <h6 class="subheader" title="2017-08-16T00:00:00+07:00">Ср 16 Август 2017
  39. <a class="button secondary small translation-button" href="https://ogstudio.github.io/scripting-research-ru.html">ru</a>
  40. </h6><p><img alt="Scripting research" src="https://ogstudio.github.io/2017-08-scripting-research.png" /></p>
  41. <p>This article describes scripting research in July 2017.</p>
  42. <p><strong>Our first goal of using a scripting language was to have a platform-independent code that runs unchanged on every supported platform.</strong></p>
  43. <p>OGS Editor 0.10 supports Python for such a code thanks to <a href="http://swig.org/">SWIG</a>. SWIG provides a way to wrap almost any C/C++ code and use it in dozens of languages like Python, Ruby, Lua, Java, C#, etc.. SWIG really helped us taste the beauty of platform-independent code. However, SWIG only works one way: from C/C++ to a target language. This means the main application must be in the target language, and C/C++ code can only be used as a library.</p>
  44. <p>Having the main application in Python works fine for the desktop, but not so great for mobile and web, where C and C++ are the only natively supported cross-platform languages. There are projects like <a href="https://kivy.org">Kivy</a>, which allow you to develop cross-platform applications in Python, but they are not supported natively. This means it's a lot of headaches when Android and iOS APIs change.</p>
  45. <p>Having the main application in C/C++ and the need to support scripting means that a scripting language should be interpreted by the application. This is what SWIG, Kivy, and similar projects are not meant to fulfill.</p>
  46. <p><strong>Our secondary goal for using a scripting language was to allow to extend C++ code.</strong></p>
  47. <p>OGS Editor 0.10 has some modules written in C++, and some in Python. The modules are equal from the perspective of the main application; it doesn't care what language the module is written in.</p>
  48. <p>To achieve such flexibility, we introduced a so-called Environment. Each module would register the keys it responds to, and Environment would deliver corresponding messages.
  49. Technically such behaviour is achieved by inheriting a base class and overriding its methods in both C++ and a scripting language.</p>
  50. <p><strong>First, we evaluated Python for the role of cross-platform scripting language.</strong></p>
  51. <p>Since we already used Python, we started to research the possibility to run Python code on every supported platform. The result was disappointing because CPython (the default Python implementation used on the desktop) does not mention mobile and web platforms. We only found some years old forks of CPython that were claimed to work either on Android or iOS. Such a disarray was not suitable for us.
  52. We also had a look at <a href="http://pypy.org">PyPy</a>, another Python implementation. It also did not mention support for mobile and web platforms.</p>
  53. <p>This was a clear indication that Python community doesn't care for mobile and web platforms. Or that nobody had time to provide the information about building Python on such platforms. Either way, it was not acceptable for us.</p>
  54. <p><strong>Second, we evaluated <a href="http://wren.io">Wren</a> for the role of cross-platform scripting language.</strong></p>
  55. <p>Wren was the first scripting language we stumbled upon in the long list of non-mainstream scripting languages.</p>
  56. <p>Wren claimed to be small and easy to learn. Wren also claimed to be intended for embedding in applications. Ironically, the author <a href="http://wren.io/embedding-api.html">had no time to document how to do the embedding in the first place</a>. When <a href="https://github.com/munificent/wren/issues/465">we asked for the time estimates of publishing</a> the critical part of the documentation, <a href="https://github.com/munificent/wren/issues/402">we just got a reference to another issue</a> where the other guy was asking the same question half a year ago!</p>
  57. <p>That's when we ended our relationship with Wren.</p>
  58. <p><strong>Third, we evaluated <a href="http://chaiscript.com">Chai</a> for the role of cross-platform scripting language.</strong></p>
  59. <p>Chai was in the long list of non-mainstream scripting languages, too. Chai was promising because it claimed to be specifically tailored for embedding in a C++ application.
  60. We successfully managed to call a C++ function from inside Chai but failed to call a member function. <a href="http://discourse.chaiscript.com/t/cannot-call-a-function-that-accepts-a-string-and-a-vector/334">We asked for help</a>, but nobody replied.</p>
  61. <p>We had to end our relationship with Chai.</p>
  62. <p><strong>Fourth, we evaluated Lua for the role of cross-platform scripting language.</strong></p>
  63. <p>Lua is the mainstream language for embedding. So we decided to try the obvious choice. Documentation looked promising, too. However, by the end of reading the <a href="https://www.lua.org/pil/24.html">C API</a> chapter we had no clue how to inherit a class inside Lua.</p>
  64. <p>This led us to search for libraries that wrap Lua C API syntax into something more meaningful for C++. That's how we found <a href="http://sol2.rtfd.io">Sol2</a>. Just as before, the first attempt to call a C++ member function from Lua failed. But unlike before, we asked for help and <a href="https://github.com/ThePhD/sol2/issues/465">got the help</a>! This was a refreshing surprise for us.
  65. Next, we tried to inherit a class in Lua and override the class methods. We failed, but <a href="https://github.com/ThePhD/sol2/issues/468">the author helped us out again</a>. In the end, we succeeded in inheriting a class and overriding its behaviour.</p>
  66. <p>That's when we understood it's a start for a long and mutual relationship with Sol2/Lua.</p>
  67. <p><strong>This search for a scripting language taught us one important lesson: people matter, not technologies.</strong></p>
  68. <p>There are lots of scripting languages that look shiny on the outside but are dead. Why? Because some authors don't have time for users. In return, users don't have time for the authors' projects.</p>
  69. <p>That's it for describing scripting research in July 2017.</p><p class="subheader">Category: <a href="https://ogstudio.github.io/category/news.html">News</a>
  70. </p>
  71. </article>
  72. <hr class="gradient"/>
  73. <article>
  74. <a href="https://ogstudio.github.io/openscenegraph-cross-platform-guide.html"><h3 class="article-title">OpenSceneGraph cross-platform guide</h3></a>
  75. <h6 class="subheader" title="2017-07-17T00:00:00+07:00">Пн 17 Июль 2017
  76. <a class="button secondary small translation-button" href="https://ogstudio.github.io/openscenegraph-cross-platform-guide-ru.html">ru</a>
  77. </h6><p><img alt="OpenSceneGraph guide" src="https://ogstudio.github.io/2017-07-openscenegraph-guide.png" /></p>
  78. <p>This article summarizes the work we did to produce OpenSceneGraph cross-platform guide.</p>
  79. <p>June marked the finish of <a href="https://github.com/OGStudio/openscenegraph-cross-platform-guide">OpenSceneGraph cross-platform guide</a> with the publishing of the last (initially planned) tutorial. The tutorial describes <a href="https://github.com/OGStudio/openscenegraph-cross-platform-guide/tree/master/1.10.SampleWeb">how to build and run sample OpenSceneGraph application in Web</a> using Emscripten.
  80. In case you missed it, here ...</p><p class="subheader">Category: <a href="https://ogstudio.github.io/category/news.html">News</a>
  81. </p>
  82. <a class="button radius secondary small right" href="https://ogstudio.github.io/openscenegraph-cross-platform-guide.html">Read More</a>
  83. <hr class="gradient"/>
  84. </article>
  85. <article>
  86. <a href="https://ogstudio.github.io/ios-tutorial.html"><h3 class="article-title">iOS tutorial</h3></a>
  87. <h6 class="subheader" title="2017-06-08T10:00:00+07:00">Чт 08 Июнь 2017
  88. <a class="button secondary small translation-button" href="https://ogstudio.github.io/ios-tutorial-ru.html">ru</a>
  89. </h6><p><img alt="iOS tutorial" src="https://ogstudio.github.io/2017-06-08-ios-refactoring.png" /></p>
  90. <p>This article describes problems we faced during the creation of iOS tutorial in May 2017.</p>
  91. <p><a href="https://twitter.com/OpenGameStudio/status/826816343433498627">This February</a> we managed to get simple model rendered under iOS in just a few days. We expected to finish iOS tutorial in no time. However, the reality reminded us: it's easy to come ...</p><p class="subheader">Category: <a href="https://ogstudio.github.io/category/news.html">News</a>
  92. </p>
  93. <a class="button radius secondary small right" href="https://ogstudio.github.io/ios-tutorial.html">Read More</a>
  94. <hr class="gradient"/>
  95. </article>
  96. <article>
  97. <a href="https://ogstudio.github.io/pelican-review.html"><h3 class="article-title">Pelican review</h3></a>
  98. <h6 class="subheader" title="2017-06-03T22:00:00+07:00">Сб 03 Июнь 2017
  99. <a class="button secondary small translation-button" href="https://ogstudio.github.io/pelican-review-ru.html">ru</a>
  100. </h6><p>So far so nice. Pelican is really cool, and provides a quick starting guided
  101. to get up and running real fast.</p>
  102. <p>Much more smooth than Jekyll.</p>
  103. <p>I &lt;3 Python and its ecosystem. Something is just EASIER in Python.</p><p class="subheader">Category: <a href="https://ogstudio.github.io/category/review.html">Review</a>
  104. </p>
  105. <a class="button radius secondary small right" href="https://ogstudio.github.io/pelican-review.html">Read More</a>
  106. <hr class="gradient"/>
  107. </article>
  108. <article>
  109. <a href="https://ogstudio.github.io/keyboard-review.html"><h3 class="article-title">My first review</h3></a>
  110. <h6 class="subheader" title="2017-06-01T10:20:00+07:00">Чт 01 Июнь 2017
  111. <a class="button secondary small translation-button" href="https://ogstudio.github.io/keyboard-review-ru.html">ru</a>
  112. </h6><p>Here is a full review, guys.</p><p class="subheader">Category: <a href="https://ogstudio.github.io/category/review.html">Review</a>
  113. </p>
  114. <a class="button radius secondary small right" href="https://ogstudio.github.io/keyboard-review.html">Read More</a>
  115. <hr class="gradient"/>
  116. </article>
  117. <!-- /#posts-list -->
  118. <div class="pagination-centered">
  119. <h6 class="subheader">Page 1 of 1</h6>
  120. <p>
  121. </p>
  122. </div>
  123. </div>
  124. <!-- End Main Content -->
  125. <!-- Sidebar -->
  126. <aside class="large-3 columns">
  127. <!--k
  128. <h5 class="sidebar-title">Site</h5>
  129. <ul class="side-nav">
  130. <li><a href="https://ogstudio.github.io/archives.html">Archives</a>
  131. <li><a href="https://ogstudio.github.io/tags.html">Tags</a>
  132. <li><a href="https://ogstudio.github.io/feeds/all.atom.xml" rel="alternate">Atom feed</a></li>
  133. </ul>
  134. <h5 class="sidebar-title">Categories</h5>
  135. <ul class="side-nav">
  136. <li><a href="https://ogstudio.github.io/category/news.html">News</a></li>
  137. <li><a href="https://ogstudio.github.io/category/review.html">Review</a></li>
  138. </ul>
  139. -->
  140. <h5 class="sidebar-title">Projects</h5>
  141. <ul class="side-nav">
  142. <li><a href="/pages/ogs-mahjong.html">OGS Mahjong</a></li>
  143. <li><a href="/pages/ogs-editor.html">OGS Editor</a></li>
  144. <li><a href="/pages/openscenegraph-guide.html">OpenSceneGraph guide</a></li>
  145. </ul>
  146. </aside> <!-- End Sidebar -->
  147. </div> <!-- End Main Content and Sidebar -->
  148. <!-- Footer -->
  149. <footer class="row">
  150. <div class="large-12 columns">
  151. <hr />
  152. <div class="row">
  153. <div class="large-7 columns">
  154. <p>Proudly powered by <a href="http://getpelican.com">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.</p>
  155. </div>
  156. </div>
  157. </div>
  158. </footer>