Advanced Godot Tips and Tricks!

Recently, I found that I suddenly had enough free time (for once) to dive into a project that’s been nagging at the back of my mind for a while now. For the longest time, I’ve really wanted to create a strategy game similar to “Sid Meier’s Civilization” but built from the ground up with the benefit of my outsider perspective. Basically, everything I like about Civilization, without all the bits I don’t like. Much like an online casino South Africa. All the best bits of South Africa and online casinos, but without the bits I don’t like.

I don’t intend to release this project, as I doubt I’ll get much farther than a rudimentary prototype (that’s University life for ya), but as I’ve delved into this project, I’ve come to realize just how far along my skills as a programmer and game developer have come. While my project is far from complete and certainly isn’t sexy in the slightest, I’ve gotten a bunch of the major systems completed with a solid code-base under the hood that I’m extremely proud of. And none of it would have been possible without my taking advantage of the amazing Godot game engine.

Now lemme jump up and down with excitement like a little kid and show you the cool thing I’ve done! Are you proud of me, mommy?

Why Godot?

Let’s start with the basics. Who, what, where, why, Godot?

Godot is one of the three big, popular game engines used by independent developers. The two established powerhouses in this field are Unreal and Unity. There are completely valid reasons for choosing either of those two engines over Godot.

They’ve established game engines, with a load of funding and technical support, with extremely successful high-fidelity games released by big developers.

They also both have an extremely high revenue cap, where unless you’re earning over hundreds of thousands of dollars, you don’t have to pay royalties to either Unity or Unreal to use their engine. On top of that, if you do pay for the licensed versions, you gain access to some extremely powerful software.

By contrast, Godot is an open-source project funded and supported by donations and volunteers. The community, while not negligible, is a fraction of the size of either Unity’s or Unreal’s. The engine is also under heavy development and is severely lacking on the high-fidelity 3D side of things (although this will be changing with the 4.0 release, ETA: I have no idea). The engine is lacking documentation in certain areas, and tutorials are nowhere near as plentiful as there are for, say, Unity.

So why Godot?

There are a couple of points in Godot’s favor that make me choose it over other engines. The first is how insanely lightweight it is in comparison. Godot only had a 40-megabyte download / installation and can run on all but the worst potato computors. Unity, in contrast, is at a minimum, six or so GIGAbytes, and the Unreal engine is even larger. Both also require fairly powerful machines to run acceptably. Godot beats them both out on this front.

The second point in Godot’s favor is the ease of use. I had originally started my game development journey in Unity, and while it’s not a bad engine at all, I found that Godot simply clicked with me in a way that Unity never did. Godot allows developers to code in either C# or GDScript (a proprietary language similar to Python). However, I did see a plugin that adds Lua as an option, if that’s more your style. The engine itself is built with C++, and is easily modifiable from what I’ve seen.

This segues us nicely to Godot’s third major selling point: The fact that it’s completely free. Now you might read that and be thinking “very cheap”, with monetization and subscription services. I can understand that mindset. But you’d be wrong. Godot is 100% free and distributed under the MIT open-source license. Any project you make in Godot can be sold without any legal strings attached, whether you make a video game, a photoshop knockoff, or even just a modified version of the Godot engine itself.

On top of all that, Godot easily beats either Unity or Unreal in the 2D development area. Yeah, Unity and Unreal are both far more powerful overall, but they were both designed for 3D first with 2D added afterward. Godot has had 2D since its inception, and you can tell. The interface, the performance, and the tools are well designed and put together in a way that Unity or Unreal’s 2D tools simply aren’t.

In short, Godot is lightweight, cheap, and easy. Just how I like my game engines…

Nodes & Scenes

One of the other major differences between Godot and most other engines is its Node-based hierarchy. Rather than attaching a whole bunch of classes and scripts to a single object, all the different behaviors you could want are added as nodes attached to a parent object. This node modularity makes for very easy modularity and quick iterations.

Then, when you’ve made whatever object with all the features, you desire for it to have, you can save it into its own scene and instance a copy of it into your game levels. You can place a hundred of these copies into your level and then modify the original version, which will then propagate that change across all the copies!

Basically, if I’m working on a game like Mario, and I design a collectible coin. I put a whole bunch of these coins into my levels. Then, later on, I decide I don’t like the color of the coin. I just have to modify the original coin, and the color of all the coins will change automatically. Ain’t that swell?
This node and scene-based system can also be used for far more complex technical work. For instance, in the strategy game project I have been working on, I use the system for handling the Tech Tree (if you’re not familiar, in “Civilization,” there’s a special window where you can research technologies that advance the science of your cities, and unlock new weapons, units, buildings, etc.).

This is laid out in a graph where you can only research one technology after you’ve unlocked one or more previous technologies. I represent each technology with its own special node that tracks which other nodes are needed in order to continue research. Each node carries behavior that dynamically draws lines between the nodes. And then, when a player has finished researching a technology, that information is passed UP the hierarchy to an overall parent node that handles what to do next!

Custom Resources

One of the most important parts of any project is keeping organized. This can be as simple as a stick note with jot dots to a full spread database that’s subdivided and subdivided and subdivided…

Video games are no different. In fact, by their nature, they require a TON of information to be stored and accessed at any given time. In a strategy game, there’s even more, to think about.

By comparison, a game like Call of Duty doesn’t need to pass too much information around. Every player only really needs to worry about their own health, their ammo, their weapons, etc… but even so, what kind of weapon are they using? How much damage does it do? How much spread does it have? How much ammo can it hold?

This is where custom resources come in. In Unity, this is called “Scriptable Objects”. The idea is that you can make a single file of information that be instanced over and over again and used to define a whole bunch of different things.

Let’s return to our Call of Duty analogy. Let’s say there’s a generic script called “Gun.” This file defines all the basic behaviors of guns. How they shoot, for instance. Instead of creating a bunch of different scripts, we can create a bunch of “Scriptable Objects” that the one gun script reads in order to determine its own behavior.

For instance, if you plug in the Machine Gun script, it’ll read that it has a high rate of fire and shoots like an automatic, but if you plug in the Shotgun scriptable-object, it’ll read that it gets a single shot before needing to be reloaded. This is all from one script that’s simply having different numbers punched in.

AutoLoads (AKA: Singletons)

Autoloads is a powerful tool available in the Godot game engine. They let you load a script that can be accessed globally, by everything, everywhere. That’s pretty gosh-darned useful. In my strategy game project, I use an autoloaded file to manage how every turn is handled. Since all players and all objects all act on a strictly defined turn-based system, this is information that’s important for all of them to access and to be sure that all of them are accessing the same information.

This system does need to be used sparingly, however. AutoLoaded files are referred to as “Singletons” in other game engines. There can only be a single instance of such a script running at once, so it would be self-defeating if all players were using a single script to track each of their stats, for example, instead of just instancing a generic “Player” script for each player. In Call of Duty, each character tracks their own health, rather than one giant singleton / autoload tracking the health of all players.

Design Smarter, Not Harder

You might have noticed a through-line with my advice. I like modularity. I like being able to reuse files, scripts, and code. A well-put-together game will be designed to take the most advantage over every feature. This kind of thinking requires you to both plan ahead and keep in mind the big picture by constantly breaking up the code into small, legible, and reusable chunks. And methods and functions are your best friends.

Knowing all that, are you ready to design and build your dream MMORPG with blackjack and hookers? No, and I hope it’s obvious why. This kind of smart game design requires practice. It requires you to know your own skills and your game engine like the back of your hand. Full-sized games (AKA: Not mobile reskins) have production cycles that are measured in years. This is why Game Jams are great. They give you an opportunity to put your skills to the test in a low-stakes contest designed to push you to your limits.

Godot is an amazing tool. It’s easy to learn but hard to master- just like all the best games. And it has a bright future. Even larger studios are noticing it, with the recent “Sonic Colors Ultimate” using the Godot Game engine (which is, admittedly, not exactly a great endorsement, but it’s a start!).

You may also like:

Sarcastic Writer

Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical hacking, seo tips and tricks, malware analysis and scanning.

Related Posts