This document covers all configuration options available in openRoads, including server tick system, spawning, display settings, and runtime options.
Configuration Files
config.ini
The main configuration file is located at config/config.ini. This file uses a simple INI format with sections and key-value pairs.
# openroads/config/config.ini[Routines]# Time for the nightly cleanup to run (24-hour format, HH:MM)NightlyCleanupTime=03:00# Enable active room cleanup (only rooms with players)ActiveRoomCleanup=true[Spawning]# Server tick configurationServerTickSpeed=1000 # Milliseconds per server tick (1000ms = 1 second)SpawnCheckInterval=30 # How many ticks between spawn checks (30 ticks = 30 seconds with 1s ticks)SpawnProbability=0.3 # Probability of spawning when conditions are met (0.3 = 30% chance)
World Configuration Files
world/formatted_rooms.json: Room definitions and properties
world/players.json: Player data storage
world/enemies.json: Enemy definitions and spawn settings
Server Tick System
The server tick system provides precise timing control for enemy spawning and other game mechanics.
Tick Configuration
ServerTickSpeed (milliseconds)
Default: 1000ms (1 second per tick)
Range: 100ms - 5000ms recommended
Purpose: Controls how frequently the server processes game events
Performance Impact: Lower values = higher CPU usage but more responsive gameplay
SpawnCheckInterval (ticks)
Default: 30 ticks
Range: 1 - 300 ticks recommended
Purpose: How many ticks between enemy spawn attempts
Calculation: Actual time = SpawnCheckInterval × ServerTickSpeed
SpawnProbability (0.0 - 1.0)
Default: 0.3 (30% chance)
Range: 0.0 (never) to 1.0 (always)
Purpose: Probability of spawning when all conditions are met
Configuration Scenarios
High Performance Server
Use case: Powerful server, want responsive gameplay
Effect: More frequent processing, moderate spawn rate
Standard Server
Use case: Most servers, balanced performance
Effect: Standard timing for most installations
Low Resource Server
Use case: Limited server resources
Effect: Less frequent processing, lower spawn rate
Enemy Spawning Configuration
Max Instances Enforcement
Each enemy type has a max-instances value in world/enemies.json:
Enforcement Rules:
Current count: System tracks how many instances of each enemy exist
Spawn blocking: If current instances >= max instances, no new spawns
Instance cleanup: Old enemies are automatically removed to free up slots
Spawn Timing Calculation
Formula: Actual Cooldown = ticks-to-make × ServerTickSpeed
Examples:
Rat: 1 tick × 1000ms = 1 second cooldown
Orc: 3 ticks × 1000ms = 3 second cooldown
Dragon: 100 ticks × 1000ms = 100 second cooldown
Routine Configuration
Cleanup Settings
NightlyCleanupTime
Format: HH:MM (24-hour format)
Default: 03:00
Purpose: When to run the nightly cleanup routine
ActiveRoomCleanup
Type: Boolean (true/false)
Default: true
Purpose: Whether to clean up rooms that have active players
Runtime Configuration
Command-Line Flags
--cleanup-every-minute: Forces cleanup to run every minute instead of at the scheduled time (useful for testing)
Environment Variables
Currently, openRoads does not use environment variables for configuration. All settings are managed through the config.ini file.
Performance Tuning
Tick Speed Impact
Faster Ticks (500ms):
✓ More responsive gameplay
✓ Precise timing control
✗ Higher CPU usage
✗ More frequent processing
Slower Ticks (2000ms):
✓ Lower CPU usage
✓ Better for resource-limited servers
✗ Less precise timing
✗ Potential gameplay delays
Spawn Check Frequency
More Frequent Checks (every 10 ticks):
✓ Enemies spawn more consistently
✓ Better world population
✗ Higher processing overhead
Less Frequent Checks (every 60 ticks):
✓ Lower processing overhead
✓ Burst spawning behavior
✗ Uneven enemy distribution
Monitoring & Debugging
Debug Logging
The system provides detailed logging to help administrators understand behavior:
Log Levels:
DEBUG: Detailed decision information
INFO: Successful events and major actions
WARNING: Failed operations and configuration issues
ERROR: System errors and invalid configurations
Key Metrics to Monitor
Spawn Success Rate: How often spawns succeed vs. fail
Instance Counts: Current vs. maximum instances per enemy
Cooldown Effectiveness: Are enemies spawning too frequently?
Server Performance: CPU usage during tick processing
Configuration Validation
The system validates configuration values on startup and will log warnings for:
Invalid time formats
Missing configuration files
Unrecognized configuration keys
Invalid numeric values
Out-of-range parameters
World Configuration
Room Format
Rooms are defined in world/formatted_rooms.json using the following structure:
Room Properties
Property
Description
Short
Brief title of the room
Long
Detailed description shown when entering
Exits
Map of directions to destination room IDs
Items
List of items present in the room
Players
List of players currently in the room
Enemies
List of enemies present in the room
ItemDesc
Template for displaying items (uses %s placeholder)
Player Configuration
Player data is stored in world/players.json with the following structure:
Player Properties
Property
Description
Alias
Display name shown to other players
Element
Player's elemental affinity
CurrentRoomID
Room where player is currently located
Brief
Whether player uses brief room descriptions
Troubleshooting
Common Issues
Configuration not loading:
Check file permissions on config/config.ini
Verify the file exists and is readable
Check for syntax errors in the INI format
Enemies not spawning:
Check max instances aren't exceeded
Verify ticks-to-make cooldowns
Confirm valid room ranges
Check spawn probability settings
Too many enemies:
Reduce max-instances in enemy definitions
Increase ticks-to-make cooldowns
Lower SpawnProbability
Enable cleanup routines
Performance problems:
Increase ServerTickSpeed (slower ticks)
Reduce SpawnCheckInterval frequency
Monitor CPU usage during peak times
Consider server hardware upgrades
Cleanup not running:
Verify NightlyCleanupTime format is correct
Check server logs for error messages
Ensure the server has been running long enough to reach the cleanup time
Best Practices
Backup your config: Always backup config.ini before making changes
Test changes: Use --cleanup-every-minute to test cleanup settings
Monitor logs: Check server logs after configuration changes
Gradual changes: Make small incremental changes rather than large ones
Performance testing: Monitor server performance after tick speed changes
Balance gameplay: Ensure spawn rates provide good player experience
Tuning Guidelines
If enemies spawn too frequently:
Increase ticks-to-make values in enemy definitions
SPAWN: DEBUG: rat can spawn (instances: 0/2)
SPAWN: DEBUG: orc at max instances (5/5)
SPAWN: DEBUG: skeleton spawn cooldown active (waited 2s, need 4s)
SPAWN: INFO: Spawned rat in room 750