September 2, 2008

Tools of the Trade – Part Five: Pot Pourri

Filed under: Games Development,Tools and Software Development,XNA — bittermanandy @ 11:02 pm

I think that FxCop, Reflector, CLRProfiler, and PIX – all of which I’ve previously discussed in some detail – are the most useful, bread-and-butter tools you’ll use in your XNA development. (In fact, all but perhaps PIX are useful regardless of whether you’re writing games or applications). There are of course many, many more tools, each with their uses, and I’d like to summarise some of them here. The sign of a good craftsman is using the right tool for the job, so I’d encourage you to explore all the different options available to you. Put bluntly, if you’re spending all your time performing repetitive tasks, or going through endless tweak-test-tweak-test cycles to try and hunt down problems in your code, you’re wasting your time. Your time may not be worth a lot to you, but mine is worth a lot to me, so I for one am always looking out for new tools and I think you should too.

Your primary development tool is Visual Studio itself (the Express version of which is available as a free download – possibly the most amazing free thing ever). I’m going to assume you already have it or you’d not be coding in XNA! However, I can guarantee that you are not using it to it’s full potential. I know I’m not. The reason I can make this guarantee is that the full potential of Visual Studio is huuuuuuuuuge. Almost every day, certainly every week, I discover new things it can do and think “that’s amazing!” Start by keeping up with the Visual Studio Tip of the Day, learn how to write macros, take some time to explore for yourself (especially consider keyboard shortcuts), and look out for plug-ins and extensions too. Project Line Counter is a personal favourite.

We’ve already looked at a couple of profiling tools but Perfmon (free with Windows) is the daddy of them all. As an example, hit Start then Run, and type “perfmon”. When the tool loads, select “Performance Monitor”, right-click on the counter list at the bottom and select “Add Counters…”. Select, say, the “.NET CLR Memory” category, then, for example, “% Time in GC”. Choose your game as the selected object and click “Add >>” then “OK”. Hey presto! A line displaying the exact processor cost you are paying for garbage collection will be added to the graph. There are hundreds of counters like this one, and much more that Perfmon can do.

I’m a bit loathe to mention this next one because, frankly, I hate it, but there are some bugs that can only be identified using WinDbg (or “windbag”, free with the Debugging Tools for Windows). Running out of memory and not sure why? Take a memory dump of your game, load sos.dll, call !DumpHeap -stat to see what’s live on the heap, call !DumpHeap -type <type> on the most memory-expensive type it lists to see all the items of that type, and call !GCRoot with the address of one of those objects to see exactly what is keeping it in memory and why. Sometimes there’s just no other way to work out what’s happening to your memory. WinDbg is an advanced tool and it’s an absolute swine to work with, but if the debugger in Visual Studio can’t solve your problem, WinDbg will.

I previously wrote about Reflector and described how it can reveal any assembly’s code to you. How does the code you write get translated from C# to the CLR and IL, and finally JIT-compiled into machine code? Well, I can’t help you with the JITter but IldAsm (free with Visual Studio) can provide a fascinating insight into the Intermediate Language stage of your code’s existence. Much in the same way that you don’t need to understand assembly language to write or use C++, but knowledge of assembly can help you fine-tune your C++ and fix the really tricky problems, knowledge of IL and an understanding of the translation process – while not essential – will make you a better C# programmer.

There’s a whole bunch of tools that are a bit more specialised or esoteric:

Perforce is absolutely the best choice for source control. I can’t live without Perforce now, it’s as though it has become a part of me. It’s free for up to two users, though very expensive for larger teams than that (absolutely worth it if you’re a professional company, perhaps less so if you’re a group of hobbyists, in which case try Subversion).

– If you’re a pro developer and aren’t using continuous integration, you face months of torment in an endless death-march of crunch at the end of the project. Do yourself a favour and use CruiseControl .NET (free).

– Continuous integration becomes even more useful when a build is run against a set of unit tests, and in fact they’re useful for finding mistakes early which is good for anyone, pro or hobbyist alike. I’ve heard good things about NUnit (free)… do as I say, not as I do, and use it… not doing unit testing is my worst programming habit that one day I will get out of. Don’t fall into that trap.

– Perfmon can tell you when you’re slow on the CPU and CLRProfiler can tell you if it’s garbage at fault, but if not and you want to know which specific functions are slow (and you very often do!) NProf is the tool for you, and it’s free.

– Finally, I’ve not used it yet but RPM (Remote Performance Monitor for Xbox, free with XNA) looks to be pretty damn useful for working out why you’re running fine on PC but slow on 360.

The best thing about all of these tools? Like XNA itself, they’re all free. That’s the kind of money I’m OK with spending! It means you have no excuse for not becoming familiar with them and, hopefully, rather than staying up bleary-eyed until 5am trying to find the bug in your code, you can fire up the appropriate tool, find and fix the bug and be home in time to see your family and get a good night’s sleep. Everyone’s a winner!

There’s only one major category of tool I’m missing, and that’s a decent bug database. I’ve tried Bugzilla and OnTime, and at work we have to use Sunrise, and I hate all of them as well as some others. By far the best defect tracking system I used was Product Studio, when I was at Microsoft, but despite being brilliant it is only available with the Team System version of Visual Studio which is very expensive. If anyone can recommend a good, usable, simple bug database that is not web-based and has a good UI, please let me know.

In fact, undoubtedly many of you out there will have your own favourite tools. Why not share the love, leave a comment and let me and everyone else know which tools make your life easier?

“If the foreman knows and deploys his men well the finished work will be good.” – Miyamato Musashi



  1. Good post as usual. The bug tracking thing is a pain for me too. i use assembla at the moment which isnt so bad, i used to use a product called gemini which was very good, i might get around to installing it again at some point

    Comment by Conkerjoe — September 3, 2008 @ 10:25 am | Reply

  2. I have access to both Visual Studio 2005 Team Suite and VS 2008 Team suite at my university, but neither includes Product studio as far as i can tell?

    Comment by Caion — September 3, 2008 @ 7:53 pm | Reply

  3. I think it depends on the version of VSTS (there are several different versions of each; MS did an astounding thing by making VS Express free, but made the other available versions more complicated, perhaps to make up for it).

    Or, possibly, I’ve got my wires crossed somewhere? If it’s *not* in VSTS already, MS should hurry up and release it publically tout de suite, because it’s brilliant. (In fact they should release it in its own right so the rest of us can use it without paying for Team System).

    Comment by bittermanandy — September 3, 2008 @ 8:29 pm | Reply

  4. Great series of posts, and I should also thank you for releasing the code, which I’ve found pretty invaluable.

    Another couple of tools I’ve found invaluable for shader development are ATI’s Rendermonkey and NVidia’s FXComposer. Both great for shader experimentation and for large libraries of ready-to-use shaders which you can export and with minimum fuss get working in your own game. And both free!

    Comment by Nick — September 3, 2008 @ 9:31 pm | Reply

  5. For source control, I’ve become a big believer in distributed version control systems, which provide a lot of added flexibility that you don’t know you are missing until you start to rely on them. Git has become all the rage lately, but Mercurial is a good choice and I, for one, prefer Darcs to both. Darcs ( has an amazing best of breed interface that (IMHO) is hands down the best command line interface of any source control system (ever). It’s interactive selection tools alone have spoiled me.

    @bittermanandy: From Wikipedia skimming it seems that issue tracking requires a Team Foundation Server, not just VSTS.

    Also, this may or may not be helpful in finding a good bug/issue tracker:

    You aren’t going to find very many non-web-based options, particularly in free/cheap where web-based is the easy and clear route to a collaborative environment. If you truly want a non-web-based most likely you’ll have to roll your own in say Excel or Access… InfoPath with Outlook, SharePoint, and/or Groove might be an interesting toolset to consider for roll-your-own issue tracking.

    Comment by Max Battcher — September 4, 2008 @ 7:53 am | Reply

  6. Mantis is the best bug-tracker I have worked with, I know this one is web-based but that is not a bad thing. is it??

    Comment by cesar — September 4, 2008 @ 1:59 pm | Reply

  7. FogBugz is a great issue tracking tool. Cheap (not free).

    Comment by Zyxil — September 4, 2008 @ 5:22 pm | Reply

  8. I’ve used Mantis (it’s in the Wikipedia article linked by Max Battcher) for a while in the past and found it pretty good.

    Also since you are recommending NProf as a profiling tool, I wonder if you’ve ever tried the built-in profiling tools of VS2005/VS2008? And if you like NProf better then the built-in tools, why.

    Comment by Jeroen-bart Engelen — September 4, 2008 @ 6:01 pm | Reply

  9. Hi,

    Shame to not see any new posts here for over a month now, as I’ve found this blog an extremely useful source of info. I do hope this is only a temporary situation and not down to loss of interest/lack of new ideas… Hopefully you’re busy working on Pandemonium if nothing else?

    Anyway, thanks for all the great info.

    Comment by Chris Vaughan — October 10, 2008 @ 9:39 am | Reply

  10. Thanks for the kind words Chris. Rest assured – the lack of activity is entirely temporary! The blog will be back.

    I promised myself when I set out that I wouldn’t be one of these people who blogs for four weeks then nothing, then lots of posts for four weeks then nothing, etc. Sadly I seem to have slipped into just that pattern!

    I can’t pretend to be TOO apologetic though – my reasons have been good, and without going into too much detail because it’s personal, I’ve simply had other things taking up my attention. They’ve been good things, entirely 100% positive things, but also things that have taken priority over coding for a while.

    While you’re waiting, feel free to talk among yourselves. 🙂

    Comment by bittermanandy — October 10, 2008 @ 8:56 pm | Reply

  11. Don’t forget Whole Tomato’s Visual Assist, an add-on that extends VS in lots of ways. Probably more useful for C++ but still good for C#.

    Comment by Martin Rennix — October 24, 2008 @ 8:43 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: