Scene Management vs Object Management

By Chris Caruthers

This week I had to write the Scene Management system. It didn’t have to be too complicated as we just need something to set up now. My plan going in was to essentially hold vectors of Scenes, and maybe 1 vector of gameObjects for the current scene. The Scenes would have been made of GameObjects as well. The somewhat obvious problem with this is that these systems would be managing a good number of our gameObjects, essentially taking responsibility away from gameObjectManager. We don’t want this because now if you need to access a gameObject you have to determine if you need to go into SceneManager or gameObjectManager, or you would have to access the gameObjects in SceneManager through gameObjectManager, and neither of these options sounded good to us.

Our quick solution for this was to essentially manage a different, simpler, and quicker data type in SceneManger. This SCENE_OBJECT struct is now what Scene and SceneManager contains, which holds transform data and mesh/material file paths. A vector of the current scene’s SCENE_OBJECTS is passed to gameObjectManager, wherein it uses the data to create GameObjects which it then holds as the current scene. This is done so that no class is doing another’s job and so that SceneManager and Scene can be lightweight. Scene is now doing the absolute minimum and is committed solely to generating the scene object’s location and size data, and doesn’t have to worry about making buffers, rigid bodies, etc. Scene manager maintains Scenes and has a register always filled the current scene’s SCENE_OBJECTs.

Comments

Popular Posts