The Shaggy DevWhile functions are not first-class objects in Godot, FuncRefs can help replace some of that missing functionality. Using the built-in funcref() function, we can create objects that maintain a reference to and can call a selected function anywhere in our code.
Callbacks and function references in Godot 3 using FuncRefsThe Shaggy Dev2021-11-29 | While functions are not first-class objects in Godot, FuncRefs can help replace some of that missing functionality. Using the built-in funcref() function, we can create objects that maintain a reference to and can call a selected function anywhere in our code.
Godot documentation: docs.godotengine.org/en/stable/classes/class_funcref.htmlFixing menu transparency issues in Godot 4The Shaggy Dev2024-10-15 | Transparent menus on things like OptionButtons are not exactly as straightforward as you would expect, so here's a look at how I fixed it for Unto Deepest Depths.
Read this video at shaggydev.com/2024/09/25/udd-unit-selectionProgramming a tactical strategy game in Godot 4The Shaggy Dev2024-09-05 | Let's look at how my latest strategy game, Unto Deepest Depths, is designed. I'll break down the application architecture, how I manage turn order, and show the core code snippets behind the main game loop.
What I'm making: 00:00 Game architecture: 02:26 Code breakdown: 07:00Unto Deepest Depths - Announcement TrailerThe Shaggy Dev2024-09-03 | Unto Deepest Depths is a dark fantasy strategy game where you must build a party and lead them into the unknown to vanquish the horrors below. Battle through turn-based combat, upgrade your units, and plan your moves carefully in this punishing roguelite where any move could be your last.
New devlog series starts soon!10 small ways to make your life easier in GDScriptThe Shaggy Dev2024-06-20 | Here's a collection of miscellaneous tips when working with GDScript to make your life easier. Improve working with the terminal, organizing your code, and learn a few shortcuts you might find handy.
Text version and code snippets: shaggydev.com/2024/06/19/small-gdscript-tipsGame development in the dying days of FlashThe Shaggy Dev2024-05-16 | It's been ten years since my first "commercial" game project, so let's take a look back at what game development was like in 2014. Flash was on the way out, HTML5 was up and coming, and Steam hadn't yet opened the floodgates. The business model of web games was quite different back then, so let's dive in!
discord.gg/udafrsSzcyMaking a golfing roguelike in one weekThe Shaggy Dev2024-04-02 | Here's a look at my entry for The 7DRL Challenge, a mashup of golf game and roguelike, I'll talk about how the levels are generated and some challenges I ran into along the way.
00:00 What I made 01:00 How the levels are made 04:55 How the ball worksMaking a dev console in GodotThe Shaggy Dev2024-01-10 | Here's a look at how I implemented a simple dev console in my game to speed up development. The core functionality is driven by Godot's Expression class, but I've also added a history and autocomplete system to let me work even more effectively.
More on Expressions: docs.godotengine.org/en/stable/tutorials/scripting/evaluating_expressions.htmlAdvanced state machine techniques in Godot 4The Shaggy Dev2023-11-28 | Here's a look at some more advanced techniques you can implement in your state machine when you need something a bit more complex than the starter state machine I showed in the last video. We'll look at three techniques worth understanding for building out the state machine you need and address a few common pain points people run into when programming a state machine.
00:00 Dependency injection 02:50 Composition 07:15 Hierarchical state machines 09:25 How to do multiple things at once 10:30 Sharing data between statesStarter state machines in Godot 4The Shaggy Dev2023-10-10 | Here's an updated look at how I like to do state machines in Godot 4. I'm going to go over some simpler, starter techniques today, and in the next video I'll go in-depth about techniques you can use when today's examples don't cut it.
Simple state management: 00:00 Node-based states: 02:22 A few examples: 08:00
Theory video: youtu.be/-ZP2Xm-mY4EMaking tactical units - A devlogThe Shaggy Dev2023-09-05 | Let's talk about how the data behind units is structured, how artwork is implemented, and how I'm handling unit AI in my tactics game.
00:00 - What I'm making 01:40 - Unit data 04:35 - Artwork 08:33 - Unit AI
What I'm making: 00:00 Level structure: 01:28 Unit structure: 06:00 Godot 3 vs 4: 08:22 Actions: 10:33Making an atmospheric incremental game in Godot in 9 daysThe Shaggy Dev2023-06-06 | For the 57th Godot Wild Jam, I made Flame Forged, an incremental game with a heavy emphasis on lore and atmosphere. Here's a quick mini-devlog containing a few interesting things from my time developing the game.
Flame Forged: theshaggydev.itch.io/flame-forgedCreating volume sliders in Godot 4The Shaggy Dev2023-05-23 | Here's the right way to let the user adjust the volume of different types of audio in your game.
Building a Better Centaur: AI at Massive Scale - gdcvault.com/play/1021848/Building-a-Better-Centaur-AI5 more changes to GDScript 2 in Godot 4 youll want to know aboutThe Shaggy Dev2023-03-08 | From signal and tween updates, to debugging help, here's another grab bag overview of some changes to GDScript in Godot 4 that you may want to know about.
Corrections: 01:09 This only applies to local variables where the lambda is declared, such as the variable and lambda inside of _ready() in this example. Changes to variables declared at a higher scope are not subject to this, such as moving the variable declaration outside of the _ready() function.A few common code smells to be aware of and how to fix themThe Shaggy Dev2023-01-17 | Code smells are things in a codebase that readily stick out and imply something may be off with how it has been designed. Here's a few common ones you may find in your own codebase, why they can be concerning, and how to fix them.
Martin Folwer on code smells: martinfowler.com/bliki/CodeSmell.htmlUsing the AStarGrid2D class in Godot 4The Shaggy Dev2022-12-19 | New to Godot 4, the AStarGrid2D class makes solving grid-based layouts a lot easier than the existing AStar2D class while also adding some performance improvements and control for how that pass is found.
Basic usage: 00:00 Customizing the heuristic: 01:26 Using diagonals: 02:24 Jumping: 02:58
A* Heuristics: https://theory.stanford.edu/~amitp/GameProgramming/Heuristics.htmlAn introduction to graph rewriting for procedural content generationThe Shaggy Dev2022-11-21 | Graph rewriting is a great way to generate interesting procedural content for games, suitable for generating both grid-based and non-grid-based maps, quest structures, and more. In this introductory video, we'll look at what a graph is, how graph rewriting can be used to generate content for games, and what some common techniques and usages look like.
Intro: 00:00 What is a graph?: 00:42 Graph rewriting: 02:30 Generating a graph: 04:09 Common uses: 05:26
Unexplored's generation method: aiandgames.com/2021/01/28/unexploreds-secret-cyclic-dungeon-generation8 changes to GDScript in Godot 4 youll want to know aboutThe Shaggy Dev2022-10-25 | Here are five things that are different in GDScript from Godot 3 to Godot 4, along with three new features that you may want to know about. Here's the changes we'll look at: the introduction of Callables, the "await" command, calling functions from a superclass, changing scenes, and annotations. Additionally, we'll look at a few new additions to typing variables in GDScript 2.
Exports: docs.godotengine.org/en/latest/tutorials/scripting/gdscript/gdscript_exports.htmlHow to use setter and getter functions in Godot 4The Shaggy Dev2022-09-28 | Setter and getter functions let you run custom logic when a variable to written to or read from. There have been some minor changes in how this works in Godot 4, so let's look at the new syntax and how it differs from Godot 3.
Text version: shaggydev.com/2022/09/15/godot-4-betaHow to write more flexible game codeThe Shaggy Dev2022-09-14 | Writing code that is flexible and receptive to change can be a challenge, but these tips can help you improve your codebase, no matter the size of your game.
The application hierarchy: 00:00 Managing data and logic: 02:32 Use components: 04:01 Dependency injection: 04:38 On design patterns: 05:59 The final tip: 07:37
Text writeup: shaggydev.com/2022/09/13/flexible-codeHow to make a tactics game in only two weeksThe Shaggy Dev2022-08-16 | Let's take a deep dive into the design of the elemental tactics game I made for Mech Jam III, Elemechs. This game is far from perfect, but the processes for art and sound production, application architecture, and overall design should still be of interest to anyone curious about making their own tactics game.
What is Elemechs? 00:00 Art pipeline: 01:37 Mechs and actions: 03:53 Action design: 07:28 Turn and team management: 09:04 Level editor: 10:21 Level design: 11:59 AI: 14:15 Sound and music: 15:34
Kaiju Klash is a turn-based fighter where you build your own giant monster and fight to climb the ranks of the arena against other perilous, and sometimes wacky, monster combinations. Each monster part offers unique stats and abilities so you can fight how you want!
range_lerp: docs.godotengine.org/en/stable/classes/class_%40gdscript.html#class-gdscript-method-range-lerpHow to use the microphone in Godot 3The Shaggy Dev2022-07-15 | Using the microphone is fairly straightforward in Godot, though you might not realize it since the information you need is scattered all over the web. This is my attempt to organize everything into one post. We'll look at how to record, play back, and save audio in addition to how we can performa real-time analysis of the volume and frequency of the microphone input.
Project setup: 00:00 Recording, playing, and saving audio: 00:52 Real-time volume monitoring: 02:16 Real-time frequency monitoring: 03:22 Changing the recording device: 04:13
Spectrum analyzer devblog: godotengine.org/article/godot-32-will-get-new-audio-features5 tips for better platformer controlsThe Shaggy Dev2022-06-30 | Making a good, satisfying platformer is a lot harder and more involved than throwing a physics body on top of a tilemap and calling it a day, so here's a few tips for how you can make your platformer feel better to play, from the basics to some more advanced tricks.
The most fundamental thing: 00:00 Correcting player mistakes: 01:02 Custom jump functions: 03:08 Closing thoughts: 04:52
Correction: 04:50 Unfortunately, this video is no longer available.
How to Calculate the Perfect GRAVITY and JUMP FORCE - youtube.com/watch?v=K9g8TTFjIlYScene transition effects in Godot 3The Shaggy Dev2022-06-13 | Let's look at how we can use animations, shaders, and other effects to make better scene transitions in Godot than a simple call to `get_tree().change_scene`. We can do this by adding an autoloaded scene that can act as an intermediary when we want to let an effect play out during scene transition. This also makes it easy to introduce background loading if we want.
Correction: 00:03 See the pinned comment for the equivalent syntax in Godot 4!Communicating between game objects with the observer patternThe Shaggy Dev2022-06-02 | One of the most common issues you'll run into in your game development journey is how to let two unrelated objects communicate with one another in a way that doesn't completely ruin the organization and flexibility of your code. The observer pattern is one potential solution to this problem, and makes it easy to let different game objects communicate with one another without coupling your entire application together. With native support in most languages and game engines, it really is something you should keep in your toolbox. We can also expand upon this concept further and introduce the event bus, a way of letting more distant objects connect to one another while still keeping the flexibility of your code intact.
Background and motivation: 00:00 The observer pattern: 01:34 Observables in practice: 02:52 Global access via an event bus: 05:02 The event bus in practice: 05:31 Final thoughts and further reading: 06:04Godots OS ClassThe Shaggy Dev2022-05-19 | Godot's OS class offers you direct communication with the user's operating system, providing a lot of convenience for things like determining the screen resolution, moving and resizing the game window, and working with the system clipboard.
Text version of this video's contents: shaggydev.com/2022/05/04/clean-codePixel-perfect collisions on sprites in GodotThe Shaggy Dev2022-04-14 | Whether you want accurate collision bodies or pixel-perfect mouse detection, this video is for you. Let's look at our options using both the editor and GDScript to create collision polygons from sprites in Godot.
Intro: 00:00 Via the editor: 00:24 Via code: 01:23 Objects with holes: 03:25
Documentation for BitMap: docs.godotengine.org/en/latest/classes/class_bitmap.htmlConfiguring Godots built-in code editorThe Shaggy Dev2022-03-26 | Godot's default settings for its built-in code editor are intended to be both approachable for beginners and generally agreeable to the broader user-base, but if you have experience in software development outside of Godot or even have just been working with the engine for a while you'll be particular about how you like to do things, so here's a few items you may want to configure in the Editor Settings window to make your coding experience more agreeable.
Godot docs for external editors: docs.godotengine.org/en/stable/tutorials/editor/external_editor.htmlGenerative grammars as a form of procedural content generationThe Shaggy Dev2022-03-17 | At their core, generative grammars are all about the rules and replacements of a language. In our case, that language is game content. Let's look at how we can take the simple concept of word replacement and use it to create more thoughtful and interesting procedurally generated content.
Definition and example: 00:00 Other uses: 03:11 Quest generation: 04:00 The main limitation: 05:48 Where's the code?: 06:41
Text version of this video: shaggydev.com/2022/03/16/generative-grammarsHow I do screen shake in GodotThe Shaggy Dev2022-02-24 | The basic way to do screen shake is to just apply a random offset each frame to the camera, but in this video I show how I use Godot's OpenSimplexNoise class to generate noise and get a more fluid and customizable screen shake. This can work great for both intense shakes and gentle sways.
Godot documentation: docs.godotengine.org/en/stable/classes/class_opensimplexnoise.htmlBuilding a more advanced state machine in Godot 3The Shaggy Dev2022-02-13 | Hierarchical state machines and dependency injection are two great techniques to know about when building your state machines in Godot. Let's look at how these techniques can be used to build upon the simpler implementation from the previous video on state machines and make something more flexible and reusable.
Intro: 00:00 Hierarchical state machines: 01:46 Dependency injection: 03:36 More options: 05:22
Video on FuncRefs: youtu.be/f5oE2cqxv3MMaking a customizable turn-based combat game in two weeksThe Shaggy Dev2022-02-10 | Kaiju Klash is a game my partner and I made in two weeks for the Kaiju Jam. It features monster customization and turn-based combat. In this video, I cover a few takeaways from the experience.
Check out all the submissions here: itch.io/jam/kaijujamUsing a Line2D node to create physics bodies in GodotThe Shaggy Dev2022-01-26 | Let's look at how we can use the Geometry class and the techniques demonstrated in the Polygon2D video to create static and rigid bodies in Godot from Line2D nodes. This is done using the offset_polyline_2d function, which let's us take a line and buffer it by a given amount to create one or more polygons.
Donut Roll (the game showed at the end): theshaggydev.itch.io/donut-roll5 quick tips for GDScriptThe Shaggy Dev2022-01-13 | Let's look at five useful things to know about coding in GDScript that are too small for their own video.
Custom string casting: 00:00 Fixed export options: 00:32 Safe lines: 00:59 Large number readability: 01:41 Stepify: 01:51
Link to the Godot documentation on stepfiy: docs.godotengine.org/en/stable/classes/class_@gdscript.html#class-gdscript-method-stepifySetter and getter functions in Godot 3 with setgetThe Shaggy Dev2022-01-05 | Setter and getter functions allow you to write custom logic to be ran when a variable to written to or read from. In Godot, we can define setter and getter functions using the setget keyword, followed by the names of the setter and getter functions, respectively. This video demonstrates the technique along with providing some useful tips for when you're using setget in a project.
Official documentation: docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_basics.html#setters-gettersAn introduction to procedural lock and key dungeon generationThe Shaggy Dev2021-12-18 | Let's take an introductory look at lock-and-key procedural content generation. Using a lock-and-key framework to procedurally generate content, you specify paths of progression for the player in your games. Roguelikes, narrative games, and really any sort of game where you want the player to advance via a series of steps (whether linear or non-linear) can be modeled and created this way.
Intro: 00:00 Definition: 00:56 Big key locks: 01:43 Small key locks: 02:38 Stateful locks: 03:49 A sample technique for generating content: 04:36 Limitations: 07:14 Spatial methodologies: 09:09 Conclusion: 10:57
Unexplored's unique cyclic graph generation technique: aiandgames.com/2021/01/28/unexploreds-secret-cyclic-dungeon-generationImplementing the state pattern in Godot 3The Shaggy Dev2021-11-15 | Let's take a look at how we can implement the state pattern in Godot. Using a simple platformer project, I'll show the basic technique using enumerators and a more fully featured state machine that uses Godot's node system to provide extra conveniences over a pure code solution.
Intro: 00:00 The enumerator method: 00:53 Technique overview: 01:45 Player and state manager breakdown: 03:33 Individual states: 05:40 Conclusion and running the project: 06:58
Transcript: shaggydev.com/2021/11/15/state-machines-godotAn introduction to finite state machines and the state pattern for game developmentThe Shaggy Dev2021-11-02 | In this video, we'll discuss finite state machines and how they can be used to write cleaner, more maintainable, and more expandable code for your games. We'll look at the naive way of managing state in a game, how we can improve upon that method slightly with enumerators, and finally how to build a robust system using the state pattern.
Intro: 00:00 Life without state machines: 00:54 Finite state machines: 02:38 Using enumerators: 04:55 The state pattern: 06:09 Final thoughts and where to go next: 10:28
Artwork by Kenney: https://www.kenney.nl/Static typing in Godot using the class_name keywordThe Shaggy Dev2021-10-20 | In this video, we'll look at how you can use the class_name keyword to enable static typing for your custom classes. We'll also look at some other uses for it, such as subclassing, and the common pain points people run into when using it (cyclic dependency anyone?)
Intro: 00:00 Base usage: 00:29 Other uses: 01:18 Gotcha #1 - The global namespace 01:59 Gotcha #2 - Cyclic dependencies 02:52Using a Polygon2D node to create physics bodies in GodotThe Shaggy Dev2021-10-12 | In this video, I'll demonstrate how you can use the Polygon2D node to create both static and rigid physics bodies in Godot. This method allows us to create more custom level geometries than we could otherwise get out of a tilemap, but also let's us iterate on designs faster than making an object outside of the editor.
Intro: 00:00 The Polygon2D node: 00:51 Project setup: 01:48 The static body scene: 02:26 The rigid body scene: 03:01 Results: 05:00 Final thoughts: 05:22Animating a hardware cursor in Godot - An experimentThe Shaggy Dev2021-10-05 | In this video, we'll take a look an experiment I wanted to run: using the hardware cursor interface in Godot but animating it like a software cursor. Overall, the results are mixed, but there is some potential here.