Design and logic for user-facing site https://exmods.org
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
11KB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta name="theme-color" content="#20c420" />
  5. <meta name="author" content="Exmods community" />
  6. <meta name="keywords" content="exmods,gamecraft,modding,mod" />
  7. <meta name="og:type" content="website" />
  8. <meta name="og:title" content="Exmods" />
  9. <meta name="og:description" content="Gamecraft modding website" />
  10. <meta name="description" content="Gamecraft modding website" />
  11. <meta name="og:image" content="../static/favicon.png" />
  12. <meta name="og:url" content="https://www.exmods.org" />
  13. <meta charset="UTF-8" />
  14. <link rel="icon" href="../static/favicon.png" type="image/x-icon"/>
  15. <link rel="shortcut icon" href="../static/favicon.png" type="image/x-icon"/>
  16. <link rel="stylesheet" href="../static/style.css" type="text/css" />
  17. <title>Exmods | Magic of Pixi</title>
  18. </head>
  19. <body>
  20. <h3><a href="index.html" title="You know your browser has a back button, right?">Back to list</a></h3>
  21. <h1>The Magic of Pixi</h1>
  22. <div class="text-content">
  23. <p>
  24. <span class="tab"></span>
  25. I'm sure you've heard of <a href="https://pixi.exmods.org">Pixi</a>.
  26. If you haven't, let me refresh your memory:
  27. Pixi is a mod for Gamecraft which adds commands to import images and Robocraft bots into games.
  28. These tools simplify text block animations and pixel art, among other things (like making giant 2D mechanical structures).
  29. Under the hood, Pixi is like any other mod except for one important design decision.
  30. And that design decision was the best idea I've had in a while.
  31. </p>
  32. <p>
  33. <span class="tab"></span>
  34. Before I get to that, though, I want to provide a more in-depth look at the process behind developing a new mod for Gamecraft.
  35. This is also the same bootstrapping process that I used for Pixi, because I wanted to test it out but also because it's the easiest way to do it.
  36. A while ago, I created a barebones Gamecraft mod called
  37. <a href="https://git.exmods.org/modtainers/HelloModdingWorld">HelloModdingWorld</a> to use in the
  38. <a href="https://exmods.org/guides/first.html">mod dev guide</a>.
  39. HelloModdingWorld is a completely self-contained mod, with all the mod development project setup and configuration already done.
  40. The setup and config are updated after every Gamecraft update to keep it working smoothly.
  41. That makes it the ideal starting point for developing a new mod, unless you really want to start from scratch.
  42. The rest of the process is just changing the HelloModdingWorld-specific configuration to your own mod.
  43. That shouldn't take more than a few minutes, since it's just creating a new Gitea repo (from the HelloModdingWorld template), cloning it to your local storage, and then a couple of find and replace operations to change the project to the new mod's name.
  44. So, to start a new Gamecraft mod, all I have to do is login to <a href="https://git.exmods.org">git.exmods.org</a>, create a new repo using the HelloModdingWorld template's git content and then replace all mentions of "HelloModdingWorld" in the code.
  45. </p>
  46. <p>
  47. <span class="tab"></span>
  48. A short public service announcement about Git and Gitea before I continue:
  49. If you're a new programmer (or not one at all), you may not recognise those terms (or terms like cloning and check out in that context), but that's OK.
  50. Git is code versioning software which helps track changes and simplify simultaneous development efforts from multiple people.
  51. It's very powerful (it was originally created for developing Linux, and now it's used by almost every modern software project).
  52. The public service announcement is this: learn Git if you want to program.
  53. It makes it easy to store and retrieve your code from anywhere (through GitHub/GitLab/Gitea) and has lots of goodies that you'll never want to live without (reverting to an old version of your program is surprisingly useful).
  54. Most IDEs provide a nice user interface for you, so it only takes a few minutes to wrap your head around.
  55. I haven't worked on software without Git in years.
  56. </p>
  57. <p>
  58. <span class="tab"></span>
  59. This reduced barrier ultimately led me to create Pixi in the first place, to prove image importing was possible.
  60. Though, most of the credit for the idea behind Pixi goes to a short conversation with [REDACTED]<span style="display:none;">the answer isn't hidden in the source code either</span>.
  61. Once the idea for Pixi, along with the mod setup, was in place, all that was left to do was the building the mod.
  62. In most cases, that starts with a lot of time figuring out how to do what I want the mod to do by reading decompiled Gamecraft code.
  63. After I've found the code that I want to modify, I write code to modify the Gamecraft code.
  64. The code I'd write for the mod and the code that I'd look for in Gamecraft are always specific to what I want to do.
  65. But for Pixi, I wrote code for the <a href="https://git.exmods.org/modtainers/GamecraftModdingAPI">GamecraftModdingAPI</a> to modify the behaviour of Gamecraft,
  66. and then wrote a bit of code for Pixi which controlled everything.
  67. Specifically for Pixi, I wrote code to control image to block conversion operations.
  68. Block placement was already supported by the API, thanks to earlier work by NorbiPeti, so I could skip most of the reading.
  69. </p>
  70. <p>
  71. <span class="tab"></span>
  72. The brilliant decision I made after that initial experience was to never directly modify Gamecraft from Pixi.
  73. At face value, it may seem counter-productive for a Gamecraft mod to not mod Gamecraft, but it actually leads to a more stable mod.
  74. I'll describe the common difficulties for mods to illustrate.
  75. Mods are usually broken by Gamecraft updates.
  76. This is caused by the lack of a guarantee that anything from the last update is the same as in this update.
  77. In most cases, very little changes but even a single change can completely break a mod.
  78. To solve this, Pixi relies on the consistent interface that GamecraftModdingAPI provides between all Gamecraft versions.
  79. Mods often re-implement common features, which may interfere with each other.
  80. When every mod has to start from scratch, redundancy is expected and can sometimes cause issues when one mod doesn't do the same thing in exactly the same way.
  81. Pixi solves this for itself and other mods by using the GamecraftModdingAPI's common implementation.
  82. By implementing Gamecraft-modifying parts in the API, I can write code that can benefit all modders instead of just myself.
  83. I can also rely on other to update keep that code working with Gamecraft updates.
  84. Maybe I should have made this post about GamecraftModdingAPI, since I'm talking about it an awful lot.
  85. As if to prove my point, Gamecraft's 2020.06.11.18.50 update didn't require me to update Pixi since the changes were addressed in an update to GamecraftModdingAPI.
  86. Never directly modifying Gamecraft has saved me from directly modifying Pixi when updates occur.
  87. </p>
  88. <p>
  89. <span class="tab"></span>
  90. The flip-side of that decision can be seen in <a href="https://git.exmods.org/ExtraCommands/ExtraCommands">ExtraCommands</a>, which started way before GamecraftModdingAPI became what it is now.
  91. To this day, I still completely hate updating that mod.
  92. Recent updates have forced me to move over to using GamecraftModdingAPI to fix broken things permanently, but a lot of ExtraCommands could still break with any update.
  93. And at least one thing breaks every Gamecraft update, which forces me to spend time fixing the issue and then more time to make a new ExtraCommands release (a whole two minutes of hell).
  94. Perhaps knowing that I could avoid it is what annoys me the most.
  95. </p>
  96. <p>
  97. <span class="tab"></span>
  98. Recently, I've been working on applying the same design decision to the <a href="https://git.exmods.org/NGnius/GamecraftRichPresenceMod">Gamecraft Discord Presence mod</a> (no public release version yet).
  99. Although progress has been slow, that's partly due to my lack of motivation at the moment and my crazy side quest to create a Gamecraft mod test system
  100. (which was a lot of fun work, but hasn't beared any fruit yet).
  101. The work to implement all relevant Gamecraft interactions in the API has led to some interesting new functionality, like Game and Application information and operations.
  102. All of that work benefits everyone, which is the big win.
  103. Mod development, and software development in general, is fundamentally about making something for others as well -- not just yourself.
  104. Once the API is up to snuff, I expect the actual work to upgrade the Discord Presence mod will be short and sweet.
  105. As a side-effect, I expect it to simplify the code, if my experience from doing similar work with ExtraCommands means anything.
  106. </p>
  107. <p>
  108. <span class="tab"></span>
  109. Pixi has proven to be a learning experience for me, on top of the whole Exmods project (which was started as a learning experience).
  110. Developing Pixi has taught me what mods people want (game-maker tools, among other things) and what people are interested in (showy automation piques interests) while teaching me how to write better mods.
  111. Currently, I think that the mod development process is about as optimised as it can get, with the hardest part of the process being using git and opening the find and replace window of your preferred editor.
  112. Using GamecraftModdingAPI also makes the process easy, and it's only getting easier, to create a stable mod which can survive through most Gamecraft updates.
  113. With work I've put into Pixi so far, there's no doubt in my mind that having a standard API for Gamecraft mods is the way forwards.
  114. I wonder if we'll ever see an official modding API from the Gamecraft developers.
  115. Maybe it'll come with official mod support, but I'm sure that's a long way away.
  116. For now, I'm going to continue learning from Pixi and any other mods I end up working on.
  117. </p>
  118. </div>
  119. <footer>
  120. exmods.org|<a href="https://git.exmods.org/ExMods/html-site">Site Repository</a>|<a href="https://exmods.org">Home</a>|<a href="https://discord.gg/2CtWzZT">Discord</a>|<a href="https://twitter.com/GamecraftMods">Twitter</a>
  121. </footer>
  122. </body>
  123. </html>