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

That steam stutter bug, and tracking it down…

Right from it’s initial launch on steam, there was a bug reported in Gratuitous Tank Battles for a tiny subset of steam players. The bug was basically that the game ran horribly slowly, with stuttering and skipping music.

Regular blog readers will know I am a bit obsessive about optimisation, so naturally this seemed weird to me. Right from the start I doubted that this was actually the games graphics engine or core gameplay code running slow. Not given the specs of the users reporting it, which was a wide cross-section of hardware types. Happily, this was confirmed by the realisation that running the game from the .exe, outside of steam, enabled it to run perfectly. A good workaround, but not actually a fix.

This was followed by weeks, maybe even months of me investigating what on earth it could be.

Initially, I assumed it must be something about the steam integration code. So that resulted in a ton of going through it with a fine tooth comb and checking every parameter, asking valve if I was doing it right, checking with other devs how I was doing it compared with them etc. I ended up moving the code that initialised steams systems from one point in my code to another, as they recommended, but there was no change. I also changed a callback to run every 100 frames rather than every frame, and again, no difference.

Then, finally we found some helpful players who not only had the bug, but were happy to run diagnostic code on their PC for valve to analyze. A very helpful guy from valve then crunched through it, and found that an alarming amount of time was spent in the sound library, and in Heapvalidate(), called from it. This then led to another 48 hours of me looking at heap validation code, memory errors, installing xperf, the application verifier, trying (and failing) to download Microsoft platform SDKs, lots more poking and prodding…

and then eventually  I got a reply from the sound library people suggesting that yes, it *might* be their code occasionally calling HeapValidate() all the time, and to upgrade to the latest build.

So I did that and it has fixed it…(afaik)

How annoying. The one piece of code in the game not written by me, and it had a bug in it! At least it’s fixed now, so all is well. I bet my code has bugs too :D We still don’t know why it was actually caused by the interaction of the game with steam, but that just seemed to be the randomish trigger for the errant memory checking.

I have a new ninja PC on order. I dread re-installing anything. Is there a magic new way to do this, or will I sit there downloading and installing stuff for 2 or 3 days again?


11 thoughts on That steam stutter bug, and tracking it down…

  1. The only way I’ve managed to avoid doing a massive reinstall of all my software when moving to a new PC is to close the drives from the old PC and put them into the new one.
    Haven’t tried this in a while, so not sure how well it works with Win7 (assuming that’s what you use), but with XP and older it only worked when your new motherboard was from the same family as the old one

  2. You can save the time of downloading by temporarily hooking up your old drive as a secondary drive on the new computer and running the installs from there. Assuming you saved the downloads in the first place! If you do, be sure to copy the files to the new HDD for the next time.

    I actually keep a copy of all important downloads on my file server so they’re accessable from any PC on my network. Storage is cheap, time is expensive.

    Can’t help on the install time though.

  3. Be careful, usually short-cuts end up being long-cuts. Keep your documents ready on an external drive and installers ready.

    So does this mean you get to use your desk tower cabinet?

  4. Just transfering the hard drive should work, but Windows tends to throw a tantrum when you do that. Hopefully it should let you re-activate Windows, but I can’t guarantee it. Also other software like the Adobe Master Collection doesn’t seem to like it either.

  5. It’s 1 pc. do the sensible thing: reinstall. If you just use an image tool or god forbid, just swap the old disk in, you will run into all the quirks and probs which your old pc also had. and which made you decide to buy a new one!
    and lets not forget the possible driver/registry hell.

    sysprep is all good and well but setting it up(make image, “clean” image, search new drivers, enter drivers in image, reenter code, etc etc etc) for 1 pc… it isn’t that much faster than just a simple reinstall..
    This was true in the Win9x era, and unfortunately still is.

    I want my Gratuitous Dragon Battles (or whatever you come up next) somewhere in this decade, and that means that you cannot be stuck in driver hell for to long! ;-)

  6. PLEASE dont try and transferr your installs (apps) across
    start FRESH. I work in a pc store and some people that transferr windows etc, always have trouble down the road.

    Do you want the next game to have lots of bugs because some old driver is kicking about in your windows that shouldnt be there (eg a sound driver for the wrong chipset of your motherboard)

  7. There was one good thing about DOS over Windows. DOS never gets gummed up like windows OS’s do. I swear the philosophy of ‘keep it simple stupid’ got lost somewhere trying to get customers lock in. It’s pretty sad that after decades systems still slow down and install all sorts of nonsense and services. They never try to keep themselves contained and isolate themselves so that the system remains smooth.

    DOS definitely had its good points (in terms of migration) that I miss with the advent of windows.

Comments are currently closed.