Problems we faced with Godot 4.1.1 and why we may change game engine


Hello everyone. This is Bernat speaking, the main and sole programmer on the project to explain why certain bugs exist, why Godot actually screwed us over mid game jam and why i may try to develop a tailored made game engine without any fancy features that we don't need as a game.

Before I start butchering Godot I want to point out that this is my experience with the engine and other godot games may or may suffered any problem.

Butterfly effect

So we had a gigantic problem on mid development where, right after i implemented cut-scenes on the game , every time you tried to load a world the game crashed. This was strange because I had no problem on debug mode and in engine but when when i compiled for Release loading and freeing assets would make the game explode. First thing I did to attempt fixing this was looking up the logs and see what failed. Well they weren't very useful to me...

ERROR: 1 RID allocations of type 'N10RendererRD14TextureStorage7TextureE' were leaked at exit. USER ERROR: Parameter "RenderingServer::get_singleton()" is null. at: ~CompressedTexture2D (scene/resources/texture.cpp:1079)

By looking at this error i concluded that something related to a texture was crashing the game but this error code isn't a great indication to that in specific caused this.

So as every programmer does i searched for answers in the forum and google with 0% success rate because other people that had this problem were using an older version of Godot and in the issue tracker said that a fixed was deployed. So i dough deeper, just to find that it did exist a fix for this problem but it was reverted sometime between development of Godot 4. Hours wasted for an answer that didn't help much, but my I wasn't losing hope, i said to myself "Let's make a custom scene loader". Easier said than done I'll tell you that much but i knew i had time to re-invent the wheel since i was waiting for the art pass of the level.

The new "Level Composer"

With a couple days to spare in the programming department, i started on working on this custom way of loading levels. Essentially i used the convenient fact that scenes are just a group of nodes in Godot and that i can simply call "add_child" for any scene, I made it so the Level Composer is always loaded and that it, at any time, knows the game instance and can easily unload that and create a new instance of the level. But not so fast! I as the fortunate man that I am somehow managed to have the exact same problem as before. 

"So it is something about creating that specific world right?", well that was my initial conclusion so i went line by line with the debugger, meaning the game was halted and i was looking at every action that the game was doing 1 step at a time. At that moment there were at least 400 lines of code in total and around 60 nodes to be loaded on the level so going one by one to see witch one had the problem was tedious and a brute way of debugging code, that in this case meant for absolutely nothing! Why well remember what I said earlier? The bug only appeared on the release build not while debugging so checking what happened to every object in the level was for nothing since the editor never outputted that error.

So i gave up. I talked to the team and said something along the lines of "Godot is trolling so we need to release the debug version instead of release". And this is still true for Hotfix 2.

Unexplained crashes

So because of the way Godot was driving me insane over the loading of nodes and the cleaning of destroyed ones, We released with crashes that simply wasn't happening to anyone of the team. Feedback that we received at version one was that the game crashed 3 times and then proceeded to work as expected. 

I don't think i need to clarify this if you're this far but yes it was Godot teasing me with problems that were undetectable by the editor. I discovered that the problem happened if the user was changing window during the loading process. So i applied some multi threading to the loading system and now the crashing was fixed!

High amount of ram usage on low performance hardware

After we submitted the game I asked a friend to try out the demo. Well we discovered that when he was playing the game during the first level the RAM usage was over 2Gb and on level 2 was 6gb!. I was stunned by this because RAM usage is something I keep track of during final stages of a build and on my PC the game was only using 500mb of memory on the first level. Something was definitely up and all my suspicions are on Godot and not my code. And i mean how is a 2d game going to need more than 4gb of RAM past level 1. More importantly how come on my pc my max ram usage was under 2gb. For the Godot gurus I was using compatibility mode as a render if that even made a difference in this case. And unfortunately I still cant determine the source of that problem.

So this is all, phew! I wanted to write about this since while it was frustrating for me, I think it is interesting to look back at the development phase and explain what was the worst part about it. Godot has features that i really like but I hope you reader understand why we are planing on changing game engine or making our own.

-Bernat Viñals (@sangot)

Files

AlienExpress - Jump Ship Jam Version 357 MB
Oct 18, 2023

Get Alien Express

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.