I was wondering about the performance of using XNA in C# for deve开发者_运维技巧loping games and not using it. Could I not use PictureBoxes instead of 2D Textures? Is it viable to go with Windows Form programming for games, or is XNA the best solution? Any advantages/disadvantages?
The more complex your game is the less likely you'll find WinForms development sustainable. XNA is geared towards that sort of thing so why not use it?
The real question you should ask yourself is "do I want my game to run on Windows Phone 7, XBOX 360, and/or the Windows desktop?" If your answer is yes then learn XNA. The best thing is it does most of the work for you to allow you to target these different platforms.
I recommend listening to a recent podcast by Scott Hanselman on the topic: Hanselminutes Podcast 240 - Developing Indie Games for Xbox 360 and XNA with George Clingerman.
It depends on your game's graphics complexity.
If you want to learn a good library that allows to make high-end games with good graphics, use XNA; it'll open more variety to your flavor.
But if you want to make a simple non-scrolling, Tetris-like, or solitaire games, double-buffered .NET controls can do the trick.
Use XNA. Aside from having significantly better performance, better supported platforms (Xbox 360, Windows Phone), other API niceness like sound and input handling, there is one very important reason:
XNA is an "immediate" style API (as opposed to a retained one; see this description).
Developing games with this type of API is significantly eaiser. The reason being, without getting into too much detial, is that in a retained API you have to ensure the external scene stays in sync with your game state. This is tedious and bug-prone (believe me, I've done it).
If you are looking for the best performance, you shouldn't be looking at c# or XNA at all, the lower level you go the better in that regard. However, lower level means you will spend more time on the programming with less results.
XNA was developed to make game programming easy. It takes a lot of the tedious low level coding and wraps it up in nice simple methods for us to call so that we don't have to deal with reinventing the wheel, while still harnessing a very powerful framework.
I'd highly suggest if you are interested in making a game, go with XNA. I think you will enjoy it much more than the alternatives.
精彩评论