views:

72

answers:

2

Is it WPF? WFA? A custom template? I currently use WFA, and it just doesn't seem anywhere near optimal. And no, I'm not asking for a referral to DirectX, or another language.

Thanks.

+2  A: 

Do you want it to be really 2D, or you you want a "2.5D" game where 3D objects move in 2D?

For most basic 2D, like turn-based games or simple animation where very fine human input control is not necessary, the System.Drawing tools used in a WFA will probably be fine. You have access to a lot of the tricks, like using small images as sprites, rendering vector graphics, as well as the must-have elementary shape-drawing functions. You can use Image objects like Bitmaps to simulate page-flipping (create a Bitmap, draw the shapes on it, then call Graphics.DrawImage()), or simply use SetRedraw(false) on the control you're using as the Graphics pane to freeze what's there while you're drawing the next window.

WPF has some tools that are a major leap forward. Look at the System.Windows.Media.Media3D namespace; it has tools for 3D vector algebra and geometric primitives, allowing you to create 2.5D games with vertex shading and all the tricks. The basic structs can be referenced and used for their mathematical power, or you can build a WPF application that will integrate them into a graphics pane. You'll have to research this yourself; I'm a lightwight with WPF.

If you want your game to really get some FPS, you're going to have to use an accelerated platform like DirectX. XNA Game Studio is a free .NET-compatible API that wraps a lot of the DirectX functionality, allowing you to create .NET apps with accelerated graphics without requiring messy native code hookups. Creating and running apps on just about any .NET-compatible platform (including Windows) is free; you have to pay a fee and join the "XBox Creator Network" to publish even free games for XBox 360.

KeithS
I love the amount of control afforded by WFA as well. Unfortunately, it flickers, even with double-buffering enabled. And by the time you triple-buffer, anything but drawing a circle takes to long and to much to be a viable animation. Currently I use a direct to form draw method, so like the Bitmap page-flipping method you mentioned, but instead just utilizing Invalidate.
Bloodyaugust
First, WFA is simply going to flicker; the framework was designed for desktop layouts, which are not very speed-dependent. The System.Drawing namespace gives you the kind of tools necessary to create MS Paint, not Halo. Second, try the page-flipping method using Bitmaps in addition to double-buffering. It's the difference between putting a transparency of a graphic on an overhead, and putting a blank one up and drawing the graphic. The one problem is that the image will be a raster; that's a LOT of memory to be throwing around, so I'd keep the Bitmap objects around and just wipe them.
KeithS
A: 

XNA, and the Box2D.XNA physics engine if your game requires 2D collision detection and physics. XNA takes care of hiding all that crazy DirectX stuff from you. It has a great content pipeline, which lets you add content to your game very easily. My favorite framework for small games.

vdeych