Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a simple 2d puzzle with small textures (in count and quantity). Now after I finished the game logic I'm considering tow options to switch between levels:

  • Remove all objects manually and de-attach their spirits from the current scene .
  • Drop the whole scene and start the new level on a new scene.

Both options are not much different in code complexity in my case. so the question is what are the drawbacks of the second approach ? specifically is a scene a heavy object?

share|improve this question
1  
Just drop the scene; it's easier, isn't it? It'll be quick and easy and if it has no drawbacks, just do it. If you see no issues, continue on. It seems like you're trying to optimize something that probably won't even be a problem. –  Vaughan Hilts Mar 28 '13 at 13:37
    
If a scene is self-contained and it runs at an acceptable speed - there will be no consequences. As long as the scene is self-sufficent. If it is not, make sure you do any manual clean up needed. –  Vaughan Hilts Mar 28 '13 at 13:45
add comment

1 Answer

up vote 3 down vote accepted

The AndEngine documentation states that a Scene is nothing more than a mere container for a specific game state. Logically, if it makes sense for each "level" to be a state - (they are distinicntly different and require some complicated setup or it's just easier), just drop the scene. A scene is a self-contained state - just make sure to be careful that there is no shared state that may require clean up. (Globals are tricky for this... if you keep any global object references that are pertaining to that level, make sure you clean them up.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.