#How do I implement a room/screen system?

1 messages · Page 1 of 1 (latest)

pure notch
#

Okay so, I want to make a (generic) platformer game where each level/stage consists of multiple rooms. The player can go back and forth between rooms.

What are the ways to go about this? I was thinking all the rooms must be different scenes or a single scene has multiple rooms. But would that really be the best way in terms of performance? I would also like each room to have it's own camera bounds, enemies and traps.

Assuming all my rooms for that level are in one single scene, if I have multiple enemies and traps going on in different rooms, how would I optimize it so that only the entities in the current room are shown.

How are rooms/screens in games like Celeste and Hollow Knight made?

TL;DR how do I implement a room system similar to the ones in, let's say, Celeste?

untold flint
#

in Unity, you're likely going to be making scenes, and using SceneManager.LoadScene(...) when your character moves into a certain area, then moving your character

pure notch
#

No, I know that but would it really be the best way. See, I want each level to be made up of different rooms. Now, I could go about making a scene for every room, but I don't think that's the best way to go about it.
I want each level (which is made up of rooms) to be a scene. And in one level there are, let's say, 20 rooms. And each room has it's own entities like enemies and traps. How would I optimize this. I mean is it really okay to have 20 rooms of varying shapes and sizes with their own entities all be active at once?
How would I do this? How would I make some sort of room managing system?

untold flint
#

"Best" is entirely relative. It sounds like you need a combination of scene loading and multiple rooms given the scale of this.

sly pagoda
#

If enemies can move between rooms you probably should have a single scene

pure notch
pure notch
#

All entities of a room would just be in that room. I just want a way to go back and forth between rooms -- like in a Metroidvania. Which is why I'm curious as to how games like Hollow Knight have pulled it off.
My structure for the game is something like:

  1. Have many levels that players can select through a selection screen
  2. Each level has rooms and the player can only be in one room at a time.

So far, I think a good way to go about this would be to have every scene to be a room.

sly pagoda
#

How fast do you want the player to move between rooms?

#

Instantly? Switching scenes will take longer

pure notch
#

Between rooms instantly or like fairly fast -- a second at max

pure notch
sly pagoda
#

Will the rooms be made by you or generated on the fly

pure notch
#

made by me

untold flint
pure notch
untold flint
#
//SceneManager loads your new Scene as an extra Scene (overlapping the other).
SceneManager.LoadScene("YourScene", LoadSceneMode.Additive);
pure notch
#

Thanks for this, will look into it

dusk fractal
#

bit late to this but i needed pretty much exactly this in my game so i’m adding my two cents:
i have a scene per level, with rooms essentially consisting of a bounding trigger collider (to know when the player entered the room) and otherwise everything else it needs. when the level is loaded all the rooms are loaded aswell, but im saving quite some performance by only ever having the current and adjacent rooms be active

pure notch
dusk fractal
pure notch