Saturday, January 8, 2011

Version Upgrades and Setbacks and Hacks, Oh My!

Settle in, folks; I get a bit long-winded in this one.

First, some background for the completely uninitiated:
Microsoft has, for the Xbox console (and now Windows Phone 7), a do-it-yourself development model that bears quite a bit of resemblance to the Apple iTunes App Store -- Anybody that has the skills and is willing to pay for a membership (and has the necessary equipment) can design a game for Xbox, submit it for peer review, and ultimately sell it in the Indie Games section of the Xbox Live Marketplace.  The software tools required for Xbox development are Visual C# Express and XNA Game Studio.

Then, a little personal history:
I've been an Indie Games developer for around two years now.  When I started, Visual C# Express 2008 and XNA Game Studio 3.0 were the current versions to have.  I developed and marketed Distraction using XNA 3.0.  XNA Game Studio 3.1 came out a little while after I got involved, and I upgraded with little hassle.

Now, on to the real point of today's post:
Today, I thought I'd do my part as an Xbox Indie Games community member and review some games.  The first one I downloaded to review required the fairly new XNA 4.0 release.  So, I figure, hey -- I've put it off long enough.  Let's take the plunge and update to Visual C# Express 2010 and XNA Game Studio 4.0.

So I install the software and update my current project ("Arka Nightmare in 3D" -- playtests coming in a few months for registered Xbox Live Indie Games developers).  Go to build it and WOAAAAAAHHH!  Errors out the wazoo!

It seems that Microsoft has made some significant changes to portions of the XNA API.  Breaking changes (meaning changes that make older software break).  And now we get to the real headache inducing part: The addition of the concept of Graphics Device Profiles.

XNA 4.0 has two profiles to choose from; "Reach," which targets the widest platform base (and supports the weakest hardware), and "HiDef," which targets higher-end hardware to the exclusion of older PCs and Windows Phone.

Sounds great, right?  Right.  Except that my laptop's graphics chipset isn't supported by HiDef.  And therein lies the rub for Arka Nightmare: Its graphics code requires features that only exist in the HiDef profile.  If I cull my code to run under the Reach profile, performance is awful. If I build for HiDef, I get an error when I try to run it on my laptop.

The really frustrating aspect is that my laptop (a ThinkPad T60p) is actually capable of performing most of the tasks that HiDef would demand of it, and is fully capable of the tasks that Arka Nightmare needs it to do (hardware instancing using Vertex Shader 3.0).  What is a cash-strapped developer to do??

Fortunately, I'm far from the only one to run into this issue, and it's already been hacked around by some very smart people.  It turns out that by using some of the nittier, grittier features of the C# language (that I never use in my code and therefore don't really fully understand yet), you can actually disable the profile checking that XNA does, so that it doesn't notice that the graphics hardware isn't quite fully capable of all possible HiDef demands.  Here's a link to the code that pulls off this money-saving miracle, done by a UK developer calling himself FatBat Games.

So Arka Nightmare is mostly back to its pre-XNA-4.0 glory, minus a few rendering glitches due to parts of the new API that I haven't figured out yet (and may well become the subject of future posts!).

Most likely next up: The dropping of support for point sprites in XNA 4.0 (which prevents me from bringing Distraction to 4.0 yet, as it uses point sprites heavily).

No comments:

Post a Comment