Search Unity

When to create a new Scene?

Discussion in 'Game Design' started by KasunL, May 30, 2021.

  1. KasunL

    KasunL

    Joined:
    Apr 19, 2015
    Posts:
    64
    Hello.

    I'm creating this game (inspired by Tomb Raider the game lol) where the player need to solve puzzles to go into the next area of a building. When the initial 2 puzzles are solved, a door opens and the player can walk into the next area. The 2 puzzles involve some ~1000 lines of code, and when I start to code stuff in the Next area (which is not built yet), the code obviously gonna be bigger. So I'm not sure to put Area-1 code together with Area-2 code, or create a New Scene and start Area-2 from the scratch. WHEN should I actually use a new Scene for a game? Is it when simply transitioning from area to area, or only when doing a Next-Level like jump?

    Below is what the game looks like currently (Alpha):


    THANKS for any input!
     
  2. Steve_Stevens

    Steve_Stevens

    Joined:
    May 3, 2016
    Posts:
    35
    Are you saying you have 1 class doing this scene?
    If so,
    You should look into the 1 class 1 job philosophy. 1 class controls the camera, 1 class handles character input, 1 class handles interactions. When you do that, you will re use a BUNCH of code for new scenes and basically change the data to control the puzzles. YOu will have edge cases you 'll have to code for, but when you go from one scene to the next, you are only changing where you place your triggers, and what data the triggers need or contain to continue your adventure.
     
    KasunL likes this.
  3. KasunL

    KasunL

    Joined:
    Apr 19, 2015
    Posts:
    64
    Thanks for the reply.

    Yes, I'm mostly doing 1 class 1 job thing. Different classes for the camera, player, and other objects:

    Image 002.jpg

    What I'm confused about WHEN to use a New Scene.. I checked Youtube and places, but I can't find anything addressing this question yet.
     
  4. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    I'd also like to hear opinions on this.

    As I understand right now, the main issue is memory management, right?

    The ideal situation is that we just load everything once and then player never has to stop playing. But that can't always be done, so there can be a trade off between how much we load at a time and how often we make player wait for loading.

    Is there other considerations beyond that? Maybe you use separate scenes purely for organizational purposes? I can see this making sense for an artist/level designer.
     
    KasunL likes this.
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,694
    Separate scenes for organizational purposes is also a good consideration.

    Then there are game design considerations, which is appropriate for this forum section.

    It might actually be a benefit to have loading screens to reward the player with a short sequence or image, or just to give their brains time to cool off from puzzle-solving. For example, make each area a separate scene. When the player reaches the endpoint of area 1, cover the screen with an image or start playing a whole-screen sequence. At the same time, use SceneManager.LoadScene() to load the next area's scene asynchronously.

    Similarly, if you want to give the appearance of seamless loading, you can use "airlocks" -- small scenes that the player travels between the area scenes. For puzzle games, I feel like they provide a nice rest area or reward area that gives the player a short break from puzzle-solving. I'll just steal from a similar answer I wrote back in 2016:

    Both of those are easier than dynamically streaming pieces of the game world in and out.

    As Steve_Stevens wrote, keep your common scripts (camera, controller, etc.) reusable as you've been doing. Also, try to make everything your scene into a prefab. It helps with editing and also reusing pieces in different areas. Finally, make sure you can test each scene individually. You shouldn't have to start play mode from area 1 in order to test area 2.
     
  6. KasunL

    KasunL

    Joined:
    Apr 19, 2015
    Posts:
    64
    Really appreciate the helpful tips!

    I'll continue to develop the game and I'm pretty sure I will be needing you guy's help along the way. This is my first 3D game, developing it solely by myself (no other option), and I'm kinda overwhelmed right now about everything I had to take into consideration (meanwhile dealing with a pretty rough life situation, which makes the development lag).


    Anyways, If anyone else has more opinions, tips, etc, please post _/\_

    Thanks again, guys.
     
    Last edited: Jun 2, 2021
  7. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    That is interesting, because sega did that with Virtua Fighter 3tb. When I played it using an emulator, I noticed that the next stage is literally loaded, behind an image of the character, you have to fight next.
     
    Last edited: Jun 10, 2021
    KasunL likes this.