3

I have transferred the XNA project to mono. Everything works fine. But I noticed that the phone (HTC 8x) heated. native-XNA game in debug worked fine. The resolution has increased (480x800 vs 720x1280) and fps too (30 vs 55). Are there any recommendations on optimization? What are the most heavy operations ? My game is a simple 2d arkanoid and i don't understand what can heats phone.

vsesh
  • 165
  • 1
  • 7
  • It's strange. I commented out all in update and draw methods in main class. And nothing has changed. – vsesh Aug 08 '13 at 20:24
  • You best bet is to run a performance profiler over the code. Maybe try a fixed time step http://msdn.microsoft.com/en-us/library/bb203878.aspx – craftworkgames Aug 09 '13 at 05:08
  • I think by default XNA always updates the screen x times per second. (I don't recall the exact rate). You could look at using `Game.SupressDraw`, as suggested in the accepted answer to this question: [How do I pause the redraw in XNA?](http://stackoverflow.com/questions/16554717/how-do-i-pause-the-redraw-in-xna) Note that the solution, while answering the question, did not actually help the asker of that question. It may or may not help you. – chue x Aug 13 '13 at 21:54

1 Answers1

2

You should limit your game in all devices to run at a constant frame rate to do this in Xna you need to lines:

TargetElapsedTime = TimeSpan.FromTicks(333333); //30 fps
this.IsFixedTimeStep = true;

limiting the fps from 55 to 30 will reduce the cpu work therefore no more heat,

and if that does not help check if some background threads of yours is not doing some intensive work

elios264
  • 384
  • 4
  • 19
  • you should ONLY do what you've suggested if you are trying to create a "Fixed-step" game loop. A lot of games use a variable-step loop and therefore don't require a "constant" framerate because they want to take advantage of hardware and run smoother where possible. There are much better ways to reduce heating than hard-limiting your FPS. I highly recommend doing more research before answering questions such as this. – Strifex Jan 07 '14 at 19:17
  • @Strife according to msdn.microsoft.com: In a fixed-step game loop, Game calls Update once the TargetElapsedTime has elapsed. After Update is called, if it is not time to call Update again, Game calls Draw. After Draw is called, if it is not time to call Update again, Game idles until it is time to call Update. the FixedTimeStep does not affect your gameplay, and if there are much better ways why you did not post any answer? – elios264 Jan 28 '14 at 20:02
  • I didn't post an answer because the correct answer is that there is no way for us to know why his application heats up the phone without him profiling it and finding the area of code that seems to be causing the CPU and/or GPU to process so heavily. For more information on fixed-step vs variable loops see this discussion: http://gamedev.stackexchange.com/questions/1589/fixed-time-step-vs-variable-time-step – Strifex Jan 28 '14 at 20:31