Thanks again to Paul Oliver for writing up some tips and tricks he picked up from coding Helium.  Really great technical gotchas good to know for and and all aspiring Windows Phone 7 developers!

1.      Beware your garbage generation - High end video games make sure to allocate all of their memory upfront to prevent fragmentation and to pool it out appropriately. You can do the C# equivalent of this in several ways.

 

a.       Move variables used every frame from local variables to class members

 

b.      Give your objects default constructors that take no args and them  Initialize()/Shutdown()  methods. You can allocate every class on load and use the Initialize()  method like you would a constructor.

 

2.       Watch your Iterators  - Only loop through the objects that you need to loop through. Rather than having a base object with an Update method, have classes that need to be Updated register with an Update manager. Do the same for classes that need to Render

 

3.       Be aware of texture compression – Based on this round of research it appears that the Phone is using some sort of compression either in the packaging/deploy stage or in loading the textures onto the device. My gut says it’s a DXT compression – but I haven’t attempted to determine exactly what it is. This has an effect on the quality of your textures displayed, and could save resource all around if you just start with lower quality textures from the start.

 

4.       Be aware of screen resolution – Most phones we see have a maximum screen size of 4 inches. At 4 inches your high quality assets might only represent a tiny fraction of the screen. Larger assets have larger load times, and require more resources on the phone. 

 

5.       Watch your fill rate – As mentioned in several of the MIX/GDC presentations, per-pixel lighting is expensive on the Phone. We can draw from that the conclusion that pixel shaders can be very expensive. Remember that under the hood SpriteBatch.Draw uses pixel shaders, I haven’t had any trouble with using it in AMS, but AMS is not an overly complicated game.

 

6.       Use your resources wisely -  Windows Phone 7 has full 3D hardware (unfortunately no custom shaders yet).  Sometimes it’s better to spend a little more effort and implement a feature in 3D for the increased quality, and better user experience. It can also give increased performance in some instances. With a real GPU and a separate CPU rendering content to a render target and reusing it might be a performance boost over doing something CPU side.

 

7.       Don’t be afraid to store things in 2 or 3 locations (or data structures) if it decreases access time to these objects.