Should stages be separated by multiple scenes or code?

Hello everyone.

I have a simple requisition regarding design. If I were making a game with a large amount of stages or levels (Let’s say between 30 and 50), is it better to have them all be different scenes, or to separate using code (if stage_int == 24, etc). Possibly some combination?

Just looking for a general consensus. Thanks very much.

My feeling is that simple scenes – each has it’s own script running it – is easy for beginners. Esp. if the game only goes forward. As you get more stuff that carries between scenes (what the player is carrying, which traps were spring) it’s more of a pain. Often easier to code the tear-down and set-up of the new level yourself, all in one scene. Of course, instead of IFs you’d mostly have arrays with data for each scene.

The "new " load-asynch option is probably the best mix, but a little tricky. A base scene shared by a stages comes first. The player, the scoring GUI, inventory … . Then for each stage anything you want to hand-place goes in a stage-scene. You ADD that to the base scene, then remove when leaving.

You can write your own scene manager but it will be hell to find errors if you make any. I’d suggest to simply use a different scene for each stage. That way you can concentrate on making sure everything works alright in that one stage without affecting the rest.

I would say that it depends on the type of game you are making. If it is a platformer or puzzle game or a similar game with levels that are not connected, then it is would be easier to make each level in its own scene.
If you are making a level where you go back and forth between levels (scenes) then it could be tricky to tear down and recreate each level based on the game state, and then it solution with adding scenes as @Owen-Reynolds suggested seems the optimal thing to do.