Summary
Add an optional text-based UI (TUI) mode as an alternative to the standard pygame UI, selectable at launch.
Background
Roam currently depends entirely on pygame for rendering. A TUI mode would allow the game to run in environments where a display is unavailable (e.g. SSH sessions, headless servers) and makes the game more accessible. The TUI should be a thin rendering layer over the existing game logic — no business logic should move into the UI layer.
Requirements
Launch Flag
- Add a
--tui command-line argument to src/roam.py (via argparse) that switches the active UI mode to TUI
- The default (no flag) retains the existing pygame behaviour unchanged
Abstraction Layer
- Introduce a UI interface (e.g.
src/ui/baseUI.py) that both the pygame renderer and the TUI renderer implement, covering at minimum:
draw(room, player, stats) — render the current game state
getInput() — return the next player action
showMessage(text) — display a status message
- Register the active UI implementation in the DI container (
src/bootstrap.py) based on the launch flag, so game logic resolves BaseUI without knowing which renderer is active
TUI Renderer
- Implement
src/ui/tuiRenderer.py using Python's stdlib curses module (no third-party TUI libraries)
- Render the current room as an ASCII grid — one character per entity (e.g.
G = Grass, T = Tree, @ = Player, B = Bear, C = Chicken, . = empty)
- Display player energy, selected hotbar slot, room coordinates, and status messages in a sidebar or header
- Support the same keybindings defined in
KeyBindings (src/config/keyBindings.py) for movement, inventory, and other actions
Screens
- TUI equivalents are required for: world view, inventory screen, stats screen, main menu
- Save selection and options screens may display a simplified text-only fallback
Persistence
- No changes to save/load logic — TUI mode reads and writes the same JSON files as pygame mode
Platform Support
curses is stdlib on macOS/Linux; on Windows use the windows-curses package (add to requirements.txt with a platform marker: windows-curses; sys_platform == "win32")
Acceptance Criteria
Summary
Add an optional text-based UI (TUI) mode as an alternative to the standard pygame UI, selectable at launch.
Background
Roam currently depends entirely on pygame for rendering. A TUI mode would allow the game to run in environments where a display is unavailable (e.g. SSH sessions, headless servers) and makes the game more accessible. The TUI should be a thin rendering layer over the existing game logic — no business logic should move into the UI layer.
Requirements
Launch Flag
--tuicommand-line argument tosrc/roam.py(viaargparse) that switches the active UI mode to TUIAbstraction Layer
src/ui/baseUI.py) that both the pygame renderer and the TUI renderer implement, covering at minimum:draw(room, player, stats)— render the current game stategetInput()— return the next player actionshowMessage(text)— display a status messagesrc/bootstrap.py) based on the launch flag, so game logic resolvesBaseUIwithout knowing which renderer is activeTUI Renderer
src/ui/tuiRenderer.pyusing Python's stdlibcursesmodule (no third-party TUI libraries)G= Grass,T= Tree,@= Player,B= Bear,C= Chicken,.= empty)KeyBindings(src/config/keyBindings.py) for movement, inventory, and other actionsScreens
Persistence
Platform Support
cursesis stdlib on macOS/Linux; on Windows use thewindows-cursespackage (add torequirements.txtwith a platform marker:windows-curses; sys_platform == "win32")Acceptance Criteria
python src/roam.py --tuilaunches the game in TUI mode without requiring a displaypython src/roam.pylaunches the game in pygame mode unchanged