DEVLOG 2023-10-14


This week I’ve continued the exploration of GDExtension hot-reloading system. After my patch to it was merged last week, I realized the system was unstable when attempting to reload my GDExtension more than one time. My instinct as a C++ programmer quickly screamed “undefined behavior” after seeing random access violations, weird errors due to weird state, random crashes when closing the editor etc.

I didnt have much time to dig deeper before the livestream (which is now moved to Thursdays, by the way) but I quickly setup a custom debug build of Godot itself, it addition to godot-cpp (the binding library you need to use to make a GDExtension) to prepare my setup for an epic debugigng sessions. In the livestream we spent most of it just debugging that issue and I finally found the actual reason it was crashing, how it went step by step etc. The day after, I redacted a long explanation in a PR, with a hotfix that I thought was bad, so that the main GDExtensoin developer can have all the information to make a better fix. Turns out that my fix was good-enough though he had to tweak it in another PR to go a step farther.

I also spent half a day doing research to help the team of build2, the package manager + build-system I use for C++ in MEGASTRUCTURES, to support the current implementation of C++ modules in Visual Studio’s compiler. They supported the experimental versoin that was provided years ago but not the official one which seems to be complete enough for me to use. I would prefer to use C++ modules for my game because I am fedup with issues of lack of isolation and cleanneess using headers. Obviously there is also the compilation time issue that modules can help with, but in my case for now it’s not a big issue. I’m more interested into the ease of organization and isolation of domains and concerts that the modules feature provides. The build2 C++ modules support for the msvc toolchain will be started maybe in a few weeks so I hope I can test it with the official beginning of MEGASTRUCTURES (aka not-the-prototypes). build2 already supports C++ modules from g++ but I only use that one on linux, and clang++ but it lacks one automatic finding of the standard module to be complete when building on Windows. Unfortunately both compilers are very buggy at the mometn when it comes to modules, but that’s to be expected for such difficult to implement feature. The Visual Studio team were the first to experiment with that and then propose it for standardization so they had an advantage.

So basically this week I have been debugging my gamedev tools instead of progressing on the game, but now I can hot-reload many times my GDEXtension in Godot 4.2-beta2 + the patch, so I’m kind of happy.

Leave a comment

Log in with itch.io to leave a comment.