Bennu on the 360...

posted in Once a Bird
Published August 13, 2008
Advertisement
I had a plan that if Bennu wasn't selected for the PAX 10, which it wasn't, I would participate in this year's DreamBuildPlay contest. But this year's DreamBuildPlay contest is for the 360 only, so I figured that since Braid was out too, I'd buy a 360. :) And by the way, Braid is totally worth it.

I was curious about how much effort it would take to port the game to the 360. The steps I went through may help someone in the same situation (some of them are explained in more detail in the creator's club web site):

1. Used XNA Studio's option to create a copy of each project for the 360, which gave me new compiler errors, as expected. This works well, the projects share files but you have to add new files to each project separately.

2. Added to each 360 project the 360-specific xna framework dlls (included in the XNA directory in Program Files).

4. Replaced references to libraries not supported on the 360. I was using the Application class in the System.Windows.Forms library to change the current system culture so the decimal separator employed on data files wouldn't get messed up on other systems. It was replaced by Double/Integer/whatever.Parse with an invariant culture. Timers also aren't supported, so I did a basic Timer class of my own.

3. Added a XBOX360 flag to each 360 project so I could use conditional compiling instructions for the platform. With this flag I was able to keep the mouse/keyboard code in the PC generated code but not on 360 code.

5. Removed the encoding specification from the XML files I load game data from as XNA on the 360 doesn't support encoding specification. Luckily I wasn't counting on a specific encoding.

6. Purchased a Creator's Club gold membership and downloaded XNA Game Connect from the XBOX live games list. I'm not sure you need the gold membership to do this, but I want to check out other games anyway.

7. Added the 360 console to XNA Game Studio on the pc, just needed to input an identification code so it knows which console to upload the game to (the game is uploaded through the internet without any direct connection needed between the pc and the console).

8. Deployed the game to the 360. Each time you build the game it checks which files were altered and uploads them, which is pretty neat.

By then the game was running on the 360. Which was freaking cool.

On the positive side, I was surprised I had to alter so little of the game code, specially the file input/output code. Also, the game looked good on a small tv, the colors where much brighter than on my LCD monitor.

On the negative side, I'm having performance issues on the 360. This is a common issue, reported my many developers. This is where I am now: Every 5-10 seconds, the game freezes for a second or so. I think it's the garbage collector, but I'm still running tests. Here's a collection of resources I've gathered on this subject:

Managed Code Performance on Xbox 360 for XNA: Part 1 - Intro and CPU
http://blogs.msdn.com/netcfteam/archive/2006/12/22/managed-code-performance-on-xbox-360-for-xna-part-2-gc-and-tools.aspx
The cost of value types in .NET Compact Framework
XNA Framework Remote Performance Monitor for Xbox 360
Understanding XNA Framework Performance
Twin paths to garbage collector nirvana
Foreach, Garbage, and the CLR Profiler
0 likes 3 comments

Comments

Matt Carr
I've just setup the creators club stuff on my 360, but unfortunately I've not made anything with XNA like you so I was pretty much limited to trying out 'Space War' :).

I'll probably be getting into XNA development soon so I'll no doubt refer to your post here and links. Looking forward to hearing more.
August 13, 2008 08:42 AM
Drilian
"Twin paths to garbage collector nirvana" is more or less all the information you need.

You either need to make sure that you're:

A. Allocating nothing (or very close to nothing) at all during game runtime.
or
B. the amount of elements you have allocated is SO SMALL that doing a full pass over the heap doesn't take much time.

I personally went with option A, which seemed easier than B, though there are certainly caveats (sound playback and strings are a big issue with that - it's basically impossible to do string manipulation without causing allocations, and XNA's sound code has some ridiculous bugs that, as a work-around, require allocations).
August 13, 2008 02:27 PM
Demosthenes
I'm trying to go A too, B would be almost impossible because I'm using physics and particle engines which inevitably take a lot of memory.
August 14, 2008 04:12 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement