Room Layout - UQcsse3200/2026-studio-4 GitHub Wiki

Introduction

rooms.json is the main file created and used to make the creation of new room layouts, and placement of enemies, traps, easy. Utilised is a declarative definition that gets loaded into Java config objects, and RoomFactory uses those objects to construct the actual Entity.

Resource Management

Assets are curated through DreamlandTile.java where each tile from the tile set is given an ID which makes creating a room layout in rooms.json easier to visualize.

Usage

Example 1:

As seen in the example below each room needs an id, title, and size. Furthermore if there are entry points, NPC spawns and/or enemy spawns, ids and coordinates are necessary. If there are any exits such as a door leaving the room, an id, kind of exit, coordinate, the room id they will end up in, and the entry point id that they will spawn at.

`rooms: [{ "id": "selection",
  "title": "Dungeon Selection",
  "mapWidth": 41,
  "mapHeight": 61,
  "entryPoints": [
    {
      "id": "start",
      "x": 16,
      "y": 21
    }
`"npcSpawns": [`
    `{`
      `"npcId": "merchant",`
      `"x": 16,`
      `"y": 16`
    `},`
`"spawns": [...]`
`"exits": [`
    `{`
      `"id": "dungeonOneShelf",`
      `"kind": "BOOKSHELF",`
      `"x": 32,`
      `"y": 36,`
      `"destinationRoomId": "dungeonOneEntrance",`
      `"destinationEntryPointId": "fromSelection"`
    `},`

Example 2:

As seen below is the main method of creating a room layout and is put where spawns is located in the example above. As previously stated tiles are given IDs in DreamlandTile.java and because of this, room layouts are simply writing the tile ids wanted in the layout desired.

One thing to note is the room layout is mirrored, as in however it is created, whenever the room is loaded in game the bottom half becomes the top half and vice versa (0,0 top left when writing in rooms.json but top right becomes 0,0 in game)

`"spawns": [
      "                                         ",
      " ################################        ",
      " #33B3B33B322222233B333B333B3333#        ",
      " #33B333B3322222233B333B3B33B3B3#        ",
      " #333B33B3322222233B3B3B3B3333B3#        ",
      " #33B3B3B3322222233B33B33B33333B#######  ",
      " #33B333B33222222222222222222222SSSSSS#  ",
      " #33B333B3B222222222222222222222222222#  ",
      " #333B33B3B222222222222222222222222222#  ",
      " #333B3333B222222222222222222222222222#  ",
      " #33B3B3333222222B333B33B3333B3333B33B#  ",
      " #33B33B33B222222B333333B3B33333#######  ",
      " #33333B3B3222222B33B3B3B33B3B33#        ",
      " #333B33333222222333B3B333B3B33B#        ",
      " #333B3333B222222B3B33B333333B33#######  ",
      " #3333B333B222222222222222222222SSSSSS#  ",
      " #3333B3332222222222222222222222222222#  ",
      " #333B3B322222222222222222222222222222#  ",
      " #333B3B222222222222222222222222222222#  ",
      " #33B33B222222222222333B3B33B3B333B3B3#  ",
      " #33B3332222222222223B3B33B33B3B#######  ",
      " #333B3B2222222222223B3333B33B33#        ",
      " #333B3B22222222222233B333B3B3B3#        ",
      " #33333B222222222222B3B33B33B333#######  ",
      " #3B3B33222222222222222222222222SSSSSS#  ",
      " #3333B3322222222222222222222222222222#  ",
      " #33333B332222222222222222222222222222#  ",
      " #3B3B3B3B3222222222222222222222222222#  ",
      " #33B333B332222223B33B3B3B33B3B333B33B#  ",
      " #333333B3B222222B33B333B33B3333#######  ",
      " #3333B33B3222222B33B33B3B33B3B3#        ",
      " #333B3333B2222223B333B3333B333B#        ",
      " #33B3B3B3B222222B333B3B3333B3B3#######  ",
      " #3B333B33B222222222222222222222SSSSSS#  ",
      " #3333B33B3222222222222222222222222222#  ",
      " #3B33B333B222222222222222222222222222#  ",
      " #3B33B3B3B222222222222222222222222222#  ",
      " #33B333B3322222233B33333B33B3B333B3B3#  ",
      " #3333B3B3B2222223333B3333B33B3B#######  ",
      " #3B33B333B222222B33B3B33B3B3333#        ",
      " #333B333B32222223B3333B333B33B3#        ",
      " ###########2222#################        ",
      "           #2222#                        ",
      "           #2222#                        ",
      "           #2222#                        ",
      "           #2222#                        ",
      "           #2222#                        ",
      "  ##########2222##########               ",
      "  #8888888882222888888888#               ",
      "  #8888888882222888888888#######         ",
      "  #8888888882222222222222SSSSSS#         ",
      "  #888###8882222222222222222222#         ",
      "  #888# #8882222222222222222222#         ",
      "  #888###8882222222222222222222#         ",
      "  #8888888888888888888888888888#         ",
      "  #888###8888###888###888#######         ",
      "  #888# #8888# #888# #888#               ",
      "  #888###8888###888###888#               ",
      "  #8888888888888888888888#               ",
      "  ########################               ",
      "                                         "
    ]`

To add another room, simply add another entry into the rooms list and follow the same framework as the examples above.

Certain guidelines do apply to keep a consistent game feel, and validate rules applied such as two doors having each other as their exit instead of allowing one door to lead to a door and that door to lead to another. These can be found in the WorldConfig.java file.

One addition was that to ensure walls are not all the same time and are displayed differently depending on its surroundings spawnWall was created and edited to check a walls neighboring tiles, and based off that which wall tile to display

UML