niu-gdo / IGDO-Fall-2023-Project

IGDO's Fall 2023 game project.
7 stars 0 forks source link

Room & Level Framework #38

Closed ExplosiveEggshells closed 6 months ago

ExplosiveEggshells commented 10 months ago

Brief

In this PR, the framework for our room and level frameworks are introduced, which will allow our designers to create an interconnected web of rooms that can be transitioned between. This will resolve feature #33.

Test

The entire feature can be tested in the scene Scenes/Feature/33-LevelFrameworkTest. The transparent circles are teleporters between rooms.

Note that the system should be error-safe, any potentially crashing errors should be handled by the introduced code. If you catch a crash during testing, do not disregard and be sure to include it in your review.

You can also play around with adding new rooms using the instructions below.

Use

In order to hook up a new room, one must do the following:

  1. Create a new room that the character can play in. The entire room should be parented under a single game object, which should then have a Room.cs component attached. Give the room component a Level-unique ID.
  2. The room needs to be accessible by other rooms. To do so, add in a couple of Transition Endpoints (TEPs) (as children of the room) where the player should be able to enter from and give them room-unique IDs. You will then have to place teleporters in other levels which point to the new room and TEP's IDs.
  3. To make the room exitable, place down teleporters with a valid ID of another room's TEPs.

Note that prefabs for Rooms, TEPs, and Teleporters are included in the prefabs folder.

Note that new rooms do not need to be serialized into the LevelManager, and TEPs do not need to be serialized into their containing room. These scripts are set up to automagically™ find any valid rooms and child TEPs on initialization.

Detail

The framework consists of four functional components- Rooms, Transition Endpoints (TEPs), Teleporters, and the LevelManager.

Since our game is set up to treat Rooms as individual game instances, the Level Manager will attempt to only keep exactly one level "Loaded" at a time. For now, "Unloading" a level just involves disabling it's parent GameObject.

ExplosiveEggshells commented 10 months ago

I also just pushed up a 'Room Kit' prefab, which designers can pull into the hierarchy as a neat package with all vital room components