About separating scenes

Here is the deal. My game basically consists of Main character(Dynamic body) interacting with boxes of various sizes(Kinematic body), size being the distinction between levels.

How I did it:
-1 scene, main character and all boxes in it (Box1,Box2…)
-boxes grouped in a group (eg. Boxes: Box1,Box2,…)
-depending on level, i use “Create object out of group Boxes” ;“Box” +ToString(GlobalVariable(level))
-all logic concering particular box is handled by its group (collisions, velocities, etc.) for example : Boxes.Y() or Boxes.LinearVelocityY()…

My reasoning: there is no unique layout between levels and its much neater to do it that way

My question: Would my game be more optimized(performance wise) if I separated levels into different scenes, one for each box size. I assume that the collision checker would work much faster having only to check for one box at a time. Or am I wrong?

Well, assuming there are quite a few of those non-game boxes, It should affect performance. However, if there aren’t too many, and they don’t pile up (so, deleted from if not visible in view) it shouldn’t affect performance. Although, I do believe that Gdevelop already doesn’t calculate some of the collisions that can’t be seen. I’d still delete the extra boxes after they pass.

Oh, and if you’re looking for neat scene solutions, look at “external layouts”.
Hope I was of some help.


Collisions checks and events only apply to instances of objects in the scene. If you only spawn the object for the given level and not for each level, it shouldn’t have any performance impact to have one scene for all levels. In fact, it would make the game lighter as else you would have to duplicate a lot of code between scenes.

Though, asking about performance is often not a good idea: all cases are different and i might be missunderstanding the question, and we can always only make assumptions but not fully predict how the machine will behave. As long as you don’t have performance issues on your game, you don’t have to worry about it. If you do have some, then try both solutions with the performance profiles and see for yourself which one is actually better.

1 Like