Debug Terminal - UQcsse3200/2026-studio-1 GitHub Wiki
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.
-
Terminal - Maintains the state of the terminal and actions commands:
Terminal. -
Terminal Input Component - Processes input and triggers state changes in the terminal:
KeyboardTerminalInputComponent. -
Terminal Display - Displays the terminal's UI:
TerminalDisplay. -
Command - Defines actions to be taken when the command is triggered: e.g.
DebugCommand.
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());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 |
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
Tests were used to ensure the following situations were working:
-
hide inventory onhides the inventory andhide inventory offshows it - No words, one word, three words, or a first word after
hidethat is notinventoryare 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 beinginventory
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
- Press
F1, typehide inventory onand the panel disappears; typehide inventory offand it comes back. - Type
tpfollowed by each side room name (for exampletp HoundsDen) and check the player arrives in that room. - In Level 3 type
killzeusand the win screen appears after about 2.5 seconds.