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

Fixing a single GSB bug

Step 1:
Where is the game crashing? it crashes here:
void GUI_TitleBar::SetTitle(std::string str)
on an assert
GASSERT(Width > 0);
Width is clearly not set right when we set the title. Cue lots of hunting through every window that uses that code to check that they never set their title when they are yet to set their width. No luck.

Step 2:
Sudden realisation that the window width is a red herring, it’s the titlebar width itself that isn’t set. Sudden discovery that a function in the dialog class is virtual, but the function it supposedly implements is not. Possible confusion? certainly sloppy and needs fixing, but I can’t fix it *now* because I need to know *exactly* what causes this, rather than changing stuff and hoping I found it.

Step 3:
Realisation that the negative width may be an infinite high width wrapping round, which implies width has never been set. Maybe this is why I never see the crash in debug? A check shows that window widths are always set to zero, but that would still trigger it…

Step 4:
Reading up on related bugs suggests something to do with the race changing, combined with the ship editor. Decide to test in release mode deploying, then changing race then going to design mode. W00T! It crashes, although release mode debugging is far from trivial. It looks like a null pointer though, meaning it should reproduce in debug

Step 5:
Reproduced it in debug, which normally means home and dry. A module type pointer is set to 0xcdcdcdcd. This means uninitialised, and this seems to be the case. I’m assuming it is null without setting it to NULL. If it had been set to NULL, then a module would have been selected.

Step 6:
Temptation to fix an obivous unintialised pointer error here, but that would be BAD. The task is to really understand the bug before fixing it. For example, why does this not *always* crash when launching ship design? Lets test… It seems to always crash for me in ship design. That cannot be right…Aha, it’s handily crashing in some code inside the STL library, but only in debug build. A quick check of the shipped release build shows I can’t now replicate the bug there. Even stranger. Could I possibly have shipped a debug executable in a patch, this explaining why not everyone has the issue? No, the file size difference is 3MB.

Step 7:
Tests shows that the same exe does not crash taking the same steps if outside the IDE. The IDE is clearly setting those debug values and trapping an error. Is this actually related to the titlebar error crash and change race crash everyone has? If the module pointer is invalid, all hell could theoretically break loose. Getting tempted now to just fix the obvious errors, at least to see what happens next.

Step 8:
There is just no way that this pointer is correctly set to null. Unless it’s null by happy co-incidence, the game should crash whenever the ship builder is viewed. (if null, the game assigns it a valid value). Adding an assert for this, which still triggers in my release builds. It doesn’t trigger. How the hell is that pointer being set to NULL?

Step 9:
I suspect I am being lucky in release build with this. The pointer is uninitialised and being set to NULL most of the time as a side effect of something else, but this is not guaranteed, hence the randomness of the crash. It’s clear this pointer should be initialised, so I’ll just do that, and move onto new stuff.

Online integration fun

You know what’s missing in GSB?

Yes, yes I know you want a big 4x style campaign game built around it. ONE DAY maybe, but certainly not by the end of the week. One thing that is not quite so huge and unwieldy for a short term project is the area of online community.

Player A reads a forum post by player B, and decides to issue them with a challenge that proves their point that tribe frigates kick ass. Player B is oblivious, unless they happen to be browsing the challenges and spot they have a new one, from that player. Wouldn’t it be much cooler if every time someone issued a challenge to you, beat your challenge, or played (and presumably lost) your challenge, the game knew about it, and collected those messages for you to review at your leisure?

So rather than having to go to challenges, filter by personal and check if anything looks new, you could have a little spangly message popup saying “you have new messages“, on the main menu, and clicking there would tell you what’s new in your world of GSB.

This sort of stuff isn’t *that* evil to code, even though it involves server-side stuff. I already have it all up and running, UI and all, and the server is currently processing messages as I speak (although nobody has  a game version that lets them see them yet. But I can tell that a bit earlier, superneals sent a new challenge to knightsofni, for example.)

This will go into version 1.28. At the moment it’s system generated messages, so you just get pre-defined text messages notifying you of events. If people liek it, I think it would be awesome to be able to win a challenge, then type a message for the person you just beat saying “Ha!, i beat that fleet without even using plasma. I’ve responded with my winning fleet.” of course, you need to be able to block abusive / spam messages, but I’m working on that now. Besides, anyone spamming or being abusive will get the ban hammer :D

Nearly finished supply limits

The long talked about supply limits stuff is all done and nearly ready for the 1.27 patch. That patch has some other stuff like a challenge fix, increasing the taunt to 256 characters, some balance changes and introducing a hidden, not very supported ability to manually edit the maximum zoom out distance.

Anyway, as is usual, when I do my final sanity checks before uploading a patch, I noticed a bug. And then fixed it, and tested again…and again… five times in total. And it’s still not done. The final ‘gotcha’ was the code that displays what supply limits are in place for the current mission. I have to have support for restricting new modules from expansion packs, BUT, the game can’t do it’s normal freaking out if a module can’t be found. So that needs fixing and then testing again… hopefully tomorrow morning.

This is basically phase I of the usefulness of supply limits. I’ve added them to a single mission (gravity well). This means that they will also be  in place for new challenges issued on that map. Hopefully feedback on them will be positive

Phase II will be a new route for issuing a challenge, that will wrap into a basic scenario editor. The data in a scenario is effectively included in a challenge, so I don’t even need to change the challenge format. All I really need to do is code a UI that lets the player pick a map size, the spatial anomalies etc. I already have the supply limits editor done, which is a full screen pop-up dialog. My eventual aim is that people start issuing some cunningly designed challenges with supply limits that prevent the most obvious tank/spam fleets, and encourage some clever and aesthetically pleasing fleets instead.

Tweaking Supply Limits

I’ve been doing lots of stuff around the release of the Tribe expansion pack, so I’ve got behind on work for the next patch. I ended up taking some time to re-balance a few of the least-used weapons, and do some admin stuff, like tweak the challenges code so that it doesn’t show you older challenges in the list when newer ones are available. I also got rid of some really really old challenges. Currently the list only displays up to 1,024 of them, sorted in date order now. That was always enough in the past, now it’s not, hence the tweaking.

Anyway…

I was testing out the new supply limits stuff and trying to ensure it was user friendly at the deployment phase. One of the things I needed was a way to see how much of each supply limit was taken up, and the other was exactly which ships were using up those limits. My current solution isn’t perfect,but it’s a starting point. The supply limits window is on the right, so you can still your fleet. The individual module icon bars now have a feint progress bar as their background showing you how much of that specific modules supply limit is used up. If it turns red, you are using too many and the fleet is invalid. If you click one of those strips, it will highlight the ships in the fleet currently using that module so you can see where you are using them up.

My current thinking is that when I next patch the game, with this functionality included, I will put it in one of the existing missions, so people can see how it plays out (and of course modders will be able to use it). In the lonegr term, this functionality will form part of any meta-game or maybe a map editor that gets done next.

Gratuitous Expansion Pack Released!

Ok, so it’s finally here. The long awaited invasion of the space tree-huggers* is upon us: THE TRIBE!!!!!!!!! bwahahaha

Video!

I’ve never released an expansion pack for a game before, but I think GSB was the perfect game to do so. I have no idea how it will sell. I hope to at least pay back the art costs (which are not trivial). If it does that, then I’m a happy man. Basically this is an extra fleet for the game. In theory this would be moddable, but obviously this way other people will be more likely to also have the same fleet, and it uses the same super talented artist as the others so it has a consistent look. I’m sure there will be GSB players who will buy it immediately, and some who will not see the point, which is fine because that’s what DLC should be about: Options for the player. (someone make some DLC for Company of Heroes. Russian + Japanese + Italian armeis plz)

This doesn’t add any huge gameplay changing features. It’s not the direct-control or 4x meta-game expansion people sometimes suggest. It’s just mroe ships/modules/maps.

That’s not to say some big-ass future expansion that adds meta game stuff or whatever is not going to happen. Who knows where I’m heading next after Supply Limits?

I await the verdict of the interwebs with gritted teeth. At least if people complain about the price of DLC, ‘space armour’ sounds more l33t than ‘horse armour’ surely?

Check it out here:

http://www.positech.co.uk/gratuitousspacebattles/tribe.html

*used in a jovial fashion. I’m a bit of a green geek myself, so I’m not having a go.