HubbleCommand.github.io

Personal blog, project documentation, and ramblings

Godot - Overview

2024-01-13

last modified 30 Jul 2024


tags: gamedev - godot

Godot, at this point, is a very popular FOSS game engine.

Comment
byu/Salt-Trash-269 from discussion
ingodot

Child Pages

Godot Resources (useful for learning)

Mobile Controls

Directional Sprites

Geometry Operations

Image Rotation

Engine Contributions

Building the engine is easiest done with scoop, see the first note here

Important Godot pages Contributing Code Best practices Engine Development PR Workflow

Before starting a project

There are two very important quotes

Comment
byu/ContentAspect6148 from discussion
ingodot
Comment
byu/Caldankis from discussion
ingodot

Before emarking on any large project, I recommend watching the following videos. It’s very important to understand the scale of a project as well as your own skills, and time you can commit, to avoid burning yourself out.

Failing at GameDev

Starting

To my recent surprise, when I tried to fork Godot, I discovered that I already had a fork. I must have forked it years ago to contribute, I’m pretty sure to add some image rotation improvements, but life got in the way.

Life has, expectedly, gotten in the way again, and this is only being worked on a little bit months later…

Certainly surprising to find that I was behind by 14’000+ commits! image tooltip here

Fixing Common Issues

External editor

It’s possible to setup an external editor for code.

This allows setting the Godot editor to run in only one window, which makes it faster.

“Corrupted” global class cache

Had the following error while developing a plugin:

 Attempt to open script 'res://components/screen_gesture_decorators/screen_gesture_decorator.gd' resulted in error 'File not found'.
  Failed loading resource: res://components/screen_gesture_decorators/screen_gesture_decorator.gd. Make sure resources have been imported by opening the project in the editor at least once.
  editor/create_dialog.cpp:237 - Condition "scr.is_null()" is true.

I eventually stumbled upon this issue, and the fix is to go to the project directory, then to .godot/global_script_class_cache.cfg

list=Array[Dictionary]([{
"base": &"Control",
"class": &"ScreenGestureDecorator",
"icon": "",
"language": &"GDScript",
"path": "res://components/screen_gesture_decorators/screen_gesture_decorator.gd"
}])

Then remove the problematic entries.

Unit Testing

It’s generally not worth it. The following comment sums it up:

Comment
byu/ObscurelyMe from discussion
ingodot

The same goes for software in general. If test cases are hard to define or difficult to run tests for, i.e. if the result is something highly visual, dependant on many factors (i.e. game state), and/or subjective, then it most likely doesn’t make sense to unit test it.

Assets

1 2

Making plugins

See this page for making assets / plugins.

The best place to start making custom nodes is with the corresponding documentation

Good reads for understanding how Godot’s class system works:

Problems

My main gripe with the Godot Asset Library and the whole package system is that while addons usually exist in the addon directory, they are actually dropped into the root of the project. This has resulted in files being overwritten in my own project.

There have been discussions about this in godot proposals.

That discussion is marked as fixed by this pr, so I’ll need to see what’s changed.

C++

GDExtension

documentation.

If you want to add custom nodes with a C++ implementation, then GDExtension is the way to go. Note that there are limits, notably in terms of APIs. This is effectively

If you need to do something else, read below

Adding to the Engine

You can add to the Godot engine itself by either adding or modifying the core itself, or by adding a new module.

Modules

If your code isn’t a node, and doesn’t modify the core, then you should use a custom module

It’s an interesting way to add binding to external libraries