Lead Developer, Stardock Entertainment
Debugging without breakpoints
Published on December 13, 2005 By CariElf In GalCiv Journals
Hey all, I know it's been awhile since I've done a dev journal, so I thought that I'd take the time to do one while I'm compiling. Some of the bigger changes that I made for Beta 4 were to improve performance. I spent some time with BoundsChecker tracking down memory leaks. The nice thing about fixing memory leaks is that often fixing one will fix others, and fixing memory leaks fixes problems that they cause. For example, a lot of the memory leaks were in the graphics code. When you leak textures and other graphical resources, you start filling up video memory and that can blow out the video memory. I got a lot of the memory leaks, but I'll have to run BoundsChecker more when I get a chance. The bad thing about debugging with a program like BoundsChecker is that it really slows down the game so it makes testing other things more difficult, so you can't just always run with BoundsChecker turned on.

BoundsChecker, at least, makes it a lot easier to find memory leaks. One of the other things that I had to do for Beta 4 was find out why there was lag on screens like the Ship Design screen and the Planet window. It was a lot more obvious in debug than it was in release, but it was something that needed to be fixed. This problem has been around for awhile, and I had done some cursory testing awhile back so I knew that it had something to do with the mouse messages. I had to go into the code that handled mouse messages and try to figure out what was going on by reading the code and putting in debug messages. Eventually, I figured out that there were a bunch of strange messages being sent to GC2's message loop and that were being passed on to the default message handling code. I couldn't figure out where the spam was coming from, but they were definitely not in the range of our custom application messages. So I put in a check in the message handling code so that it would only process messages within the range of messages that GC2 needs, and I let the rest go to the default Windows message handling function. Sure enough, as soon as I ran GC2 again with my changes, the lag was gone and my framerate had even gone up.

Bugs involving memory and messages and other things that affect performance can be annoying to track down, but fixing them sure gives you a feeling of accomplishment.

Comments
on Dec 13, 2005
Glad to see that some companies still try to optimize for the best performance.
on Dec 13, 2005
Agreed. And to see that optimization happening before release, rather than in the third patch.
on Dec 13, 2005
Amen
on Dec 13, 2005
It would have been nice if the kind folks who built Civ4 did more bug fixing before release (arg!). Thanks, CariElf for putting users first.
on Dec 14, 2005
What's wrong about Civilization IV? (I havn't gotten it yet.)
Maybe they just ran out of time.
on Dec 14, 2005
Maybe they just ran out of time.


I'd rather a game with few bugs 6 month late than one with alot that is on-time but thats just me. I mean Goldeneye 64 was delayed like 10x but it was amazing and worth the wait.

on Dec 15, 2005
Civ4 had to go when it was called for by its publisher. That's just how it is. As for what's wrong with it... well, it went out the door without being optimized or even working on about 50% of all the contemporary 3D cards. Firaxis has been addressing that since. Optimizations and fixes to let it run, or run better, on customer's PCs.

Well, I bet all this retail carrying for GC2 will limit Star Dock's capability to slide back their "retail" release. However, they seem very on-track towards making a great product for the retail, and they really do support their products well after "retail" release. So no worries as far as I can see for Star Dock.
on Dec 16, 2005
Civ4 had to go when it was called for by its publisher. That's just how it is. As for what's wrong with it... well, it went out the door without being optimized or even working on about 50% of all the contemporary 3D cards. Firaxis has been addressing that since. Optimizations and fixes to let it run, or run better, on customer's PCs.


At least they tried to deal with it...
on Dec 16, 2005
oh... Yeh... i possess a copy of civ IV (Special Edition bought it in eBay) it is not without its Bugs and errors though (i did not play past civs)it seems to a great game if not for the slow downs and a few buliding Movie Crashes (very annoying)
on Dec 16, 2005
Nice to hear from you again, CariElf! I feared the worst!