June 30th 2021 by SDGNelson
Anecdotes from the past month of gamedev.
This feels like a monthly report to my boss (the Unturned community). "Uh oh what did I work on again? I promise I was not being lazy!" Though I did play a lot of Frostpunk after picking it up on the Steam summer sale.
Unfortunately there was no clear winner of the character design debate. There has also been a lot of mixed feedback on which project to prioritize. I did focus on Unturned II for a chunk of the month, but my interest shifted to some Unturned improvements I was feeling excited about (detailed below), and I spent more time on my side project than usual.
Over the years I have enjoyed prototyping small demos on the weekends. I find it helpful for learning new techniques, and of course it is a lot of fun. These past few months I have actually stuck with a side project, to the point that it is almost feeling like a real game. Before Unturned first launched in late 2013 I released small games all the time, so this has been invigorating to work on. I wanted to give some heads up in case I do decide to release it as a small free game to avoid disappointing you. While not particularly innovative, it has also been a good test case for using the entire Unreal pipeline in a full game.
This month I felt sort of randomly enthusiastic about improving Unturned's build process. i.e., improving how the source code and assets make their way into a playable "build" on Steam.
Despite having some automated testing on another machine for the past few years, Unturned's asset bundles and code have always been built and uploaded from my personal desktop. This usually took at least an hour, plus another hour if the asset bundles needed to be rebuilt. For patches this really sucked because there was a big delay from reports to uploading a fix, and if another problem was found while building the fix it had to be restarted.
Now the iteration time between committing a fix, building asset bundles + code, running automated tests, and uploading to a Steam beta branch is 9 or 10 minutes. I am sure there are other games with faster cycles, but I am really happy with this workflow improvement so far. *though a big part of this is from doing the builds on the Unturned II build machine which is a much newer CPU than my desktop.
One improvement which almost doubled the speed was reducing Unity build target changes. Previously the build target went Linux, Mac, Windows for the player and then Linux, Mac, Windows for asset bundles. Exporting the asset bundles before changing to the next player target is obvious in retrospect, however before these improvements I only re-exported them as necessary because it took so long.
To facilitate easy Steam uploads I added an editor tool for running Jenkins parameterized builds, or requesting the upload in a commit message body. The build machine checks for either of those to know whether to run the Steam upload step, and which beta branch to upload to. I also automated installing SteamCmd into the project's Library folder and generating the build .vdf scripts, whereas before they were an odd mixture of hand editing and text replacement.
Looking through the build logs also alerted me to some ridiculously large uncompressed textures! One texture file for the Elver Nightraider skin was almost 3% of the game's install size.
Some issues with the 28f1 Unity LTS update prompted me to add a step for dirtying / resaving all assets in the newest version. There were assets which had not been touched since 2013-2014, so kudos to Unity for keeping backwards compatibility with those.
Other Interesting Cleanup
There were a surprisingly high number of places in the code using conditional compilation for file paths. For example checking whether it was a Windows development build for the experimental branch. I tidied up most of these and will get the remainder this coming week. Most of the complexities were because of Unturned's non-Unity assets (e.g. the .dat files) which are not copied into builds. For some longer-term modding plans I wanted to tidy this up, so the really easy solution was to search up the file hierarchy for the Unity project (if any) in development builds.
It would be nice to upgrade Unturned to Unity's newer "assembly definition" system. Sadly the asset bundles would lose references to Assembly-CSharp types until rebuilt, and I am not aware of any way to redirect these, so it cannot be done for the core game code without breaking mods until whichever Unity update mandates rebuilding asset bundles again.
In the meantime I have been untangling dependencies to separate non-MonoBehaviour features into their own assemblies. Two great candidates for this were moving System extension methods into an assembly, and Unity extension methods into an assembly which can depend on the System extension methods.