<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by ProgDozer on Medium]]></title>
        <description><![CDATA[Stories by ProgDozer on Medium]]></description>
        <link>https://medium.com/@progdozer?source=rss-59128bb09625------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Z7VzlKcPJ4Qif_M3zsOeLA.jpeg</url>
            <title>Stories by ProgDozer on Medium</title>
            <link>https://medium.com/@progdozer?source=rss-59128bb09625------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 01:39:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@progdozer/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A:\dventure Dev Log: Utilizing a Global Event Bus in Godot]]></title>
            <link>https://medium.com/@progdozer/a-dventure-dev-log-utilizing-a-global-event-bus-in-godot-acf34f5d11d1?source=rss-59128bb09625------2</link>
            <guid isPermaLink="false">https://medium.com/p/acf34f5d11d1</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[godot]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[ProgDozer]]></dc:creator>
            <pubDate>Sat, 27 Apr 2019 15:54:14 GMT</pubDate>
            <atom:updated>2019-04-27T15:54:14.125Z</atom:updated>
            <content:encoded><![CDATA[<h3><a href="https://medium.com/@progdozer/92919fe11a9?source=your_stories_page---------------------------">A:\dventure Dev Log:</a> Utilizing a Global Event Bus</h3><p>Out of the box, Godot has a very powerful and useful signaling system. As a developer used to doing event driven/message oriented programming, it felt like it fit the gap between what I wanted to do and what Unity was offering me. It’s straightforward, and you can visualize your relationships easily with the inspector. However, as your scene tree becomes more dynamic, it can be painful managing signals procedurally and your code becomes fragile as you start to rely on node paths or specific groups that you query.</p><p>To combat this problem for largely dynamic parts of A:\dventure, I’ve borrowed what I learned from working with state management libraries <a href="https://redux.js.org/">Redux</a> and <a href="https://vuex.vuejs.org/">Vuex</a>, as well as with distributed event queues and pubsub functionality provided by <a href="https://www.rabbitmq.com/">RabbitMQ</a> and <a href="https://redis.io/topics/pubsub">Redis</a>. The key aspect of working with all those systems is performing actions using events and message payloads, typically with a global manager, to decouple the source of emission from the consumer. Doing this in Godot was incredibly intuitive thanks to the existence of the Node lifecycle hooks already present, as well as its easy management and creation of Singletons that exist within the Scene Tree.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94ff39dee53d2f84d69a2ae1a33a1b3d/href">https://medium.com/media/94ff39dee53d2f84d69a2ae1a33a1b3d/href</a></iframe><p>Let’s look over this briefly to easily understand the structure of how I went about building an Event Bus.</p><p>To start off with, when the Singleton is registered into the game, it listens to signals on the scene tree. This allows it to be immediately aware of whenever a node enters or leaves the tree so it can properly add it to the Consumer Registry that we manage. We only expect Nodes with the group of “consumer” to be capable of handling events, but anything can publish through the Event Bus. We use groups instead of GDScript inheritance because it allows for more flexibility, any node can be a consumer this way.</p><p>Publishing messages operates in a simple iterative manner. Given a message name and a payload, we iterate over all consumers who have registered themselves as listening to the event with that topic. Consumers identify what they can process by having an _events method that returns an array of strings. When a consumer is registered as being capable of handling an event we call its _on_event function and pass the publish parameters down. We only fan out messages based on topic subscription.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*dkGYeq1o2OFtojzOY1Nx1w.png" /><figcaption>With an event bus, nodes are no longer directly coupled between emitter and consumer</figcaption></figure><p>This system immediately started to show its value once I had various game state that persisted across scenes but had elements in each scene that could affect the state. Having each scene and object query the scene tree for a group to get the state object, or even having it as a singleton, then registering itself using signals was just a chore. Everything became coupled in the code and suddenly I had 50 nodes that would be tied to emitting messages to over 100 through explicit relations. The code became aware that there were certain nodes of a group or class that exhibited specific behavior and traits, and if that they were to change then it could impact the relation.</p><p>What an event bus allows us to do is instead the 50 emission nodes now simply throw messages into the void and expect something somewhere might make use of it without caring who it is. Adding new consumers and new functionality based on the same message payload and type requires minimal setup, and adding new emitters that can create the same message and payload is equally simple. Neither require boilerplate code to perform connecting the two, as the event bus abstracts it away.</p><p>Here’s an example of a consumer class in A:\dventure that also emits messages to demonstrate usage.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d06726fb907240f714dc0aacc17aa6c/href">https://medium.com/media/2d06726fb907240f714dc0aacc17aa6c/href</a></iframe><p>For reference to the purpose of these event topics, the combat.killed message is used both for tracking quest progress as well as for actors to detected when they should remove themselves from the scene. Whereas combat.damage is used for both displaying damage points and hit animations, as well as keeping a total count of how much damage you’ve dealt in your playthrough. Nodes that listen to these events can exist anywhere in the tree, and I don’t have to worry about querying for the emission source. This decoupling of nodes from explicit signals present on classes I find has made my code both cleaner and easier to scale in terms of writing.</p><p>There’s clearly drawbacks to this implementation of an Event Bus. It is a sub-optimal solution in situations where it could be easier to connect nodes explicitly with signals through the editor. Its topics are not enforced as a compile time/interpreted level like normal signal names in GDScript, making it impossible to be warned ahead of time of spelling errors. Payloads also lack schema enforcement for message types, making it possible to accidentally write messages that break consumers expecting a specific payload format. In the version that I’ve written, it might feel less intuitive to explicitly type match in _on_event (kind of like you do in Redux) than to explicitly map methods to signals. And worst of all, due to checking every single node as it enters the tree with the SceneTree hooks, there might be an impact on games that spawn and destroy a lot of nodes frequently.</p><p>Yet even with those drawbacks, the improvements to writing event oriented code has made this a welcome approach for developing a game of mid-sized complexity in Godot. As a complement to what Godot can already do with signals, having a global event bus has not only allowed me to simplify and decouple my code, it’s also allowed me to iterate faster on features. There’s other ways these problems can be solved, and it’s possible my own problems could have stemmed purely not understanding and approaching a solution the Godot way. However, overall I’m glad to have pursued implementing a Global Event Bus which I utilize heavily throughout A:\dventure, and it’s an approach I would have most likely taken regardless of game engine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acf34f5d11d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A:\dventure Dev Log: Revisting Scene Transitioning]]></title>
            <link>https://medium.com/@progdozer/a-dventure-dev-log-revisting-scene-transitioning-d6eacad9ec8?source=rss-59128bb09625------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6eacad9ec8</guid>
            <category><![CDATA[godot]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[ProgDozer]]></dc:creator>
            <pubDate>Sun, 30 Dec 2018 17:48:39 GMT</pubDate>
            <atom:updated>2018-12-30T17:48:39.819Z</atom:updated>
            <content:encoded><![CDATA[<p>Last time I wrote anything for this Dev Log it was about <a href="https://medium.com/@progdozer/a-dventure-dev-log-improving-scene-transitioning-dfee7c46804b">Scene Transitioning</a> as well. You would think by now I’d have plenty more to talk about considering how many other things I’ve built up in my game. Well shortly after writing that log I actually went back and rewrote the SceneManager because I wasn’t satisfied with it. I think this is probably the more valuable thing to talk about right now because the changes in approach I’ve done since the previous log entry are incredibly helpful and powerful while simplifying the code too!</p><p>One of the things that bothered me about the other approach was the fact that I had a boolean flag and required other scenes to explicitly flip the is_ready state on the SceneManager in the case of showing a loading screen. This is incredibly dangerous because there’s no protection on the variable. Since then there’s two big things that I became comfortable with that really helped with the improvement of the code: Coroutines and Introspection</p><p><a href="https://gist.github.com/nhydock/6d144fc1a92a41ef373f381ae2f03b60">Coroutines in Godot</a> are basic but powerful. I was already using coroutines before in my dungeon generation, but I would just yield to pause processing to help distribute work on a single thread. In Godot anything that can fire a signal can be yielded. In the case of the transition that helps streamline the code significantly. We can yield to make sure the transition animation finishes first before we start loading, and the makes the code a lot cleaner than connecting and disconnecting signals listeners.</p><p>Introspection in Godot is also key to the new SceneManager. I’m used to Components in web frameworks like React and Vue, which have lifecycle methods on them. Nodes in Godot are pretty barebones, and don’t have any lifecycle methods out of the box for when they are destroyed or for after ready processing. However, you do have the basic ability where you can check to see if they have methods or properties through <a href="https://docs.godotengine.org/en/3.0/classes/class_object.html?highlight=has_method">simple introspection methods</a>. This means I can add specific methods to the nodes that I use as Scenes and give them my custom lifecycle methods that I look for. Now the complete flow of a Node used for scenes looks something like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*RtDwTfzHGFR_Azgyfq-4JA.png" /></figure><p>Normally, nodes already have various signals for Ready and Tree state changes that you can connect to in your Node’s script as a way to do post processing. In fact, in the documentation it even states that as the way for doing things like destructors. However, this approach has a flaw: if those methods are coroutines there’s nothing that waits for them. With the new _setup and _teardown methods, we can explicitly check to see if we need to yield on them and do so.</p><p>The SceneManager can now take params for the next scene’s _setup method too, and we no longer need the hold state thanks to coroutines. This allows our SceneManager to have no state aside from local execution, and the Scenes themselves are fully aware of their async needs. Overall we now have a more encapsulated and safe process.</p><p>Of course for this to work it all comes with the assumption that you’re respecting the SceneTree’s paused state. The biggest problem is _setup is called after a Node is mounted and ready to process, but we treat it as if it happens before. We think of it that way because the tree is paused. However, if your Scene has nodes that do not respect paused and continue processing, it’s possible for them to break during loading. It’s recommended that you initialize these Nodes during the Scene’s _setup, or decouple their dependency on the tree state so they don’t break things.</p><p>Compared to our <a href="https://gist.github.com/nhydock/6d144fc1a92a41ef373f381ae2f03b60">previous implementation</a>, it’s now more powerful, streamlined, and safer, having been reduced to a single function attached to our SceneManager singleton.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/162d4ef2d32ebaa6ed5165a6f8b77314/href">https://medium.com/media/162d4ef2d32ebaa6ed5165a6f8b77314/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6eacad9ec8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A:\dventure Dev Log: Improving Scene Transitioning]]></title>
            <link>https://medium.com/@progdozer/a-dventure-dev-log-improving-scene-transitioning-dfee7c46804b?source=rss-59128bb09625------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfee7c46804b</guid>
            <category><![CDATA[godot]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[rpgmaker]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[graphics]]></category>
            <dc:creator><![CDATA[ProgDozer]]></dc:creator>
            <pubDate>Thu, 27 Sep 2018 02:22:00 GMT</pubDate>
            <atom:updated>2018-10-01T20:36:52.313Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the first things that any game developer will run into once their game’s complexity reaches a large enough size is Scene Management. Being able to logically compartmentalize aspects of your game into discrete scenes that are presented to the user in a stateful manner is pretty key to not just game development but application development as well. Godot does a great job at making it easy to change your root scene thanks to <a href="http://docs.godotengine.org/en/3.0/getting_started/step_by_step/scene_tree.html?highlight=change_scene#changing-current-scene">utility functions on its tree</a>. However, even in Godot’s own docs it states that the default implementation has some drawbacks and you’ll want to make it fancier by doing background loading, add some progress bars, and do other things. In fact, right in the tutorial their first example of <a href="http://docs.godotengine.org/en/3.0/getting_started/step_by_step/singletons_autoload.html">how to use Singletons</a> is a how-to make your own scene manager.</p><p>So if all of this is basic information available in the tutorial, then why write about it? Well, from a graphical implementation, there’s some details that the tutorial doesn’t really touch on, plus there’s some neat things I did with my simple animation that I feel is a good starting place for others. So, I’m gonna show you how I did it in A:\dventure, some tricks I added, and even give you the code so you can drop it into your games!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*vyWYCtydZ0npLQdhliPZJw.png" /></figure><p>First things first, since this scene manager is going to have some cool graphical effects, we need to make it so it can actually render on top of everything. Since the change_scene function on the SceneTree class will replace the last node in the root, that means any autoloaded elements will render before and under everything by default. To fix this, the scene manager I use is actually a CanvasLayer that renders at a higher level than all other elements on the screen. This makes it so the fader will always render on top, as will its children.</p><p>I initially took a brute force approach, using my scene manager to add and remove the transition node to the scene tree before unloading and after loading a scene. This singleton approach significantly less complicated and probably obvious to someone who knows their way around Godot better than I did at the time. Also notice that the Pause Mode is set to Process, which is due to our script using the standard SceneTree.paused property to freeze our game. This will allow the loading animations to animate while pausing everything else (assuming all your interactables respect the paused property as well).</p><p>Even though the scene manager I made doesn’t do async loading, I did add a simple flag that can be toggled if your new scene has plenty of processing to do at the beginning. Before transitioning to my dungeons, since they start off with some time consuming procedural generation, I pass a hold value to the new change_scene method. This informs the scene manager that it should not automatically fade back in when the new scene loads. After the dungeon is generated, I just need to tell the scene manager that things are ready and then it’ll perform the normal fade back procedure.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8fc98cf1682e23f36b1e464b7006c60/href">https://medium.com/media/f8fc98cf1682e23f36b1e464b7006c60/href</a></iframe><p>In addition to the actual scene management aspect, the transitioning needs to be something nice to look at. Something like those classic PowerPoint transitions. RPG Maker had a nice way of doing this by using greyscale images that it’d roll through to fade the screen in and out. You could even provide your own images to make custom transition effects. I had a bunch laying around from my formative years, plus they’re still plentiful online if you know where to look. Any greyscale image will work; you could even use that black and white photo of some train tracks you took when you were going through your “photography phase.”</p><p>To get that feature working, I added a small shader material onto the “Fader” image node. It’s not that complex, really, and uses the image node’s own resource. This makes it easy to change from GDScript and as well as preview the fader directly in the editor immediately.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb40395b620a9ef361c5ad6c76565e27/href">https://medium.com/media/eb40395b620a9ef361c5ad6c76565e27/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstreamable.com%2Fo%2Fj144i&amp;url=https%3A%2F%2Fstreamable.com%2Fj144i&amp;image=https%3A%2F%2Fcdn-b-east.streamable.com%2Fimage%2Fj144i.jpg%3Ftoken%3DLDLcWPG3z1uO9Iw4kBXypQ%26expires%3D1538020342&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=streamable" width="1279" height="706" frameborder="0" scrolling="no"><a href="https://medium.com/media/205a23f160a0a4b378553796edb37bee/href">https://medium.com/media/205a23f160a0a4b378553796edb37bee/href</a></iframe><p>The AnimationPlayer in the scene manager will actually perform the tweening of the shader’s “transition” value, which will either render black or transparent depending on the pixel’s value relative to the transition position. This allows for a smooth effect for transitioning, at the cost there being a hard edge which might or might not be noticeable depending on the filtering of your image. The AnimationPlayer is triggered automatically when using the change_scene function, as well as when its is_ready state is changed after loading the next scene. In this simple implementation, it’ll fade out with the image, then play the same animation in reverse to fade back in. In the end, you’ll get a result like what we just saw when testing out the shader. However, what’s really neat is seeing it in action in a game.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstreamable.com%2Fo%2Fkchah&amp;url=https%3A%2F%2Fstreamable.com%2Fkchah&amp;image=https%3A%2F%2Fcdn-b-east.streamable.com%2Fimage%2Fkchah.jpg%3Ftoken%3DNR0dKHunc8PFn0kRqDm4vQ%26expires%3D1538020728&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=streamable" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d413c58543b87fec8d40ce456ebc666/href">https://medium.com/media/1d413c58543b87fec8d40ce456ebc666/href</a></iframe><p>The scene manager made here doesn’t do anything fancy like asynchronous loading, but it does add some pizzazz to your visuals. If you’re like me and are using Godot after having used RPG Maker, this should help fill one of the small but memorable gaps in the feature set that you might have been missing. In my opinion, this effect is a leaps and bounds improvement in my game’s presentation compared to what I had before, and it retains the retro aesthetic I’m going for. It’s really great for low-res games.</p><p><a href="https://gist.github.com/nhydock/c0a47c81798eb9260f1b38ae729e72f6">You can download the complete .tscn file</a>, which has script and shader embedded, and add it to your Autoloads to immediately start using it. Be sure to change any of your get_tree().change_scene references to go through the SceneManager Singleton instead</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfee7c46804b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A:\dventure Dev Log: Simulating basic market economics]]></title>
            <link>https://medium.com/@progdozer/a-dventure-dev-log-gamification-of-simulating-basic-market-economics-b8c8b54de5f5?source=rss-59128bb09625------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8c8b54de5f5</guid>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[godot]]></category>
            <dc:creator><![CDATA[ProgDozer]]></dc:creator>
            <pubDate>Tue, 18 Sep 2018 02:21:51 GMT</pubDate>
            <atom:updated>2018-09-18T23:57:27.557Z</atom:updated>
            <content:encoded><![CDATA[<p>Economics in A:\dventure is a bit different from C:\raft which revolved around bartering, due in part to its procedural generation. This time I’m taking a bit more of a toned down approach by using currencies in addition to items, but with that comes that challenge of determining what items should be worth and why.</p><p>One thing I have always disliked in single-player games is when you find that one item in the game that’s just worth a crap ton and it becomes relatively easy to farm. After a few hours you now have enough gold and can buy literally everything you ever need until the end of the game without worry because you’re just rolling in dough. I don’t want my game to be like that one bit, it gets boring that way. I’m a sucker for anything that actually requires good item management.</p><p>So, to tackle this issue of preventing farming of any one kind of item, I though “what if there’s a simulated economy?” A:\dventure portraits most interactions in the game through online communication over a streamlined internet client for adventurers, much like .hack// and some other single-player games that take place in an “online” world. Since there’s an imaginary community present in the world, why not make them affect an online marketplace that you as the player use to actually buy and sell your items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*SwDXrXUdfYZGzWg3Ds1OEQ.png" /><figcaption>You can receive and send messages to other characters in to see story elements unfold</figcaption></figure><p>The game operates on an accelerated clock, with time pausing while you’re not adventuring in your file dungeons, similar to Harvest Moon where time freezes when you go indoors. This helps give you time to actually manage your items and go through menus to get caught up on the story. It’s through this day system that the market adjusts itself outside of your influence. Supply and demand for items will fluctuate, sometimes drastically, resulting in items’ market values being varied from their actual MSRP. With this in place, there’s no single item you can really bank on grinding for easy money. On the other hand, there’s also potential that an item you were hoarding for crafting might be worth a lot on the market right now so maybe you’d be okay parting with a few for some easy money.</p><p>To balance the affects of the free market, all items have their own value curve as well, so the supply-demand dynamic may have a bigger or smaller impact on an item versus another depending on the ratio. An item like a 50 inch Television starts with an MSRP of around 3000/Bits versus a Potato which is only 3. But when a potato might have surplus stock of around 1000% of market demand, it only drops to 2/Bits, while the TV at the same surplus could be worth 400/Bits. Conversely, in excess demand of 1000%, the Potato may be worth 300/Bits while the TV is worth 10000/Bits.</p><p>Price scales aren’t linear in the market, and Godot makes this pretty easy to model actually, thanks to its Curve resource type and editor. Much like modeling stat curves for characters and monsters as they level up, I can depict the expected market value of items based on a supply demand ratio. Modeling values such as daily trend ranges and supply or demand surges is easy to do by simply exposing configurable values. In fact, by keeping daily trends as a range and having supply be separate than demand, I can even create items that will predictably increase or decrease in value over the course of any playthrough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*5Ks-7eGCkoUiZWPFWCxv0A.png" /><figcaption>Modeling the demand trends, showing that when demand is in excess of supply the value of this item will increase dramatically, is incredibly straight forward to do in Godot</figcaption></figure><p>With a limited size inventory, the need to improve equipment to make adventuring more profitable, and balancing what to hold onto to make money or craft, there’s plenty of road blocks that can get in your way to getting rich quick. Furthermore, not all items are available through random loot drops. To make matters worse, occasionally world scarcity may take an item out of loot drop circulation, permanently shrinking the supply cap and increasing demand within the market. Can’t forget that when you sell things it actually goes into the global supply as well! This means it’s also a bad idea to dump all of your stash into the market when it’s worth a lot, because each sale may drop the item’s price down. You can always hope the next day demand might increase to compensate, allowing you to get more money again.</p><p>If you think all of this is frustrating, especially for a game, that’s because it is! Item management and gambling on markets is never really fun, as it’s a way for the world fights against you. However, there’s big losses and big gains that can be had from it, and the balancing act adds a level of strategy and patience to the game that makes up for other areas that may not be as deep. This kind of feature is really to serve that niche or people who enjoy economic games like Recettear and Moonlighter, such as myself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*oTcZ02Ot874o_C8kNayHAg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8c8b54de5f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A:\dventure Dev Log: Vigor]]></title>
            <link>https://medium.com/@progdozer/a-dventure-dev-log-vigor-bec93789e163?source=rss-59128bb09625------2</link>
            <guid isPermaLink="false">https://medium.com/p/bec93789e163</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[godot]]></category>
            <dc:creator><![CDATA[ProgDozer]]></dc:creator>
            <pubDate>Mon, 02 Jul 2018 02:00:11 GMT</pubDate>
            <atom:updated>2018-07-02T02:26:06.109Z</atom:updated>
            <content:encoded><![CDATA[<p>Finally got around to implementing something called Vigor within A:\dventure. This plays into the real-time combat system of the game as a way of helping increase the amount of strategizing in the game and decrease the attack exploitation. The end goal is to make the game a little slower and more challenging.</p><p>A:\dventure’s current pause-and-target style gameplay is already a lot slower than C:\raft, which had a bump-combat system and encouraged rushing into things head first. With the lack of turns in my new game, I wanted to add in a targeting system like Vagrant Story. However, as I analyzed in play testing at Too Many Games, it’s easy to overcome this slow-down by position your mouse just right on the screen and spamming attacks once you get in a good rhythm. Vagrant Story has a <a href="http://vagrantstory.wikia.com/wiki/Risk_in_Vagrant_Story">Risk system</a> which prevents this, and so I thought it’d be helpful to implement something similar that fits the gameplay of my game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*sMIZbEQa9o_ix817_Ew_KA.png" /><figcaption>This number is actually going to mean something now!</figcaption></figure><p>Vigor points introduce a kind of cool-down mechanic into the system for players. To make it less annoying, it’s balanced in a way that having zero vigor does not prevent you from taking actions. Different weapons consume different amounts of vigor, and the better your mastery is with a weapon the less of it will be consumed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*UJSuBNzZlaZWNGcLtLFczw.png" /><figcaption>A simple overview of how the vigor scaling is implemented in combat</figcaption></figure><p>It’s not precisely a rip-off of the Risk system, but it’s pretty dang close. Recovery is generally faster, since I don’t want to have to rely on introducing tons of new items and menus to manage in the game. Vigor doesn’t affect accuracy, because reducing damage I feel is a good enough drawback. It does reduce evasion, but it doesn’t reduce defense, so you’re not safe but you’re also not at risk to be completely destroyed. There is not a “non-combat” state in A:\dventure either, so there’s no way to speed up recovery by running away from things or putting away your weapons like you can in Vagrant Story.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*9lFCDJ9_i27S-lVKjB-H2Q.png" /><figcaption>Vigor recovers in real-time at a fixed recovery rate, and is capped to 100 points</figcaption></figure><p>An existing problem made more apparent with Vigor is whiffing on enemies with current damage calculations. The last thing players need to do is save up for a full strength attack and then completely miss. To combat this, weapons need better balancing, and certain battle logic will also be adjusted on a per weapon level against specific enemy types. Things like bows being more accurate against flying enemies, axes hurting plants more, and the Pickup Truck having a much higher vigor cost will help improve combat alongside with this new mechanic so things are not as frustrating. Overall, I feel this all works perfectly in the context of the game and how it plays, so it was worthwhile planning to implement this from the beginning.</p><p>TLDR: I wanted something similar to Vagrant Story’s Risk mechanic in my game, so I added it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bec93789e163" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stumbling over Unity3D: Messaging]]></title>
            <link>https://medium.com/@progdozer/stumbling-over-unity3d-messaging-77edcbef798?source=rss-59128bb09625------2</link>
            <guid isPermaLink="false">https://medium.com/p/77edcbef798</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[ProgDozer]]></dc:creator>
            <pubDate>Sat, 30 Jun 2018 16:06:04 GMT</pubDate>
            <atom:updated>2018-06-30T16:06:04.232Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This is a largely untouched draft from Jan 2018 detailing some of my struggles with Unity. </em><a href="https://medium.com/@progdozer/the-great-transition-1041cc6f3477"><em>Since then I’ve transitioned development entirely to Godot</em></a><em>, but hopefully some of the little tricks I figured out here can help people.</em></p><p>Pretty much everyone who’s worked with Unity can tell you that the out of the box messaging system is a bit lackluster and inefficient. The inefficiency part isn’t much worry to me, as my game is turn based and I’m not sending a constant stream of messages every frame. Instead, my struggles arise as soon as I try to send messages between entities that are siblings or in unrelated parts of a scene, or even across multiple scenes.</p><p>You see, there’s plenty of entities within A:\dventure’s scene graph that can rely on generic messages with structured payloads. Entities ranging from characters to services to the UI. I decided early on that I’d need a global message bus, as it’s a pattern that served C:\raft incredibly well. This approach also allows me to not require direct references in scripts to other game objects, as every can just register themselves into a static bus.</p><p>Those who have worked with event driven web frameworks and needed a form of global messaging are probably quite familiar with what I needed to do here in Unity. Thankfully, this is a commonly solved problem, and there’s a wonderful Github gist by <a href="https://github.com/wmiller">wmiller </a>that tackles it elegantly</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ab17628e806b46e1a8a0cacfb799b65/href">https://medium.com/media/0ab17628e806b46e1a8a0cacfb799b65/href</a></iframe><p>I use this baby pretty much everywhere in my game. Registering onto it and making new message types is super simple and more strict than how doing it in JS is, which is quite welcome for game development. Here’s a snippet of how enemies all move from my AIMovement service when a Player’s MovementMessage is received.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/374d7441e1b5629c01d7d1723688e668/href">https://medium.com/media/374d7441e1b5629c01d7d1723688e668/href</a></iframe><p>As you can see, I’m not even using the MovementMessage’s `from` and `to` element’s in this case. This is because this isn’t the only place the message is being used. Instead of having my component’s all call methods directly on things that are dependent on their actions, the message system allows me to just provide a basic set of data that most things will need and selectively use what’s provided. It makes the code significantly faster to iterate on and extend, and is something I highly recommend any developer, using Unity or not, should try to incorporate into their architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77edcbef798" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The great transition]]></title>
            <link>https://medium.com/@progdozer/the-great-transition-1041cc6f3477?source=rss-59128bb09625------2</link>
            <guid isPermaLink="false">https://medium.com/p/1041cc6f3477</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[godot]]></category>
            <dc:creator><![CDATA[ProgDozer]]></dc:creator>
            <pubDate>Sat, 30 Jun 2018 02:21:00 GMT</pubDate>
            <atom:updated>2018-09-22T19:48:02.986Z</atom:updated>
            <content:encoded><![CDATA[<p>I feel bad, I practically have abandoned writing about A:\dventure at all, but that’s not the only thing I abandoned in the past few months. See, about a week ago I first presented A:\dventure publically in a semi-playable state at TooManyGames for people to playtest. Everyone who tried it said things like they enjoy how smooth it played, they enjoyed the subtle but quirky humor of it, and they generally liked the new gameplay style of the game versus C:\raft. However, what surprised people the most was the fact that I told them I’ve only been working on it on-and-off a month.</p><p>Now, if you’ve read previous blog posts from around 6 months ago, you’ll read that as a complete lie and marketing stunt, but in reality it’s the truth. You see, feeling like there’s no point in frustrating myself in my free time stumbling about in Unity, trying to make it do things in ways that work but not ways that are intuitive, I scrapped everything I made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*MEcm5cZmkRQzKTbFtacv2A.png" /><figcaption>And so we begin the transition</figcaption></figure><p>I’ve mentioned I’ve played around with Godot before, and originally the reason why I didn’t start this project in it was because 3.0 wasn’t yet stable at the time. I’ve always been a fan, even though I had no practical experience making anything of a decent scale in it. Also, since my free time has been stretched thinner than I anticipated when I started working on A:\dventure, before I knew it Godot 3.0 was out and my game hadn’t progressed anywhere in development. So with a month to go until TooManyGames, I thought I might as well do what I always do when I present at that con and just try to pump something new out fast.</p><p>With 3.0, Godot added C# support, which is cool if you know C#. I do know C#, but seeing that there’s very little similar between Unity and Godot’s API, it’s not like everything you know about working in Unity’s C# will help you transition to Godot’s. Instead, because I’d have to rewrite everything anyway, I opted to use GDScript as the language of choice for the game. Since the game is designed to be incredibly small and lightweight, not having to include the Mono runtime keeps the binary smaller. Also, due to the simplicity of my game’s logic and object count at any point in time, I’m not worried about any potential performance drawbacks using an interpreted language would have on my game. This allows me to be more concerned about the general quality of my game’s code and the ability to write things out fast in a simple pythonic language designed for game creation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SHO9RmnR1Hc993II29v8iQ.png" /><figcaption>If there’s any one thing I can say I love the most about Godot, it’s not having to litter my directories with single use script files. Godot lets you embed resources like scripts into your scenes if you want to.</figcaption></figure><p>Godot’s UI creation tools are comparable to Unity’s, allowing for anchoring and resizable UIs, which is cool. I was able to recreate most of the UIs I had before and then some more using most of what I had learned in Unity, so it went significantly faster the second time around. However, <a href="https://medium.com/@progdozer/stumbling-over-unity3d-to-create-a-retro-game-fixed-resolution-966ca9c3dfba">unlike Unity</a>, Godot plays well at doing pixel perfect scaling out of the box for 2D heavy, low resolution games. Unlike many pixel art games that you see nowadays, A:\dventure renders at only 320x240 and everything is pixel perfect. Every pixel counts with my assets, and being able to scale them appropriately with no excessive filtering is important. You won’t see a mix of pixels that are 2x2 and 3x3, you won’t see assets blending between the “grid” like you get with high res pixel art games. In a previous post I talked about how dealing with this kind of rendering was a struggle in Unity. Godot took those worries away, so now I don’t have to spend as much time fiddling with my assets to make things look right.</p><p>Implementing the gameplay has never been easier. The signal system that Godot has out of the box is just incredibly elegant and simple to use, and eliminated a bunch of code and boilerplate I had for doing the same thing in Unity. Straight forward and visible event registration makes it easy to see and set up logic for executing actions relating to input handling, queue up a multiple stage pipeline for building my dungeons, and even trigger animations. So much programming in a turn-based game functions better in an event based fashion, so this was the approach I was always going to take. To have tools that allow me to follow that path with little resistance only makes implementing it the way I imagined it all the more satisfying.</p><p>Generally, the entire work environment has just felt more natural since the switch, and thus I’m going to continue with this direction for working on my game. Getting things to the same point and further has taken less time even though I had about the same level of experience in both engines. You might chalk this up to me already having more of a plan of what I needed to do than when I first started working on this, but even still, I feel no regret for changing engines.</p><p>Follow up posts will be related more to updates about features I’m working on and things to look forward to with the development of the game itself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1041cc6f3477" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stumbling over Unity3D: Fixed Resolution]]></title>
            <link>https://medium.com/@progdozer/stumbling-over-unity3d-to-create-a-retro-game-fixed-resolution-966ca9c3dfba?source=rss-59128bb09625------2</link>
            <guid isPermaLink="false">https://medium.com/p/966ca9c3dfba</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[ProgDozer]]></dc:creator>
            <pubDate>Wed, 20 Dec 2017 05:09:53 GMT</pubDate>
            <atom:updated>2017-12-31T18:47:53.905Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@progdozer/stumbling-over-unity3d-to-create-a-retro-game-tilemaps-d51a898cc75d">Tilemaps weren’t the first thing I ran into that gave me problems</a> out of the gate with my new game. Another thing you usually care about with retro games is actually having a fixed, low-resolution display. You want those pixels, you want to be rendering at NES or Gameboy resolutions, and you want it to preserve that aspect ratio when you play in other resolutions. In particular, I’m targeting the DOS demograph, so that means a 320x240 internal resolution. Except Unity doesn’t really have the concept of an Internal Resolution.</p><p>In LibGDX when I made C:\raft I used the Scene2D, passed it a camera with a scaling viewport that preserves aspect ratio, and set the dimensions of the viewport to a fixed value. I did some fun trickery on top of that with rendering to a texture, but that was solely for the palette swapping shader and for cleaner scaling because before I was getting distorted pixels. Godot’s viewport comes out of the box with the ability to have an base resolution and set the way things scale for you!</p><p>Unity makes things a bit tough, as it tries to make things easier for high resolution games that can benefit from a flexible, scalable UI. Text heavy UIs with tons of windows look weird with deadspace around them, though. If you designed your assets around your fixed resolution, they can also scale horribly or have blank space around them. You can’t just rely on the resolution/aspect ratio settings in the Player settings of your project, either, because they don’t work too well for Fullscreen, and they have no impact at all in the editor’s Game View when you’re testing things.</p><p>How I did a render texture in LibGDX for fun ended up becoming an actual requirement to get a fixed resolution in Unity with preserved aspect ratio. My scene consists of 2 cameras and 2 canvases now. Camera 1, which renders to the 320x240 texture, is for Canvas 1, which is set to scale at a constant pixel rate and contains my actual scene’s UI. Rendering to the texture actually will make the camera fixed to that size, and thus so will be the camera, so I can draw to it in pixel units if I feel like it (I did). Then the next step was actually rendering the texture, which is what the second camera and canvas were for. The second canvas actually scales to the screen viewport while preserving the aspect ratio, only drawing the raw image of the render texture in it. This positions the texture properly and letterboxes it. All good!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*7xxZxa7RxN9kt-py0gMzvw.png" /></figure><p>Except it’s not. All this fiddling with canvases and scaling, I forgot an important part. The original canvas isn’t scaled with the game screen, but it still exists in the scene, and I need it to because there’s buttons and stuff. I had been accustomed to things that could scale my viewport also scaling the input within it, so of course once I had to separate it into 2 steps things because disconnected. Painfully, you can’t just tell the EventSystem to scale its input or say which camera specifically it should be using, else I could easily just tell it to use the camera that’s rendering to a texture instead of the one projecting to the display.</p><p>So I did something I really didn’t want to do and ended up having to write another script, this time to override input processing for the mouse. Thankfully a <a href="https://bitbucket.org/Unity-Technologies/ui">Unity’s UI code is on Bitbucket </a>because I guess they know people will want to override the crap out of it since it just doesn’t do what anyone wants.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff0047ac92c5fce3f42bb02295477d66/href">https://medium.com/media/ff0047ac92c5fce3f42bb02295477d66/href</a></iframe><p>I know how the texture is going to be positioned on scaled, so I recreated those calculations and override Unity’s UI processing of mouse input. By scaling input to where the render texture supposedly is and to its size, the GraphicsRaycaster of the GUI actually detects properly and I finally have a working UI again that now works in any resolution.</p><p>Seriously, this could have been avoided if things just weren’t so disjointed.</p><p><em>Shout out to Ocias for the </em><a href="https://ocias.com/blog/unity-pixel-art-camera/"><em>Pixel Art Camera</em></a><em>, which I used for my render textured camera/canvas. This allowed my fixed resolution view to scale beautifully and be pixel aligned.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=966ca9c3dfba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stumbling over Unity3D: Tilemaps]]></title>
            <link>https://medium.com/@progdozer/stumbling-over-unity3d-to-create-a-retro-game-tilemaps-d51a898cc75d?source=rss-59128bb09625------2</link>
            <guid isPermaLink="false">https://medium.com/p/d51a898cc75d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[ProgDozer]]></dc:creator>
            <pubDate>Wed, 20 Dec 2017 05:00:54 GMT</pubDate>
            <atom:updated>2017-12-31T18:48:14.581Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This is a series of my gripes with Unity3D as I work towards making my next game A:\dventure. If there’s any bright side to any of these problems I end up overcoming, it’s that usually the work around only needs to be done once and then I never have to worry about it again. The downside is always that a work around was needed in the first place in an engine that has a track record of being great for indie developers.</em></p><p>Having bounced between multiple frameworks and game engines ranging from LibGDX to Love2D to Godot to Xna, I finally decided to settle on Unity. I’ve tried Unity before, but its general architectural approach and bloat always made it incredibly far from ideal for making retro style games with actually low memory requirements. However, I decided to throw aside my bias for frameworks and my stigma towards the engine so I could try to make a whole game in it. I wanted to get a game out, and get it out fast. It’s my first time really jumping into Unity, and things appear to have changed quite a bit since my last attempt back during the 3.x days.</p><p>While Unity has been touting better 2D as the years go by, as of 2017.2 it’s still an absolute pain to do a completely 2D/orthographic game in. For a tool that people typically fawn over and act like it give you the keys to the kingdom of productivity, it misses tilemap features incredibly useful for tile based RPGs and low-resolution retro games. Like most game engines, it seems like all the tile based stuff is geared more towards physics driven 2D platformers instead of roguelikes and rpgs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c8f98fd1e7a11b01a59a20ff3e538a4/href">https://medium.com/media/1c8f98fd1e7a11b01a59a20ff3e538a4/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*s6sKzJyX5nVJaIKlyZTk4Q.png" /><figcaption>Seriously, what the frick is all this stuff that isn’t normally visible. btw Godot supports dictionaries in the inspector now, still waiting for Unity to get this feature</figcaption></figure><p>Unity’s new tilemaps actually render really heckin’ fast. It’s not a bunch of game objects that Unity developers had come accustomed to for building up tilemaps, it’s an actual batched object type, much like you get from LibGDX and Godot. You know, the way it <em>should</em> be managed in memory! Conversely, If you’re coming from LibGDX, which can just read Tiled XML files and preserve all the nice metadata that you have on your tileset, you’ll be incredibly disappointed in the tile editor that Unity comes with by default. Adding metadata to a Unity tile is far from intuitive in 2017.2, you need to make a new C# class that extends their Tile class that add new fields and is exposed to the editor.</p><p>For my roguelike, I ended up needing a custom tile type to handle basic collision, because I don’t freakin’ need Box2D for a top-down roguelike, as well as density metadata which affects the character’s line of sight. Doing this, of course, adds a bunch of unnecessary field visibility to the inspector, because Unity never works in ways that you think it should, and the overall process is just less user friendly than exposing a dictionary of Key/Value metadata on the base tile class. Literally 9/10th of this code is copy pasted from their docs, which makes you wonder why such hassle/boilerplate is necessary for such simple functionality.</p><p>Lacking autotile/wang tile support is pretty disappointing too since that’s a great feature of RPG Maker and Tiled. There’s packages on the asset store that support it, but of course none of them are integrated/built on Unity’s own tilemap system yet. You can get something similar by making another custom tile type. Unity’s own docs demonstrate how to make a pipe/road tile with a custom class, but their solution just takes an array of a dozen textures. Without an easy to use in-engine editor for autotiles, like there exists a sprite editor, the UX just feels bare and unhelpful. Furthermore, lacking autotiles is a big loss towards making nice walls with ease in proc-gen roguelike maps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*L5N1SEPSLlFYiVr_BT1e2w.png" /></figure><p>My complaints in regards to Unity’s tilemap system is mostly architectural and usability oriented. When there’s so much competition out there for something that people have been doing for decades, there’s really no reason for there to be an brand new implemented feature that feels so unintuitive and half-assed. It clearly feels more like something they whipped up in order to shut up all the people who wouldn’t stop asking for it. Hopefully usability gets fixed up in the upcoming versions, but by then I’ll most likely be done with this project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d51a898cc75d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>