Mommy's Best Games, Inc. is an independent game developer founded in 2007. This is a view behind the scenes of our game development and marketing!

Nathan

Tuesday, July 1, 2008

Taking out the trash

Weapon of Choice is programmed using Microsoft's .NET framework and is programmed in C#. This means unlike the C programming language, in which memory is deallocated manually, 'garbage collection' takes care of cleaning up memory. The difficult thing about it is while it's nice to have something handle this automatically, the Xbox 360 version of this garbage collection is really slow compared to the PC.

Last week I finally got Weapon of Choice running on the 360 only to find that it played really slowly and stuttered about. The good news is that I finally have the stuttering under control. It turns out the garbage collection was to blame. For every 1MB I was allocating and leaving to the collector to deal with, it would stall for almost a quarter of a second to clean up. Right now, during a full level, I basically allocate no new memory. It's very nice to see it moving fairly smoothly. For reference I used the CLR Profiler. If you're using XNA, don't use this one.

The bad news is, the game is still slow! Consistently slow, it's true, but still pretty slow. With XNA I have no good performance profiling tools on the Xbox, but I'd guess it's around 10-15 frames a second. That is where the game stands today. Thus I'm currently looking at ways to improve the framerate.
On game sites there's a lot of talk about 60 frames a second. I agree, that's really smooth. I have the game running at a little over 30 frames a second on the PC and it's still smooth and extremely fun. If I can get the game up to 30 fps on the Xbox I'm going to be thrilled. The game would be extremely playable and fun at that framerate.

No comments: