Performance (spritefonts & spritebatch.draw)

Jun 7, 2009 at 2:08 PM

Hi Bill,

I've rebuilt my engine using the latest SilverSprite sourcecode and can confirm the SpriteEffect flipping issues have been resolved - many thanks for that.

Here's a basic version of my engine running in Silverlight:

I had to add a check to see if GraphicsDevice.Root was null in the ApplyChanges() method (GraphicsDeviceManager.cs) as the Game_Loaded event fires after the graphical changes are applied.

Given how well the farseers physics demo and Dr. Popper run, I'm guessing that the poor performance in my engine is partly down to the use of SpriteFonts (unavoidable) and changing the colour values during SpriteBatch.Draw() calls (after a few minutes everything slows down to a crawl).  Will Silverlight 3 make it possible to address these issues?

Are there any other basic Silverlight/Sprite related performance tricks that I may have overlooked?



Jun 7, 2009 at 6:14 PM

No probably not, I think the text is probably having a big impact on your performance. I was just thinking that it would be useful to be able to show some debug info on the screen, such as number of image objects, number displayed, etc. I'll look at seeing what I can do to pop up a display like that to help with performance issues. It's very possible that I can make some significat performance improvements if we can figure out where the problem is.

Jun 7, 2009 at 8:56 PM

It seems that you're right about the memory growth - the memory usage for the browser shoots up on initialisation and then rises about a megabyte every two seconds during gameplay.  I've encountered no such memory issues natively, so I'll see if I can glean any more information with a profiler.  First time for everything!

Jun 8, 2009 at 12:24 AM

It will definitely be a great test case, thanks!