Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm making a Windows Phone game (XNA 4.0) which requires a lot of activity on the screen. It's working well for now. But what I am concerned about is that it uses a lot of sprites and many of them as 'lists' so that I can make multiple copies of the sprite, and this causes a lot of Update() calls which have 'for' loops and collision testing method calls also. This also increases the number of Draw() calls. As the game progresses, I am going to need to add more sprites and update calls.

Can that cause problems in Windows Phone? (Currently I have no device to test it on).

My game has 18 sprites for now and most of them requires multiple copies to be drawn on screen.

Is there a more efficient way to achieve this?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

There is practically no limit. As most things though, that is not 100% sure. What you are going to be limited by is hardware.

The default FPS is set to 30, but you can change it to 60 if you like. If you are not able to do all the work in your main Update Loop in one frame then you will start to see frames getting dropped. This is bad.

Also, there is a limit to how much memory you can use on the phone. For smaller devices running the yet-to-be released "Tango" update, this limit is 90MB. The Certification Guide details out how much memory you are allowed to use. If your game is using more than the limit it will not get passed certification. Use too much memory and your app will crash.

A few tips:

  • To reduce memory usage and allow your game to scale, look into sprite sheets.
  • Being "wasteful" with your objects will cause the GC to kick off, and that will cause skipping as well. Make sure you only allocate what you need.
  • If you need to create/destroy sprites a lot (think bullets, enemies, etc...) look into object pools
  • Use Doubles instead of Floats when appropriate. Internally the phone version of the framework used Doubles; any Float has to be casted over anyway.
  • Run the Windows Phone Performance Analysis tool on your game. It will show you "hotspots" as well as tell you what is using the most memory.

All that being said, If you game runs fine (no noticeable "skipping" or dropped frames), doesn't take too long to load, and passes certification; it is probably fine. Don't really worry about performance right now. Just work on making your game fun.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.