Zune Performance
Wait a minute! If you play the game as it's currently written on the Zune, you'll notice that it freezes periodically. If you pay attention, you'll see that the freezing occurs every time a new type of sprite is created for the first time. Why is that?
Well, the content pipeline is a very efficient resource-processing mechanism. Nonetheless, it still has to hit the hard drive to pull out resources for use in your game. The first time you pull a resource from the content pipeline, it will hit the hard drive to retrieve that resource (for example, retrieving the sprite sheet the first time you display a sprite). Subsequent calls to retrieve the same resource actually don't hit the hard drive—the content pipeline is optimized so that when the same resource is retrieved multiple times it is pulled from memory rather than the hard drive every time after the initial retrieval of that resource.
This isn't a problem in the Windows version of the game, but on the Zune, where the CPU and GPU are much less powerful, it's causing problems. Hitting the hard drive is a very slow process, and on the Zune (and even on a PC, if the resource is substantial enough) that can be a game killer.
How can you fix this problem? Instead of having the content pipeline load the
sprite sheets for each sprite type as they are created for the first time, you can
force the content pipeline to load each sprite sheet in the LoadContent method of the SpriteManager class. To do this, add the following ...