At GameFest 2007, Torpex Games president Bill Dugan and technical director Jamie Fristrom gave a pre-mortem of their forthcoming deubt title Schizoid
, developed on the XNA Game Studio Express platform for Xbox Live Arcade.
So why did Torpex go with XNA? Likening it to the shift from assembly to C and C++, for Torpex, a quick switch to XNA meant getting in early and gaining a competitive advantage. Torpex believes that at some point, high-level languages like C# will be to C++ what C was to assembly. "We'll do the bulk of our coding in C# and drop back to C/C++ for tight loops," Dugan said. "And one day, we'll pretty much abandon C/C++ altogether."
"I always thought that it was going to be a doomed love affair, and I'd have to go back to the old battle-axe, C++, to ship," Fristrom said. But talking to Microsoft, they realized no port to C++ would need to be made; C# can be used as the game's scripting language.
Dugan found "massive early productivity", with a proof-of-concept ready in just a few days. "If I had been running in C++, I don't know how long it would have taken me to get the DirectX calls all wired up and everything... it's quite possible I would not have seen it through, and stopped, and gone onto other stuff."
"It became our business' prime focus," Fristrom adds.
Making an early prototype is essential, they said, to convince publishers of a game's potential -- and with XNA, Torpex had an early prototype of Schizoid
in two months. The Torpex team also added that the quick work in realtime, along with the absence of need to write tools and the fact that even non-programmers can enter data directly into C# files, negating the need for XML, helps avert bottlenecks in the process.
Another plus is that C# and XNA integrate easily with Nunit, which is used by the automated build machine along with MSBuild. Torpex caught 10% of the bugs within a day of introduction.
Fristrom highlighted that easy iteration in C# enables more experimentation, since mistakes aren't deal-breakers. "It's easy to come to an agreement if you say 'let's try it this way'," he noted.
And there was no design doc, either; design docs for Schizoid
weren't generated until the game's milestone submission to Microsoft. "I wrote it on Monday and sent it on Tuesday," Dugan said. "By looking at the game," Fristrom added.
Development wasn't without its problems, though, as the team found that game performance bogged down when it was moved from PC to 360. The XNA framework didn't run the game as fast as it did on the PC, since the desktop runs a different common language runtime than the 360.
"You need to do multicore programming," Dugan said. "It's got a number of problems that the PC version doesn't have." Fristrom said that's because as an evolution of the PDA CE environment, it's not designed for games.
The team listed other reasons for the lagging speed: non-generational garbage collection, switching between user and kernel mode, and fresh-off-the-boat fpu support. As for other possible reasons, it was tough to discern; the team cited poor profiling tools. "Even inline profiling requires the mode switch, so it's very hard to get good measurements," Dugan added.
The team said that PIX is crucial for multithreading; unsure whether it would be in XNA GS 2.0, they advised all developers who need multithreading to talk with Microsoft if they want it.
To correct the garbage collection issues, the team used structs instead of classes. "Instead of discarding objects, keep them on a linked list to reuse later," Dugan advised. "You can use reflection to make sure they get reinitialized to canonical values."
Overall, multicore was a "headache," but worthwhile -- the team saw a 50-75% performance increase by switching over to it. They used a mixture of wide and deep threading, did drawing and updating in parallel, and actually called the update from XNA's draw right before the sprite batch submission, then parceled out updating/colliding tasks on remaining threads.
C# builds are usually blazingly fast, and file validation times are slow under the debugger -- 2000 files takes about 2 minutes, so the team recommends making a “no assets” build that doesn’t actually use any art. Building the stand-alone package is also slow; the team suggests deleting your xnaallowlist.al file before running MSBuild.
Despite the problems, they would still use XNA. "I don't know if Schizoid
would have happened if we didn't use Game Studio to do those first few days of work and suddenly get that ball rolling," Dugan said. "We did know the job would be tough when we took it; we did know that the developers would be following in our footsteps, and that we'd be shredding through the jungle. We were Microsoft's guinea pigs so you don't have to be."
"I'm glad we made the decision we did and if I had a time machine I wouldn't change it," Fristrom adds. "I just love working in C# and the IDE so much, and I'm really dreading -- I know if I ever have to go back to C++ I will miss C# greatly."