Tuesday, February 16, 2010

XNA Frustrations

I've been working on a tower defense game in XNA (C#) lately. I like that XNA simplifies a lot of tasks, which means I can write less code than I typically would in a C++ game. For example, I can make a simple spriteBatch draw call to get a texture on the screen without creating my own vertex/index buffers. Or I can create the view and projection transformation matrices with a single utility method. XNA handles window creation and setup with very minimal code and generally makes the process of creating a 2D game a very simple task.

However, creating a 3D game with XNA is a completely different beast. One thing I've beaten my head against is lack of support for animation out-of-the-box. XNA apparently has some classes at a very low level, as described by my buddy Priyank over at eNtropology Games. XNA Animation Component Library looks promising, though I have yet to play with it. And then there is the XNA Creators Club skinning sample that implements runtime animation classes for a skinned model.

But my latest frustration concerns the lack of something much more basic than animation; I can't create a sphere in XNA! Some folks have created their own classes to implement a sphere as a game "component" object, but what I really need right now is a class that can be instantiated dynamically so I can preview my bounding boxes for collision detection. Naturally C++ has simple utility methods for creating the basic meshes: cubes, spheres, cylinders... even doughnuts and teapots! But no such luck with XNA yet, and the most annoying part is that I'm wasting time trying to render a sphere when I should be doing more important tasks, like making sure my models can avoid walking through each other.

It seems XNA is more of a toy than a tool for serious game development, and I think in the future I will be limiting my use of it to more basic projects. But for now I press on, forced to create innovative solutions (translation: hacks) to make it work... grrr....

1 comment:

  1. I had someone recently ask about a solution for my "frustrations" in this post. Unfortunately I chose not to post their comment because they included their email address in the comment, but it made me realize I should have posted a response when I did find a solution.

    Regarding the lack of out-of-the-box animation, I ended up basing my solution mostly on the skinning sample linked in the post. As for the sphere, I gave up on trying to do it manually in code. Instead, one of my artists created a simple sphere model and I just scaled that model to show my bounding spheres.

    ReplyDelete