Development Update #10

Haunted: Attack of the Dead Men

Inspired by the most epic and little known battle of the Great War, Haunted: Attack of the Dead Men puts you in the middle of a chaotic fight for your life against hundreds of resurrected Russians. Put your arsenal of 8 weapons to good use through 14 levels as you rid the world of this nightmare...

Hello everyone! Welcome to the tenth development update for [i]Haunted: Attack of the Dead Men[/i]. It's been a very busy month trying to get the game running properly on the latest version of Godot, however you will probably have seen by now that I managed it in the end with the release of v1.3.0 and v1.3.1 of the demo last week. I've decided that this month I would go with a more technical and behind-the-scenes update since there isn't as much to show off in terms of new features. I will finish off with a teaser for Map 10 and a brief update on what I will be working on next month. Without further ado, let's get into it! [h3]A Mammoth Undertaking[/h3] So, if you weren't already aware, [i]Haunted[/i] runs on the Godot game engine. Previously, I was using v3.5.1, however v4.0 of the engine has been out for some time and came with a number of significant changes and improvements so my intention since the start of the project has always been to upgrade to v4.x at some point (although I overlooked this in [url=https://steamcommunity.com/games/2157920/announcements/detail/3641759292685760106]the roadmap[/url] back in February), and with the release of Godot v4.1 (a more stable and polished version compared to v4.0) I decided the time was finally right to go through with this upgrade. So, how did that go? Well, the Godot developers kindly provide a converter tool that can do much of the boring stuff for me (for example, renaming methods, variables and classes that have changed). Once the tool had done its thing, it was time to open the game up in Godot 4 for the first time! [img]{STEAM_CLAN_IMAGE}/42968542/9166aa88c4f5f7187398c7d660caaef08c34820c.png[/img] Well, that was to be expected. 164 errors and 66 warnings, so there's a lot of things that need fixing. A few days of fixing later... [img]{STEAM_CLAN_IMAGE}/42968542/7a62d1c7594af0534c71610f8ed98d50a68e541f.png[/img] Still some way off being done, but an improvement. Can we actually run it now? [img]{STEAM_CLAN_IMAGE}/42968542/58b9e01788e55a9c28e35029538f4fe2a3f70bba.png[/img] Hmm, kind of. The menu is working but it looks a bit off - where did the clouds and the fog go? Well, whatever. Does the game part work? [img]{STEAM_CLAN_IMAGE}/42968542/b285ae2a8c5fa54db950fe6352609cf873ad5307.png[/img] Nope! It looks like there's some more errors to fix before the game will work. A few hours later though... [img]{STEAM_CLAN_IMAGE}/42968542/11e418a02d9d279562528afb713e7e40fa240123.png[/img] Oh. Well, Map 1 loaded up OK, but I'm stuck in the middle of it. Let's fix that and try again... [img]{STEAM_CLAN_IMAGE}/42968542/b2cdb3f5474147af655bfbf6da9bfb4eb1b7d643.png[/img] Hmm, OK. There's some sprite issues which will be easy to fix. But wait... [img]{STEAM_CLAN_IMAGE}/42968542/0e6d89d643a4f12d94f9c271431add4684553d34.png[/img] Where did everything go??? Ah. Turns out some optimisation code that I had added to make the game run better in Godot 3.5 was no longer working properly. I fixed that and most things seemed to be working again. [img]{STEAM_CLAN_IMAGE}/42968542/97b293d6e4ca8d8ae0a21d781067dbdfd208199d.png[/img] I will skip over most of the other fixes I was working on as these weren't particularly interesting, and at this point I was focusing on getting Map 9 working again for [url=https://steamcommunity.com/games/2157920/announcements/detail/3684556169290728526]last month's development update[/url]. However, once these smaller fixes were done there was still an elephant in the room... [h3]Performance Improvements[/h3] I've talked a lot about how Godot 4 was supposed to bring performance improvements. This was largely based on the fact that Godot 4 uses Vulkan for rendering, whereas Godot 3 uses OpenGL 3 which is quite old at this point. So you can imagine how alarmed I was when I tried running Map 4 (possibly the most demanding map in the demo) and got this result. [img]{STEAM_CLAN_IMAGE}/42968542/42fb817280e2e4877b8d54ef3637604747d0d10a.png[/img] The performance was all over the place! What made it worse was that I was running this on my desktop, which has a fairly beefy GPU in it. Something was very wrong here as the game shouldn't be dipping below 60 FPS on my hardware. After doing some debugging, I actually found the answer was not what I expected at all - it turned out, the optimisation code I had added to get the game working smoothly in Godot 3, was actually making things a [b]lot worse[/b] in Godot 4. I removed pretty much all of this code, and this happened... [img]{STEAM_CLAN_IMAGE}/42968542/40eb5f65c733ae29bcb0f6c0ff82e3b494724354.png[/img] The performance is still a bit inconsistent, but I had to disable the frame rate cap to record this. The new peak performance was not 60 FPS now, it was more like 160 FPS. Part of the reason for this was that some of my optimisation code was trying to achieve what Godot 4 already does out-of-the-box, and so it was fighting with the engine instead of working with it. But wait, something still isn't right. Why do the lights look weird here? [img]{STEAM_CLAN_IMAGE}/42968542/4a8f9154ee499fab588daaa6fc5f15a8bfdbaf3a.png[/img] After doing some digging, this turned out to be a similar problem to one that I tried to work around in Godot 3. Essentially, there is a limit on how many lights can cast shadows at the same time, and if this limit is exceeded the lights start rendering incorrectly. In Godot 3, this limit was only 8, so my previous code tried to work out the 8 closest lights and only enable shadows on these. However, this constant sorting of hundreds of lights was partly responsible for the bad performance I had seen before. Luckily, in Godot 4 the "light limit" was around 44, so knowing I would probably never have more than this too close to the player at any time I thought of a cleverer piece of code that could turn off shadows for far away lights without doing any sorting at all... And then this happened. [img]{STEAM_CLAN_IMAGE}/42968542/880644c5b118818460e71257eeabf9ddf10ea696.png[/img] [img]{STEAM_CLAN_IMAGE}/42968542/2cadbb95bf001c15b5a0a8ef40678fd6db626302.png[/img] Not only had I fixed the lighting issue, performance had seen another significant jump. The peak FPS was now well over 200, and the frame rate actually looked more consistent while playing. It was at this point I knew the v1.3.0 update was nearly ready to release, and just needed a bit more polish. [h3]The Save System[/h3] One last thing that needed looking at before releasing the update was the save system. If you played the game before v1.3.0, you probably saw the warning about old saves being incompatible, so here's the explanation for that if you are interested. I knew that saves were going to be problematic as there have been some variable renames which I would have to account for if old saves were going to work. I figured that while new saves would work fine, old saves would fail to load. And again, Godot surprised me. What actually happened, was that while the Godot 4 version of the game was fine loading old saves from Godot 3, it instead failed to load new saves! It turns out, the saving code was making some bad assumptions about how the maps would be set up when loading, which used to work fine but didn't any more due to some internal engine changes. I realised fixing this would also break loading, so it would no longer be possible to load old saves either. There was a more significant issue here though. This was being tested with my "dev" build of the game, which uses a text-based format for the save files so I can debug issues with them. However, in the exported game the saves are encrypted in a binary format (so you can't cheat). This encryption is an engine feature, and unfortunately this has also changed, so the Godot 4 version of the game actually can't read the files saved by the old version [i]at all[/i]. [h3]Finishing Touches[/h3] With all of that done, the v1.3.0 update was getting closer to being finished. I showed off some of the new graphical effects last month, such as the new decal-based blood and the new fog. [img]{STEAM_CLAN_IMAGE}/42968542/0245db24c026569ce1b7b2e80c9d48e229daf07a.png[/img] [i]An interesting side-effect of the decals - they also "painted" the barbed wire red! I thought this looked pretty cool[/i] I also mentioned some physics problems last month, including the ability to jump through ceilings. Once I'd switched to the Jolt physics engine, I found out that this was my bad. Turns out I was calculating the player's collision shape wrong! [img]{STEAM_CLAN_IMAGE}/42968542/b57b59746a0c9affcc1c55665e3bdeb8d6ff9ebc.png[/img] [i]This required an out-of-body experience to fix...[/i] So, it was finally time to try exporting the project. Wait a minute... [img]{STEAM_CLAN_IMAGE}/42968542/4eec32845a660e72014d44bd5de9f21aa009f1ca.png[/img] Where did the fog go??? It seems I ran into an engine bug here. The fog only shows up if there is a directional light (which comes from the moon in [i]Haunted[/i]), but for some reason if one scene doesn't have this, then the fog remains broken even [b]after[/b] changing to a new scene. In the exported build, the "logo" screen shows up first, which didn't have a sky or moon present so I had to add them to fix this awkward bug. And that concludes the adventure I had upgrading the engine to Godot 4. [h3]What's Next[/h3] It is safe to say that the game has had quite an upgrade in terms of the visuals now. The screenshots and trailers are quite out of date as a result, so it's about time I updated them. Because of this, I've decided that not only will I revamp the Steam store page, I will also be releasing the game on [url=https://itch.io/]itch.io[/url] to serve as the official "DRM-free" version of the game. I won't do this just yet as I would like to finish at least one more map first, and I have made a start on Map 10. However, I have encountered a few more engine problems which make it difficult to work on this map at the moment, so instead Map 11 will be the next map I will complete before spending time on the new store page(s). That's it for this month. Before I go, I will leave you with a teaser for what will come next in your fight through Osowiec... [img]{STEAM_CLAN_IMAGE}/42968542/7a62d324d2666f938211eff53bdf783129477635.png[/img] [i]Someone isn't happy that you killed his protege...[/i] Thanks for reading!