Display System

This document covers all display-related features in openRoads, including room descriptions, item display, enemy display, user interface elements, and input handling.

Room Display System

Room Description Modes

openRoads supports two display modes for room descriptions:

Full Mode (Default)

Shows complete room information including:

  • Room title (Short)

  • Full room description (Long)

  • Items present in the room

  • Enemies present in the room

  • Other players in the room

  • Available exits

Brief Mode

Shows condensed room information:

  • Room title (Short) only

  • Items present in the room

  • Enemies present in the room

  • Other players in the room

  • Available exits (when using movement commands)

Room Components

Room Title (Short)

  • Always displayed regardless of mode

  • Brief, descriptive name of the location

Room Description (Long)

  • Detailed description of the room

  • Only shown in full mode or when using look command

  • Can contain multiple lines and rich descriptions

Exit Information

  • Available directions are shown when movement fails

  • Exits are validated in real-time

Item Display System

Item Description Templates

Items in rooms are displayed using customizable templates defined in the room's ItemDesc property:

{
  "roomID": {
    "ItemDesc": "There is %s here."
  }
}

Item Display Features

Proper Grammar

  • Automatic article selection (a/an) based on item names

  • Correct pluralization for multiple items

  • Proper comma separation and "and" before the last item

Examples:

There is a sword here.
There is an ancient scroll here.
There is a sword, a shield, and an ancient scroll here.

Item Name Resolution

Items can have multiple name fields, resolved in this priority order:

  1. name field (primary display name)

  2. short field (short description)

  3. id field (internal identifier)

Enemy Display System

Enemy Display Format

Enemies in rooms are displayed with proper grammar and formatting:

You see a rat here.
You see a wild dog here.
You see a rat, an orc, and a skeleton here.

Enemy Display Features

Automatic Grammar

  • Proper article selection (a/an)

  • Correct comma separation for multiple enemies

  • "and" before the last enemy in lists

No Templates Required

  • Enemy display uses built-in formatting

  • Consistent "You see X here" format

  • No need for room-specific templates

Look Command System

Basic Look Commands

look or l

  • Shows full room description regardless of brief mode

  • Displays all room components (title, description, items, enemies, players)

look at <target> or l <target>

  • Examines specific items, enemies, or players

  • Supports partial matching for convenience

Partial Matching

The look command supports intelligent partial matching:

Exact Match Priority

  • Full names are matched first

  • If exact match found, partial matching is skipped

Partial Matching

  • If no exact match, searches for partial matches

  • Case-insensitive matching

  • Matches any substring of the target name

Search Order

  1. Enemies (checked first)

  2. Items (checked second)

  3. Players (checked last)

Look Command Examples

look                    # Show full room description
look rat               # Look at a rat enemy
look at ancient scroll # Look at an item
look sword             # Look at a sword item
look PlayerName        # Look at another player

# Partial matching examples
look wild              # Matches "wild dog"
look ancient           # Matches "ancient scroll"
look test              # Matches "TestPlayer"

Combat Interface

Combat Commands

openRoads features a comprehensive combat system with equipment management and tactical timing.

Equipment Commands:

arm <weapon>           # Ready a weapon for combat
disarm                 # Put away your ready weapon
wear <armor>           # Put on armor for protection
disrobe                # Remove worn armor

Combat Commands:

hit <target>           # Attack an enemy or player (unarmed or armed)

Information Commands:

inventory, inv, i      # Show your inventory
status, stat, st       # Show character status and combat stats
equipment, eq          # Show equipped weapons and armor

Combat Mechanics

PvE vs PvP Combat:

  • PvE Combat: No cooldown timer - attack enemies as fast as you can type

  • PvP Combat: Speed-based cooldown timer prevents spam attacks

  • Combat speed calculated from Dexterity + Intelligence / 2

  • Higher speed = shorter PvP combat delays

Equipment System:

  • Weapons increase attack power significantly

  • Armor increases defense

  • Unarmed combat available but with reduced damage (Str/4 effectively)

  • Cannot drop, sell, or give equipped items

  • Must disarm/disrobe before unequipping

Combat Stats:

  • Hit Points (HP): Health, calculated from Strength

  • Spell Points (SP): Magic energy, calculated from Intelligence

  • Attack Power: Base damage, enhanced by weapons

  • Defense: Damage reduction, enhanced by armor

  • Speed: Action frequency, affects combat timing

Combat Display

Status Information:

--- Character Status ---
Name: PlayerName (Novice)
Element: fire
Experience: 150
Physical Level: 2  Spell Level: 1

--- Statistics ---
Strength: 15    Dexterity: 12
Speed: 10       Intelligence: 8
Ego: 14

--- Combat Stats ---
Hit Points: 15/15
Spell Points: 12/12
Combat Speed: 10
Attack Power: 12
Defense: 7

Gold: 125 coins

Equipment Display:

--- Equipment ---
Ready Weapon: iron sword (Damage: 12)
Worn Armor: leather armor (Protection: 5)

Note: You cannot drop, sell, or give away equipped items.
Use DISARM or DISROBE to unequip items first.

Combat Messages:

# Armed combat
You swing an iron sword at a rat for 8 damage!
***
PlayerName attacks you with a steel sword for 12 damage! (8/20 HP)

# Unarmed combat
You punch a rat with your bare hands for 3 damage!
***
PlayerName attacks you with bare hands for 4 damage! (16/20 HP)

Combat Timer System

PvP Timer Only:

  • Timer only applies to player vs player combat

  • No timer for attacking enemies (PvE combat)

  • Equipment changes always allowed (no timer restrictions)

Timer Display:

  • Shows remaining time when on PvP combat timer

  • Prevents PvP attacks while timer is active

  • Timer duration based on combat speed

Timer Messages:

You must wait 3.2 more seconds before you can act again.

Enemy Retaliation System

Go Routine-Based Processing:

  • Asynchronous retaliation handling via go routines

  • Non-blocking UI operations for responsive gameplay

  • Natural timing with 0.5-1.5 second delays

  • Concurrent processing of multiple retaliations

Retaliation Mechanics:

  • 60% chance for enemies to counter-attack

  • Enemy damage ranges from 3-7 base attack power

  • Retaliation damage affected by player's defense

  • Can kill players who aren't careful

  • Smart validation (player location, enemy presence)

Retaliation Messages:

***
The rat strikes back at you for 4 damage! (16/20 HP)

Retaliation Conditions:

  • Player must still be in the same room

  • Enemy must still be alive and present

  • Retaliation canceled if player moves or enemy dies

  • Buffered channel handles up to 100 concurrent requests

Starting Equipment

New players begin with basic equipment:

  • Wooden club (weapon, 5 damage)

  • Leather armor (armor, 5 protection)

  • Healing potion (restores 20 HP)

  • Bread (restores 5 HP)

  • Torch (provides light)

Combat Restrictions

Equipment Restrictions:

  • Cannot drop equipped items

  • Cannot sell equipped items

  • Cannot give away equipped items

  • Must unequip before removing from inventory

Combat Timer Restrictions (PvP Only):

  • Cannot attack other players while on timer

  • Can still attack enemies (no PvE timer)

  • Can still change equipment

  • Can still move and use other commands

Player vs Player Combat

Engagement Rules:

  • Both players enter combat state

  • Speed determines action frequency

  • Combat timer prevents spam attacks

  • Must wait for timer to disengage

Death and Consequences:

  • Player death results in respawn in element room

  • Experience awarded for victories

  • Inventory protection rules apply

  • Combat state automatically cleared on death

Respawn System:

  • Players respawn in their element room with full HP

  • Element room assignments: Earth→Room 3, Air→Room 4, Fire→Room 5, Water→Room 6

  • Unknown/Default element players respawn in Room 2

  • Room player lists are updated automatically

  • Provides safe respawn points to prevent spawn camping

Input System

Input Handling Features

Backspace Support

  • ASCII 8 (backspace) and ASCII 127 (DEL) supported

  • Visual feedback with proper cursor movement

  • Safe buffer management prevents underflow

Character Filtering

  • Only printable ASCII characters (32-126) accepted

  • Control characters are ignored

  • Prevents garbage input

Echo System

  • Characters are echoed back to the terminal

  • Backspace provides visual erasure

  • Consistent behavior across terminal types

Empty Input Handling

Help Message Display When players repeatedly hit enter without typing commands:

) [enter]
...Enter "?" for help!
) [enter]
...Enter "?" for help!

Benefits:

  • Guides new players toward help system

  • Prevents silent empty prompts

  • Consistent user experience

Command Processing

Input Parsing

  • Commands are split into parts using whitespace

  • First part is treated as the command

  • Remaining parts are arguments

Case Handling

  • Commands are converted to lowercase

  • Case-insensitive command processing

  • Consistent behavior regardless of input case

User Interface Elements

Command Prompt

Standard Prompt: )

  • Simple, unobtrusive prompt

  • Consistent across all game states

  • Easy to recognize

Main Menu

  • Color-coded sections

  • Clear option descriptions

  • Consistent navigation

Character Creation

  • Step-by-step process

  • Input validation

  • Clear instructions

Status Display

Player Information

  • Current room display

  • Brief mode indicator

  • Element affiliation

Room Information

  • Dynamic room descriptions

  • Real-time player updates

  • Live enemy spawning

Display Formatting

Color Support

openRoads uses ANSI color codes for enhanced display:

  • Menu headers and titles

  • Important information highlighting

  • Error and warning messages

Text Formatting

Line Endings

  • Consistent \r line endings for terminal compatibility

  • Proper text wrapping

  • Clean display formatting

Special Characters

  • Escape sequence handling

  • Unicode support where available

  • Terminal-safe character sets

Accessibility Features

Brief Mode Support

Purpose

  • Reduces screen clutter for experienced players

  • Faster navigation for frequent players

  • Bandwidth conservation for slow connections

Behavior

  • Shows room titles only during movement

  • Full descriptions available via look command

  • Items and enemies still displayed

Input Assistance

Partial Matching

  • Reduces typing requirements

  • Forgiving of incomplete input

  • Natural language support

Help System

  • Context-sensitive help

  • Command discovery assistance

  • New player guidance

Terminal Compatibility

Supported Terminals

openRoads is designed to work with:

  • Standard ANSI terminals

  • Telnet clients

  • SSH terminals

  • BBS terminal emulators

Character Encoding

ASCII Support

  • Full printable ASCII character set

  • Control character filtering

  • Safe input handling

Extended Characters

  • Basic extended ASCII support

  • Terminal-dependent behavior

  • Graceful fallback for unsupported characters

Display Performance

Efficient Rendering

Minimal Updates

  • Only changed information is sent

  • Reduced bandwidth usage

  • Faster display updates

Buffered Output

  • Efficient terminal communication

  • Reduced system calls

  • Better performance

Memory Management

String Handling

  • Efficient string operations

  • Memory-conscious formatting

  • Garbage collection friendly

Customization Options

Room Templates

ItemDesc Customization

  • Per-room item display templates

  • Flexible placeholder system

  • Consistent formatting

Display Preferences

  • Brief mode toggle

  • Personal display settings

  • Persistent preferences

Future Enhancements

Planned Features

  • Color customization

  • Font size options

  • Layout preferences

  • Accessibility improvements

Troubleshooting Display Issues

Common Problems

Text not displaying correctly:

  • Check terminal encoding settings

  • Verify ANSI color support

  • Test with different terminal clients

Input not working:

  • Verify terminal sends proper key codes

  • Check for conflicting key bindings

  • Test backspace functionality

Formatting issues:

  • Confirm line ending compatibility

  • Check terminal width settings

  • Verify color support

Debug Information

Display Debugging

  • Enable verbose logging

  • Monitor terminal communication

  • Check character encoding

Input Debugging

  • Log input character codes

  • Monitor command parsing

  • Verify input filtering

The display system provides a rich, accessible, and performant user interface that works across a wide variety of terminal types while maintaining excellent usability and visual appeal.

Last updated

Was this helpful?