In-Game Console & Cheats
Relevant source files
The following files were used as context for generating this wiki page:
The In-Game Console provides a developer interface for executing commands, modifying game state, and triggering cheats. It serves as a faithful reproduction of the original Redguard development console, allowing users to inspect logical script actors, teleport the player, and adjust fidelity settings at runtime. The console is accessible via the F12 key during active gameplay.
Sources: crates/cyrus/README.md:65, crates/cyrus-game/src/console.rs:114
Console Architecture and Lifecycle
The console system is split into three primary layers: the core logic and editor state, the game-specific command handlers, and the visual rendering implementation.
Core Console Logic
The Console resource maintains the state of the editor, including the command history, the currently entered text, cursor position, and visibility. Commands are submitted through the submit function, which routes them to registered handlers based on the command name.
- Command History: Stores up to 512 lines of input and report output.
- Sources: Distinguishes between
Interactive(user-typed),Gameplay(triggered by game events), andProgrammatic(triggered by scripts or external tools) sources. - Input Capture: When open, the console blocks standard game input to capture keyboard events for text entry.
Sources: crates/cyrus-console/src/lib.rs:17-45, crates/cyrus-game/tests/cheats.rs:322-375
Game Integration
The GameConsolePlugin registers specific commands such as load, item, getflag, and setflag. It also monitors the game state to ensure the console is only available during the InGame application state and when not obstructed by other UI elements like the logbook.
Sources: crates/cyrus-game/src/console.rs:13-75, crates/cyrus-game/src/console.rs:114-129
Console Rendering
The ConsoleRenderPlugin handles the visual presentation. It uses a custom AssetLoader for ConsoleArtwork, which includes the "paper" background and bitmap fonts. The raster function generates an RGBA image from the current Console state, applying colors based on user preferences.
Sources: crates/cyrus-render/src/console.rs:37-45, crates/cyrus-render/src/console.rs:105-180
The diagram above illustrates the flow of commands from user input to logic execution and final rendering.
Cheat System
The cheat system manages persistent and runtime modifications to game behavior. Cheats are identified by named strings (e.g., neversaydie, drevil) and can either toggle a state or set a specific numeric value.
Cheat Execution Logic
Cheats are processed by the Cheats resource. The execute function determines the CheatEffect of a command. While some cheats provide immediate feedback (like oracle listing active cheats), others modify internal flags that the game engine queries (such as death_suppressed or distance_override).
Sources: crates/cyrus-game/src/cheats.rs:56-105, crates/cyrus-game/tests/cheats.rs:64-75
Persistence
Cheat states are persisted to a REDGUARD.CHT file.
- Native: The file is stored in the user's config directory, taking precedence over the installed game file.
- Browser: The system uses local storage with the
cyrus-cheatskey. - Manual Persistence: The
savecheatscommand explicitly writes the current runtime cheat state to the persistent store.
Sources: crates/cyrus/README.md:58-63, crates/cyrus-web/src/cheats.rs:10-25
Cheat Effects Table
| Cheat Name | Effect Type | Description |
|---|---|---|
neversaydie | PlayerDistance | Overrides interaction/script distance limits. |
oracle | List | Displays the current status of all cheats in the console. |
drevil | Unsupported | Intended for death suppression (Logic handled in death_suppressed). |
savecheats | Persist | Writes current cheat values to REDGUARD.CHT. |
goldfinger | Unsupported | Original game cheat; recognized but effect is currently unsupported. |
Sources: crates/cyrus-game/src/cheats.rs:24-54, crates/cyrus-game/tests/cheats.rs:29-55
Console Commands and Variable Management
The console supports complex commands for world navigation and script debugging.
Navigation and Items
load world,marker,angle: Requests a world load. Theworldparameter refers toWORLD.INIentries.item add,id: Grants the player an item by its numeric ID, updating the session inventory.
Sources: crates/cyrus-game/src/console.rs:77-94, crates/cyrus-game/src/console.rs:96-113
Script Flags (SOUP)
The getflag (gf) and setflag (sf) commands allow developers to inspect and modify "SOUP" script flags. These commands support pattern matching using * (wildcard) and ? (single character) to find specific flags in the active script world.
Sources: crates/cyrus-game/src/console.rs:222-260, crates/cyrus-game/src/console.rs:188-210
This sequence diagram shows how script flags are updated via the console using pattern matching.
External Control (MCP)
Cyrus exposes a control port (default 127.0.0.1:7117) that allows external tools to interact with the console and cheat systems via the Model Context Protocol (MCP).
Available MCP Tools
| Tool | Parameters | Description |
|---|---|---|
cheat | name, value | Toggles or sets a cheat via the control port. |
console | open, line | Opens/closes the console or submits a command line. |
teleport | x, y, z | Moves the player to specific engine coordinates. |
set_fidelity | area, mode | Changes fidelity between faithful and modern. |
scripts | offset, limit | Inspects logical script actors without returning bytecode. |
Sources: crates/cyrus-mcp/src/main.rs:90-115, crates/cyrus-mcp/src/main.rs:142-154
Summary
The In-Game Console and Cheat system provide a multi-layered interface for both players and developers. By combining faithful reproductions of original commands with modern external control via MCP, the system enables deep inspection and modification of the game world. The architecture ensures that UI, game logic, and persistence remain decoupled while providing a unified command-line experience.
Sources: crates/cyrus-game/README.md:1-20, crates/cyrus-console/src/lib.rs:1-15