user1306322
user1306322

Reputation: 8721

How to reduce XNA game CPU usage while nothing worth computing is happening?

A fresh XNA game project application consumes quite some CPU percentage while its window is active. On my desktop PC it's about 30% of one core of a 2-core processor. When the window loses focus, the game goes into idle mode and consumes about 1% of CPU.

In an image viewer application I recently made using XNA, redrawing frames when no image manipulation is going on doesn't make much sense, so I'm using the SuppressDraw() method which, as the name suggests, suppresses spending resources for drawing the next frame, showing the last drawn frame instead. But still, there's a problem where the application keeps wasting CPU for a very simple input update.

How do I reduce the CPU usage for an XNA application when it doesn't require much of it?

Upvotes: 4

Views: 767

Answers (1)

Dmi7ry
Dmi7ry

Reputation: 1777

quote from this question

According to this discussion on XBox Live Indie Games forum , apparently on some processors (and OS-s) XNA takes up 100% CPU time on one core when the default value of Game.IsFixedTimeStep is used.

A common solution (one that worked for me as well) is to put the following in your Game constructor: IsFixedTimeStep = false;

more details here

Upvotes: 4

Related Questions