How I fixed the error that came out of nowhere.


So this bug is entirely related to my Steam implementation so is not attached to a patch here. 

OK so the bug started with the twitch streamer Yukiiy playing my game, I had just pushed a patch to improve performance and that went well but when he started a second match the developer consoler spit out a bunch of red and it crashed.

watching the VOD I could make out 'Pool boss' in the error messages so that's where I started, I repeated the bug myself which was a 'pool boss not initialized' basically and read a couple threads indicating maybe other things are trying to spawn before its ready.

I have a couple exp gems on the map so I started by deleting those, and I set the match spawns to not start until after the player has finished selecting weapons to give it time to initialize. 

No dice still getting errors when starting second match can't select the avatar. I figure 'well it was working before steamworks so lets look at that'. I track the problem to the steambehaviour not liking it when it gets loaded more than once, then spend the rest of the night trying to get my scenes to load additively and basically fucking it up because of an underlying problem I'm not aware of.

So today, I used plasticSCM and rolled back to my last build before messing with all that. I define DISABLESTEAMWORKS and disable the steamworksbehaviour object, and test, its working. so I upload that to steam as a build that wont crash.

Then I remove the define, I enable the behaviour object and move it to my loading scene, then I add DoNotDestroyOnLoad to it. I test, and am able to start, go to the game, quit back to menu, starting again fails, but I notice that for some damn reason, my gamecontroller object is also in the 'do not destroy on load' pool, and it persisting between scenes is causing it to break in all sorts of novel and interesting ways.

So I go look at that object, going through its fsm etc, and finally realize that at some point I attached SteamManager.cs to it, and that's what is causing all the problems. I disable it (because I'm always a coward about straight up deleting things) and copy that script to a new object, test and its still failing, but now its because my gamecontroller object is missing (it's getting deleted for having a duplicate copy of the script even though its deactivated). So after deleting the script from the gamecontroller object and moving it to a different one finally I have a working steam build with steamworks.net and heathen KB Foundation also working.

There were at least 3 times in that process where I went 'argh fuck it I quit for now' and just did something else, I always do better after coming back later with fresh eyes.

Leave a comment

Log in with itch.io to leave a comment.