Game Design, Programming and running a one-man games business…

Ho! Ho! Doh!

There was a bug in Gratuitous Space Battles: Galactic Conquest until today. It was a bit obscure, and very baffling. Basically, in seemingly random circumstances, regardless of file version, people would develop a bug where the campaign backdrop was just plain white. I could not reproduce this. Re-installing seemed to fix it, for *some* people.

Anyway, someone noticed when I asked about it, that a line in campaign.txt storing the background texture name was missing. They had the latest version, and I KNEW that line was in there. It made no sense. Then they noticed that they could paste that line in, when the game was running, and voila, it worked. How weird.

So I looked at my code, and sure enough found some code which overwrites campaign.txt. Old, boring, unused, debug code for doing the campaign editing from about three months ago. This was before that file had this line in it, so because that code had never been updated, it meant that whenever it ran, and  saved out campaign.txt, it overwrote it with a new copy that had no data for the background texture (it used to be hard coded).

What a dork.

But even worse, I had left in this debug code mapped to the ‘H’ key (S was in use), and never remembered to remove it. So if anyone ever pressed ‘H’ during the campaign, it ran.

What a huge dork.

Anyway, it’s gone now. The bad news is, I am obviously a clueless muppet who could not code his way out of a paper bag. The good news is, I fixed this on Christmas Eve. Hurrah! It’s in patch 1.54, you will get it today / tomorrow.

Happy Christmas / Holidays / Festivus / Ascension of Kahless day to everbody!


8 thoughts on Ho! Ho! Doh!

  1. I’ve still got the white background with 1.54 :-( Do I have to uninstall and reinstall to fix it?

  2. To fix it, paste this line into the ‘config’ section of /gratuitous space battles/campaign/data/campaign.txt

    MapTexture = “campaign_map.jpg”

  3. Unfortunately, that line was already there.

    Nevermind, I did a little debugging myself and found that the file it was trying to read was in “%LOCALAPPDATA%\VirtualStore\Program Files (x86)\Gratuitous Space Battles\campaign\data\campaign.txt”. It looks like Windows helpfully decided that GSB wasn’t allowed to write to its own program folder and squirrelled away the changes it tried to make there instead. Deleting that whole GSB folder did the job.

  4. Happy Christmas, have asked for the Gratuitous Space Battles Collectors Edition, i hope this makes your christmas just that little bit more special :)

  5. Also, Merry Christmas, and thank you for patching your games on Christmas Eve and commenting on Christmas day :-) We all very much appreciate it!

  6. When I add debug/temp/code in my code, I always put a comment like
    // shit

    so, time to time I check if I didn’t left some shit in my code :)
    easy to retrieve, and yes, like you I did left some unwanted code running, it does happen to everybody. Just remember/force yourself to add a comment easy to find.

Comments are currently closed.