#Scenes or Singletons?

9 messages · Page 1 of 1 (latest)

copper kindle
#

I've been using Godot for a few weeks now, after the Unity fiasco. I've gotten to a point where I'm wondering, for a platformer/metroidvania style game, would using multiple scenes for each room be too taxing for things like performance/memory?

I used an asset pack called Corgi Engine when working with Unity, which had a built-in system for rooms, in which you could have multiple "rooms" that would be hidden by a camera "mask" if you left one room and entered another (the previous room would be hidden in the hierarchy, the new room would be visible, etc). This approach alleviated needing multiple scenes to transition to, and allowed for a single player prefab object to be used, in one main scene, as opposed to a copy of the player object per room.

I'm wondering if there is anything like this for Godot, or if in general, using scenes and scene transitioning in Godot (which I already have set up) with a player object per room is acceptable for performance & memory. Would appreciate any insight or resources for a topic like this!

tulip pelican
#

1 scene per room is the standard way. copying the player is just 1 to 3 lines of text in the .tscn, so memory wise, it isn't a big deal. if you don't want to bother copying it though, you can use a scene manager node instead of get_tree.cange_scene_to_*

copper kindle
#

I'm thinking it might not be a bad idea to have at least the player object be a singleton, so that object would start in one scene, then transition to each subsequent scene, in lieu of having a player object within each scene. Thanks for the tips though! 👍

fierce saffron
#

Wouldn't you just have a main scene that instanced the player and also a map node that gets swapped out?

tulip pelican
#

I would hesitate to do that. you'll always have the player in the scene, so if you prototype something, it can get in the way. you'd also have to stash it somewhere in the start menu

copper kindle
fierce saffron
copper kindle
#

Ah in that case yeah, along the lines of what I was thinking in regard to the one player object being persistent, but being able to transition from scene to scene.

fierce saffron
#

Yeah