XNA game performance

前端 未结 3 1245
北恋
北恋 2021-01-30 18:43

I am writing a game using C# 2010 and XNA 4.0. I want it to be a good game and not some \"just another crap\" and so one of my goals is good framerate. For this I would like to

相关标签:
3条回答
  • 2021-01-30 19:00

    Software optimisation is a craft. The best kinds of optimisation are evidence based on collected statistics.

    Until you have a problem don't optimise. Don't you think that game playability is more important than this metric or another? My suggestion is make the game first and then consider where it's not performing as you'd like.

    Then post some specific questions and I'm sure you'll get some help here on the specific issues.

    In the mean time I suggest that you'll get more information from games development books like those listed here : http://forums.create.msdn.com/forums/p/8642/45646.aspx.

    XNA Extereme 101 - seems to be an interesting tutorial

    0 讨论(0)
  • 2021-01-30 19:05

    My 2 cents worth:

    Don't put all your code in one method because you think it costs to call a method. If you THINK your losing 1-3 FPS by calling an empty method, You probably haven't finished researching the 1-3 loss yet. For that loss to be true during an empty method call, you'd have to have a FrameRate in the MANY thousands.... where you wouldn't concern yourself about a 1-3 drop.

    FPS is a bad way to judge performance in XNA. When you have variable time step enabled, other processes that the OS is involved with can influence your frame rate. You really need to profile instead. Just concentrate on the amount of time it actually takes to complete the Update &/or Draw Methods by timing them with a System.Diagnostic.Stopwatch object. time them individually, not together (very important).

    The 'new' keyword should not only be avoided in the draw call but anywhere in both the update & draw... FOR reference types only. Use the new keyword anytime and anywhere you need to with value types.

    0 讨论(0)
  • 2021-01-30 19:20

    UberGeekGames has a good article on XNA optimization. It's mostly targeted at Xbox and WP7, but many of the things also apply to PC.

    http://www.sgtconker.com/2011/05/high-end-performance-optimizations-on-the-xbox-360-and-windows-phone-7/

    Original site is dead, but is available in the Internet Archive:

    Archived version of High end performance optimizations on the xbox 360 and windows phone7

    The rule of thumb is "profile before optimizing".

    0 讨论(0)
提交回复
热议问题