Instanced Model

I was feeling good about the progress I have made with the game.  However, one thing I had not tried in some time is running the game on the XBox 360.  When deploying on the XBox, I came across a few problems.  First, the XBox version of the project did not have references to the SkinnedModelProcessor.  After adding a reference, it still returned an error about the library version number.  I figured out that this was because my SkinnedModel project DLL was being compiled for Windows.  In the SkinnedModelProcessor solution, I created a Copy of Project for XBox 360 and added a reference to the DLL created from that in my XBox 360 project instance and it ran correctly.

Unfortunately, I did notice some some slight slowdown on the XBox 360, and the FPS counter usually returned somewhere between 30 and 50 FPS.  I turned off the rendering of the two adjacent rooms, and it went back up to 60 FPS.  This is one reason I don’t like developing on a super powerful computer, because problems like this don’t arise until it’s deployed on a less powerful system like the XBox 360.  After going through my model rendering code, I was able to track down the slowness to the rendering of the “blocks” which make up the game map.  I modified the code so that it renders a block for each map cell, which is the worst case scenario (15 rows * 26 columns = 390 cell blocks).  This significantly lowered the frame rate on the XBox360 to anywhere from 7 FPS to 20 FPS.  The blocks are just six sided cubes with a texture, so the meshes are not complex

screen095

After doing multiple web searches, I was able to find one thread that discusses this problem.  This led me to the Instanced Model example code from Microsoft, which is able to display thousands of models at a time with frame rate not dropping below 60 FPS, even on the XBox 360.  I knew there had to be a way to do this, since the graphics processor is capable of rendering thousands of polygons at a time.  From my previous projects in OpenGL, I learned that this is handled by creating a “display list” in OpenGL, so I figured there had to be an equivalent in XNA.

I didn’t have a chance to modify my code according to the example, since my vacation is over and I have limited time to work on game programming.  Hopefully, I’ll have a chance over the weekend to get this working correctly.  Also, I still have the level 2 and 3 armor sets to add to the game.