SunBurn Dev Journal: Scenegraph Optimizations

Hello SunBurn community!

You've asked to hear more about upcoming features and updates, and to get a behind the scenes look at the SunBurn Game Engine's development. We thought this was an excellent idea, so a couple of us are starting development journals to talk about the new things we're working on and how they can be used in your projects.

With the SunBurn 2.0.11 update right around the corner there are a lot of exciting new features and enhancement coming up, but to kickoff my development journal I want to talk about the new scenegraph optimizations which are available in the release.


Background

When we originally developed SunBurn's scenegraph the goal was a lightweight system focused on retrieving objects as quickly as possible. While the system was not very sophisticated – it only determined an object's containment in the search bounds using spatial partitioning (with tighter filtering performed by the caller – eg: the ObjectManager or LightManager) – it was decently fast.

Since then we've continued to enhance and optimize the scenegraph, we've exposed the core spatial partitioning for use in SunBurn games (via the ObjectGraph class), and added new methods like FindFast() for even faster though less accurate retrieval.

However the core design remained relatively unchanged, and we felt there was a lot of room for improvement. The port to XNA 4.0 also introduced performance issues related to the CLR runtime. In most scenes the performance differences were not noticeable, however in large complex scenes (thousands of individual objects) they did add up.

We decided rework the scenegraph in SunBurn 2.0.11 to be faster, more intelligent, and to avoid any performance issues related to the CLR runtime.


Optimizations

My first task was to create an overkill scene that would stress the scenegraph and help identify any performance issues. I put together a quick city scene using building models found on TurboSquid and procedurally placed them in code.

The scene contains 10,000 individual scene objects, with 250 – 300 visible at a time (a total of 2,000 – 2,200 rendered meshes per frame), dynamic lighting / shadows, and HDR.

Initially the performance was poor and only pushed 7 fps on the Xbox. Profiling showed that while the CLR was a big factor, the scenegraph itself was also performing more work than necessary.

To speed things up I:

  • Made the scenegraph more intelligent – node recursion and tests to determine if node objects are in the search bounds, were reduced around 50%
  • Manager Find() methods now perform object-type filtering on the resultset returned from the scenegraph – no more intermediate results
  • Changed ObjectManager to store SceneEntity and derived objects instead of ISceneEntity (likewise LightManager now stores BaseLight and derived objects) – side effect of the CLR changes
  • Adjusted all managers to use the most optimal Find() overload when querying objects and lights – as an example the CollisionManager now runs faster by using the “slower” Find() method (instead of FindFast()) as it returns much fewer objects

With these optimizations SunBurn is now able to push the city scene between 23 – 20 frames per second on the Xbox!

That's a considerable performance increase. :) Even better the optimizations improved performance across the entire engine, including SunBurn's collision system, rendering, and shadow generation.

For 99% of SunBurn users these changes are transparent and everything will continue working as normal, only faster. :)

However some people may notice the differences, which are:

  • Results from Find() methods may contain null entries
  • Objects stored in the ObjectManager must derive from SceneEntity, SceneObject, or one of their descendents
  • Lights stored in the LightManager must derive from BaseLight or one of its descendents


Lots of Awesome!

There are still a ton of great new features and enhancements to talk about, including some amazing editor UI updates. :)

So stay tuned for more development journals from our team!

-John Kabus

 

Other SunBurn 2.0 Blogs:

Announcing the SunBurn 2.0 Game Engine - free upgrade, new editions, and updated features
SunBurn 2.0 Collisions, Scenegraph, and Components - new collision system, components, and more
SunBurn 2.0 upgrade for our Torque customers - upgrade path for all of our previous TLK technology customers
SunBurn 2.0 goes Mobile on Windows Phone 7! - full Windows Phone 7 support, light mapping, and more
Holiday, Components, and more! - read about the new components and more
SunBurn 2.0: components, perfabs, and more! - more details about SunBurn's new component system
Festive SunBurn 2.0 Starter Kits, yum, yum! - first release of the new SunBurn Starter kit
SunBurn 2.0.10 update available - streamlined user experience and integrated starter kits

 


Posted 01-27-2011 6:36 PM by JohnK "bobthecbuilder"

Comments

UjenT wrote re: SunBurn Dev Journal: Scenegraph Optimizations
on 01-27-2011 6:55 PM

Wow thats greate news! In my game i have lots of objects with dynamic shadows, and this will deff help with performance.

Will you be providing the scene you used for us to see how it works and try it out?

Philippe Da Silva wrote re: SunBurn Dev Journal: Scenegraph Optimizations
on 01-27-2011 8:06 PM

Great job! Now all we need is a video! ;)

What am I saying?! We need this in our computers like now so that we can play with it ;)

x35mmUk wrote re: SunBurn Dev Journal: Scenegraph Optimizations
on 01-28-2011 5:44 AM

I'm eagerly looking forward to this update! The new optimizations will help me a great deal and hopefully I'll be able to release my first 3D project with Sunburn!!

Great work, guys! Along with my creators club membership and wacom tablet, Sunburn is one of the best purchases I've made!

Wim Vancoillie wrote re: SunBurn Dev Journal: Scenegraph Optimizations
on 01-28-2011 6:30 AM

Hi John,

Awesome! Thanks for the insight on the features you guys are working on. Much appreciated!

Voidness wrote re: SunBurn Dev Journal: Scenegraph Optimizations
on 01-28-2011 7:47 AM

Cool! You can't go wrong with performance upgrades

Epidemi wrote re: SunBurn Dev Journal: Scenegraph Optimizations
on 01-28-2011 12:22 PM

Hey John,

You guys are doing great work! The performance increase is significant, good work!

Can't wait to see what more you guys will develop.

I do wonder though, is the overhead of using interfaces really that high when compared to base classes?

JohnK "bobthecbuilder" wrote re: SunBurn Dev Journal: Scenegraph Optimizations
on 01-28-2011 8:01 PM

Hi guys, thanks!

@UjenT, unfortunately we can't redistribute the assets, they were purchased from TurboSquid.

However if anyone knows of great building models that can be freely distributed then we'd be happy to release the project!

@Epidemi, the latest CLR varies a lot performance-wise, we've had to do a lot of performance testing to find and eliminate all of the issues.

Thanks again!

Tom wrote re: SunBurn Dev Journal: Scenegraph Optimizations
on 01-28-2011 8:47 PM

Very nice, keep em coming! :)

JohnK Blog wrote SunBurn Game Engine: Transparencies, Player Controller, and More!
on 08-17-2011 1:15 AM

Hello SunBurn community! If you follow my blogs you know we’re adding a number of unannounced features

JohnK Blog wrote SunBurn Launches Powerful new Community Plugin System
on 10-16-2011 3:16 PM

Hello SunBurn community! Last night we rolled out a development preview of the SunBurn Game Engine’s

JohnK Blog wrote New SunBurn Community Resources Portal!
on 11-01-2011 5:45 PM

Hello SunBurn community! Two weeks ago we rolled out a powerful new resource system for the SunBurn Game

JohnK Blog wrote SunBurn Game Engine: A Whole New Level of Flexibility!
on 11-16-2011 5:06 PM

Hello SunBurn community! Today we’re announcing the last couple of features in the upcoming SunBurn

JohnK Blog wrote Orbitron: Revolution blasts onto Xbox LIVE Marketplace!
on 12-05-2011 9:52 PM

Hello SunBurn community! Talk about an exciting weekend! The awesome team at Firebase Industries just

JohnK Blog wrote SunBurn 2.0.17 Released – Advanced Lighting, Transparencies, and tons of Enhancements!
on 12-09-2011 4:45 PM

Hello SunBurn community! It’s here! Today we released the SunBurn Game Engine 2.0.17 update –

JohnK Blog wrote New SunBurn Documentation and Silverlight WP7 Example!
on 12-12-2011 9:09 PM

Hello SunBurn community! We’ve just updated the SunBurn Getting Started documentation to ensure

JohnK Blog wrote Starting 2012 with style: SunBurn Game Engine 2.0.18 Preview!
on 01-27-2012 2:01 PM

Hello SunBurn community! We're kicking the year off with a huge new update to the SunBurn Game Engine

JohnK Blog wrote SunBurn Game Engine 2.0.18: Built-in Character Controller!
on 02-04-2012 4:50 PM

Hello SunBurn community! Last night we delivered a feature-complete preview of SunBurn Game Engine 2

JohnK Blog wrote SunBurn 2.0.18 Released - Physics, Char Controller, More!
on 02-14-2012 3:46 PM

Hello SunBurn community! This morning we launched the much anticipated SunBurn Game Engine 2.0.18! The

JohnK Blog wrote New sgMotion Plugin and the SunBurn 2.0.18 Refresh!
on 02-23-2012 4:49 PM

Hello SunBurn community! We just rolled out two exciting new updates for the SunBurn Game Engine ! The



Please login to post comments.