Gavin Pugh - A Videogame Programming Blog

XNA/C# Articles

This is simply an index to collect together the XNA and C# technical blog articles I have written. Since I blog about other topics too, I thought it’d be a decent idea to keep these specific posts together here. It also serves as an good starting-point for anyone who has never visited my blog before, but is only really interested in my XNA and C# content.

Xbox 360 / Compact Framework Specific

  • Thread-local storage on Xbox 360
    Details a fast cross-platform method of implementing Thread-local storage. Includes profiling comparisons against Microsoft implementations.
  • [ThreadStatic] attribute is broken on Xbox 360
    With the upgrade to XNA 4.0 the [ThreadStatic] attribute was made available to the Xbox 360. However things are not always as they seem, this attribute actually does nothing whatsoever on the Xbox.
  • Changes in the Xbox 360 Compact Framework
    XNA 4.0 brought with it some changes to the Compact Framework used by the Xbox, largely in an effort to bring things in line with the Windows Phone and Silverlight. This post has a full listing of the changes made since the last XNA 3.1 Compact Framework.

StringBuilder and String Garbage

  • StringBuilder changes in XNA 4.0
    With the release of XNA 4.0, a technique I described in a previous blog post to get direct access to the String object of a StringBuilder, stopped working. This article looks into why that is, and goes over the state of play on the three supported platforms.
  • A garbage-free StringBuilder Format() method
    A natural progression from the proceeding article about avoiding garbage with StringBuilder. This post details an implementation of Format() which generates no garbage and actually outperforms the Microsoft stock method.
  • Avoiding garbage when working with StringBuilder
    Most of the functions which operate on a StringBuilder object actually generate garbage. This article lists all the methods which suffer from this problem, and includes some sample code which provides a garbage-free alternative.
  • StringBuilder to String with no garbage
    In some cases we’re only able to pass String objects, and not StringBuilders. The conversion via ToString() to grab a String from a StringBuilder can generate garbage. This article details a method of directly getting at the internal String object stored within a StringBuilder.

Miscellaneous

  • Retrieval of Date and Time a Game Was Built
    This article describes a technique that can be used to easily store a build timestamp in your game. Very useful if you have good crash handlers which can show this information. If you’re sending out test builds of your game to others, this stuff is a must.

An introduction

  • An Introduction, Build Configurations…
    This article is a little dated. I still use the same project configurations for the prototyping I do. But my philosophy about debug-output has changed, I’ll cover that in sometime in the future.