State Management Best Practices

Hello everyone,

First off I'd like to say that your product is awesome, a huge time saver.

I'm working on an Xbox Indie game where I've combined Jiglibx and Sunburn and I had just a couple questions (none regarding Jiglibx of course):

I have a very basic state management structure using Pop, push, and change (not the one from the XNA creators site) .  Currently the game runs pretty good but I wanted to get feedback on the most efficient usage of the engine.

Currently the LightingSystemManager is initialized and shared in the game's main class.  Each screen will house it's own environment and objects.  On each screen in the constructor I add:

sceneState = new SceneState();
sceneInterface = new SceneInterface(OurGame.graphics);
sceneInterface.CreateDefaultManagers(false, false, false);
lightRig = new LightRig();
sceneInterface.LightManager.Submit(lightRig); 

And then I submit my SceneObjects.  This seems to work great but I want to make sure before I get too deep into things the best practice for this scenario.

So finally on to my question :)
What is the best approach to maintain separate scenes without having to clear and rebuild after state changes and not suffer any performance penalty?  

Mind you that when the state is inactive Update and Draw do not get called of course.  I've searched the forums and it's given me a few ideas but I'm still learning SunBurn's hierarchy from the developer's guide.

I hope my rambling question make sense :)

Thank you in advance for your help and keep up the great work!

Nick


Posted 08-23-2010 10:04 AM by Nick Metnik

Comments

JohnK "bobthecbuilder" wrote re: State Management Best Practices
on 08-24-2010 1:33 PM

Hi Nick,

That looks good, just make sure to call sceneinterface.Unload() when popping the screen.  Otherwise a lot of graphic objects will continue to tie up resources while the screen is unused.

Another option is to share the sceneinterface between all screens, and only Clear and Submit when the screen becomes active.

Nick Metnik wrote re: State Management Best Practices
on 08-26-2010 10:40 AM

Thank you JohnK!

Keep up the great work!

Nick

dug diamond wrote re: State Management Best Practices
on 11-07-2010 4:06 PM

Umm.... This really isn't a blog !

All questions should be made via new posts in the forums.

Blogs should be set aside for ground-breaking news and short tutorials. :)

All that said and done, welcome to the community



Please login to post comments.