<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anthuulos</title>
    <description>The latest articles on DEV Community by Anthuulos (@anthuulos).</description>
    <link>https://dev.to/anthuulos</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2203863%2Fe7e4c719-48ed-4442-8adc-fee379199440.png</url>
      <title>DEV Community: Anthuulos</title>
      <link>https://dev.to/anthuulos</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anthuulos"/>
    <language>en</language>
    <item>
      <title>The Big Refactoring - Chapter 1</title>
      <dc:creator>Anthuulos</dc:creator>
      <pubDate>Wed, 30 Oct 2024 16:41:36 +0000</pubDate>
      <link>https://dev.to/anthuulos/the-big-refactoring-chapter-1-54g6</link>
      <guid>https://dev.to/anthuulos/the-big-refactoring-chapter-1-54g6</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;

&lt;p&gt;Welcome back to &lt;em&gt;The Big Refactoring&lt;/em&gt;, where I explain the significant changes we’ve made in &lt;em&gt;Town Alight&lt;/em&gt; since we published its first version. Feel free to ask any questions regarding the development process in the comments! Today, I’m going to talk about one of the biggest reasons that led us to make the choice of refactoring the game: Godot’s tilemap system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 1: Living in a tile world
&lt;/h2&gt;

&lt;p&gt;Tiles… most of you might have an idea of what these little guys are, but for those of you who don’t: a tile is a small rectangle (or hexagon, or other funky shape, but let’s not get ahead of ourselves) which, when placed together with other tiles, creates a tileset. Using tilesets is how worlds are created in many 2D games, and when used wisely, they can make your life easier as a game developer. Guess who didn’t use them wisely initially? That’s right, yours truly.&lt;/p&gt;

&lt;p&gt;And how could I mess up such a basic concept? Well… let me explain. In the original version of &lt;em&gt;Town Alight&lt;/em&gt; that you can play in the browser, almost everything in the game is a tile. The trunk of that tree? A tile. That fire that is threatening our birb’s way of life? A tile. That piece of roof from where our beloved mayor bravely commands his troops? You guessed it, a tile.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1dan4z79p1sf88lieml.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1dan4z79p1sf88lieml.png" alt="Image description" width="800" height="223"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This doesn’t seem that bad, right? Wrong. In Godot, and other game engines, tiles are not their own objects like the villagers or the birb. Instead, they are part of the tileset object, which is in charge of telling each tile where it goes and which layer it belongs to. And, hey, it’s great that it works this way because otherwise tile-based games would be very resource-intensive. However, the stuff you can do with tiles is very limited. Each tile only knows about itself and is completely unaware of its surroundings; it doesn’t even know if it belongs to a house or a tree! This leads to weird scenarios…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F07u566a7v3rfgb2oie3t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F07u566a7v3rfgb2oie3t.png" alt="Image description" width="185" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now… I confess I’m not an expert on burning trees, but this doesn’t look like how a tree would burn in real life. The issue is that, not only does it look weird, but we also didn’t have control of what happened when a tree or a building was scorched, because the game didn’t even know that there was a building there in the first place! For this reason, we decided to change how the tileset interacted with the rest of the game, which, at the moment, was our core mechanic.&lt;/p&gt;

&lt;p&gt;Changing this behavior wasn’t going to be easy, because the fires only wanted to spread throughout the tileset without acknowledging there were other objects in the scene. This meant that the first step was changing the fires from being tiles to being their own separate object, which allowed them to have individual colliders and to check their neighbors. So… here you go, our new, independent fire, with upgraded graphics thanks to Doops!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcmld7zdqxftg00ug6byt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcmld7zdqxftg00ug6byt.gif" alt="Image description" width="314" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we just needed to make our building and nature tiles understand that they were part of a group, and the obvious step was simply to take them out of the tileset and make them their own objects, similar to how the fire became its own object. This allowed us to give each structure its own identity, so no more half-scorched, half-healthy trees for us. Not only that, but this also allowed us to give each structure more complex features, such as defined fire resistance and a value, among other properties. The result (besides many features which I will not discuss yet) was structures that burned in a more natural way, like this guy:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq2w994wsycbow65ocbra.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq2w994wsycbow65ocbra.gif" alt="Image description" width="478" height="554"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a bonus, now that structures aren’t part of the tileset system, we are able to place them wherever we want, without the placement constraints imposed by the tileset system.&lt;/p&gt;

&lt;p&gt;Finally, with these two major changes, we now can improve the interaction between fires and structures. Since fires only knew how to spread throughout their grid and now have more complex behaviors, we can make them detect their neighbors and tell them that these neighbors could come in the form of other fires, bushes, trees, buildings, and more! The structures, on their end, now understand that having an active fire as a neighbor means trouble. In summary, the world is much more interconnected now than it once was, and you’ll be able to experience that yourself in the future.&lt;/p&gt;

&lt;p&gt;There’s so much more I could discuss about the new changes to the tileset system, but I don’t want to overwhelm you with a mega-long entry. For now, we’ve covered the most significant changes. If you have any questions or want me to dive deeper into any of these topics, feel free to let me know—I'll be happy to explore them in future entries!&lt;/p&gt;

&lt;p&gt;That’s all from me for now. Thank you for reading, and I look forward to sharing more exciting updates with you soon. Stay tuned!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;– Anthuulos&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Big Refactoring - Chapter 0</title>
      <dc:creator>Anthuulos</dc:creator>
      <pubDate>Tue, 15 Oct 2024 19:44:43 +0000</pubDate>
      <link>https://dev.to/anthuulos/the-big-refactoring-chapter-0-1le9</link>
      <guid>https://dev.to/anthuulos/the-big-refactoring-chapter-0-1le9</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;

&lt;p&gt;Welcome to this first chapter of my adventures as Town Alight’s main coder. This is the first of many diary entries in which I’ll explain the significant changes we’ve made in Town Alight since we published its &lt;a href="https://anthuulos.itch.io/town-alight" rel="noopener noreferrer"&gt;first version&lt;/a&gt;. After publishing each entry, I’ll answer any questions you have about Town Alight’s development; remember, we’re always open to feedback.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7thf1xeyqx70pawp20xu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7thf1xeyqx70pawp20xu.gif" alt="Image description" width="796" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 0: But why, tho?
&lt;/h2&gt;

&lt;p&gt;The first diary in this series is called “The Big Refactoring.” While we have big plans to expand Town Alight, we encountered many issues with how the Game Jam version of the game was working behind the scenes. We wanted to improve its performance and readability, so this became our first priority before even beginning to implement new features. You may ask: “Why didn’t you develop it well in the first place?!” First of all, how dare you?! Second of all… you’re completely right; but there were a few reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Godot newbies&lt;/strong&gt;&lt;br&gt;
As some of you might know, Town Alight is being developed in Godot. What you might not know is that both Doops (the artist) and I, Anthuulos (the coder), are relatively new to Godot! Before starting the project, Doops had begun his game dev journey a few months ago. For my part, I had developed games in Unity for about 7 years before only starting to learn Godot a month ago. This led to learning concepts on the go while developing the game, using non-optimal techniques to get where we wanted to go.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deadlines&lt;/strong&gt;&lt;br&gt;
Town Alight was developed for PirateSoftware’s 2023 game jam, which required us to create a functional game in just 2 weeks! This forced us to make decisions that resulted in a horribly disorganized game but ultimately made it work. I remember saying to myself, “This is awful code; shame on me,” while coding at 2 AM. But hey… the game did what it had to do for the moment, so I regret nothing!&lt;br&gt;
 &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5m0zv2x8j9is7knhlr2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5m0zv2x8j9is7knhlr2.gif" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Design Experience&lt;/strong&gt;&lt;br&gt;
This is still an issue, at least for me. I confess that I have no sense of aesthetics whatsoever. Many times, I want to show the player all the data I’m using to make the game work, but the reality is that most players don’t care about this; they just want a simple HUD that allows them to make decisions without having to look at a million numbers on the screen. With your help and feedback, I’m sure I’ll be able to overcome this personal obstacle.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, here we are—many months later—looking in horror at my old code and wanting to erase everything and start from scratch. But I won’t! Instead, I’m going to show you what changes were made to the game to optimize many of its processes. In the first chapter, I’m going to discuss something both Doops and I ended up hating: making the whole game based on tiles without room for more complex behaviors.&lt;/p&gt;

&lt;p&gt;I hope you like this series, and I’ll see you soon in the first chapter of The Big Refactoring!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;-Anthuulos&lt;/em&gt;&lt;/p&gt;

</description>
      <category>townalight</category>
      <category>gamedev</category>
      <category>godot</category>
    </item>
  </channel>
</rss>
