Debug Terminal - UQcsse3200/2026-studio-1 GitHub Wiki

Introduction

The debug terminal is for developers to run commands while the game is running. When visible, the terminal is displayed in the bottom-left of the screen and commands can be typed into the terminal using the keyboard.

The terminal uses the Command Pattern to action entered commands.

Key Components

  1. Terminal - Maintains the state of the terminal and actions commands: Terminal.
  2. Terminal Input Component - Processes input and triggers state changes in the terminal:KeyboardTerminalInputComponent.
  3. Terminal Display - Displays the terminal's UI: TerminalDisplay.
  4. Command - Defines actions to be taken when the command is triggered: e.g. DebugCommand.

Usage

The terminal can be toggled in and out of view using the F1 key.

Commands can be triggered by typing into the terminal and pressing enter. When the name of the command followed by valid arguments is entered, the command is actioned. As an example, the "debug" command accepts the arguments "on" and "off". So debug on or debug off would be valid commands.

Commands must be added to the commands map in Terminal.java using addCommand(). They are composed of a name and an instance of the Command interface. The following is an example for adding the debug command:

addCommand("debug", new DebugCommand());

Game commands

The game adds its own commands to the terminal. Type them after pressing F1.

Command What it does Ticket
killzeus kills Zeus when he is alive in the current room, so the win screen can be tested without playing the whole game; any argument makes it fail without killing anything #346
hide inventory on, hide inventory off hides or shows the inventory panel #337
tp <location> moves the player to a test location: lvl1dungeon, lvl1nether, lvl2, lvl3 or one of the eight side rooms (MinotaurLabyrinth, GorgonGallery, ShadesBarracks, HoundsDen, OuterGuard, ThunderHall, CyclopsForge, CentaurPavilion); names are case sensitive and a room name cannot be split into two words #337
win shows the win screen for the current game see Win System
spawn <enemy> spawns an enemy at the player's position see Enemies

Testing plan

KillZeusCommandTest

Tests were used to ensure the following situations were working:

  • The command succeeds when the final boss was killed
  • The command fails when the final boss is not in the room
  • Any argument is rejected and nothing is killed
  • The command asks for the kill once each time it runs

InventoryCommandTest

Tests were used to ensure the following situations were working:

  • hide inventory on hides the inventory and hide inventory off shows it
  • No words, one word, three words, or a first word after hide that is not inventory are rejected
  • The player is not looked up when the words are wrong
  • The command fails when there is no player, or the player has no inventory display
  • The current player is used each time the command runs
  • The validity check needs two words after hide, the first being inventory

TeleportCommandTest

Tests were used to ensure the following situations were working:

  • A registered destination teleports the player
  • Unknown or incorrect arguments are rejected
  • More than ten destinations are accepted
  • Names are case sensitive, and a side room name split into two words is rejected
  • The teleport runs each time it is asked, and later changes to the table do not affect a built command
  • Every destination points at a map file that exists
  • There are eight side rooms, each with its own map, and each starts the player on the shared spawn

Manual testing

  • Press F1, type hide inventory on and the panel disappears; type hide inventory off and it comes back.
  • Type tp followed by each side room name (for example tp HoundsDen) and check the player arrives in that room.
  • In Level 3 type killzeus and the win screen appears after about 2.5 seconds.
⚠️ **GitHub.com Fallback** ⚠️