Skip to content

Room Manager

Kelvin Hsu edited this page Sep 3, 2026 · 5 revisions

Room Manager

The RoomManager class is the main entry point to rooms and acts as a director for the main game. The main gameplay loop will be coordinated by this class. The RoomManager will handle creating room entities and provide api's for switching to different rooms.

Usage

A RoomManager class is to be created with a game screen. The player must not be registered before passing into RoomManager. After everything is setup, At the very end of the game screen creation call RoomManager.create().

Once the main gameloop begins, RoomManager internally will coordinate all game behavior.

create() {
    // ...
    RoomManager roomManager = new RoomManager(worldConfig, player, camera);
    // ...

    roomManager.create()
}

Room Entities

A major code design decision was to convert the GameArea to the ecs entities. The rationale behind this is that in our game we wish to have a series of levels (a room) the player must clear, hence we need a way to quickly make different room variants.

Room Factory

RoomFactory is a static class used to create room entities.

Usage

Room factory provides a static function for creating a room entity with components to provide basic functionality.

createRoom(RoomConfig room, CameraComponent camera, boolean cleared)

The RoomConfig params provides instructions for what a room has and allows the following to be declared. See RoomConfig for usage details.

  • map size
  • player spawn point
  • enemy spawn points
  • exits

Note: room components does not directly depend on RoomConfig class. createRoom extracts the required values from RoomConfig for the components which lets us maintain encapsulation.

If a room is created with cleared == true then enemies will not be spawned.

Room Entity Components

  • RoomAssetsComponent
  • GameAreaDisplay
  • TerrainComponent
  • WallComponent
  • FollowingCameraComponent
  • ObstacleComponent
  • ExitComponent
  • EnemyManagerComponent

UML

image

todo

  • Add outside dependencies to diagram
  • Fill out class fields

Table of Contents

Home

Test Plan

Team 2

Features

Components
Player
Items and Inventory
Enemies
Interactable NPCs
Cutscenes and Dialogue
Music
Bosses
Rooms
Weapons
Abilities & Spells
Game Screens and Areas
Dungeons

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally