-
Notifications
You must be signed in to change notification settings - Fork 5
Configuration
Andrey Klyuev edited this page Aug 13, 2025
·
1 revision
This document explains all configuration options available in SphereEmu.
Main server configuration file with all runtime settings.
{
"PacketPartPath": "D:\\SphereDev\\SphereSource\\source\\sphPacketDefinitions",
"PacketDefinitionPath": "D:\\SphereDev\\SphereSource\\source\\sphPacketDefinitions",
"LiteDbConnectionString": "Filename=d:\\SphereDev\\_sphereStuff\\sph.db;Connection=shared;",
"Port": "25860",
"LogPath": "logs\\server.log",
"DebugMode": "true",
"ObjectVisibilityDistance": "100.0",
"ReceiveBufferSize": "1024",
"CurrentCharacterInventoryId": "40961",
"Spawn_X": "80.0",
"Spawn_Y": "150.0",
"Spawn_Z": "200.0",
"Spawn_Angle": "0.75",
"Spawn_Money": "99999999"
}- Purpose: TCP port the server listens on for client connections
-
Example:
"Port": "25860" - Notes: Must be available and not blocked by firewall
- Purpose: Buffer size for receiving network packets
-
Example:
"ReceiveBufferSize": "2048" - Notes: Larger buffers can handle bigger packets but use more memory
- Purpose: Connection string for LiteDB database
-
Example:
"LiteDbConnectionString": "Filename=./data/sph.db;Connection=shared;" -
Notes:
-
Filename: Path to database file (created if doesn't exist) -
Connection=shared: Allows multiple connections to same database
-
- Purpose: Directory containing packet part definitions
-
Example:
"PacketPartPath": "./packets/parts" - Notes: Used for packet serialization/deserialization
- Purpose: Directory containing packet definitions
-
Example:
"PacketDefinitionPath": "./packets/definitions" - Notes: Defines packet structure and format
- Purpose: Base path for log files (timestamped files will be created)
-
Example:
"LogPath": "logs\\server.log" -
Notes:
- Creates timestamped files like
server_20241220_143022.log - Automatically manages log rotation (keeps latest 20 files)
- Directory is created automatically if it doesn't exist
- Creates timestamped files like
- Purpose: Enables additional debug logging and features
-
Example:
"DebugMode": "false" -
Notes:
-
true: More verbose logging, debug features enabled -
false: Production mode, minimal debug output
-
- Purpose: Distance at which objects become visible to players
-
Example:
"ObjectVisibilityDistance": "150.0" - Notes: Affects performance vs. gameplay visibility tradeoff
- Purpose: Default inventory ID for character items
-
Example:
"CurrentCharacterInventoryId": "40962" - Notes: Hexadecimal value 0xA001 = decimal 40961
- Purpose: Default X coordinate for new character spawn
-
Example:
"Spawn_X": "100.5"
- Purpose: Default Y coordinate for new character spawn
-
Example:
"Spawn_Y": "200.0" - Notes: Y is typically the vertical/height coordinate
- Purpose: Default Z coordinate for new character spawn
-
Example:
"Spawn_Z": "250.0"
- Purpose: Default facing angle for new character spawn
-
Example:
"Spawn_Angle": "1.57" - Notes: Angle in radians (0.75 ≈ 43 degrees)
- Purpose: Starting money for new characters
-
Example:
"Spawn_Money": "10000" - Notes: Game currency amount
- If
appsettings.jsondoesn't exist, it's created with default values - Missing configuration keys are automatically added with defaults
- Server logs when configuration is created or updated
- Configuration is loaded once at server startup
- Changes to
appsettings.jsonrequire server restart - Invalid values will cause server startup failure with error message
You can create multiple configuration files for different environments:
appsettings.json # Default/Production
appsettings.dev.json # Development
appsettings.test.json # Testing- Numeric values are validated at startup
- Invalid paths will cause initialization errors
- Database connection is tested during startup
{
"Port": "25860",
"DebugMode": "true",
"LogPath": "logs\\dev-server.log",
"Spawn_Money": "999999",
"ObjectVisibilityDistance": "200.0"
}{
"Port": "25860",
"DebugMode": "false",
"LogPath": "logs\\server.log",
"Spawn_Money": "1000",
"ObjectVisibilityDistance": "100.0",
"ReceiveBufferSize": "2048"
}- Use appropriate file permissions for configuration files
- Database files should not be publicly accessible
- Consider using environment variables for sensitive data
- Regular backup of database files is recommended
-
Higher
ReceiveBufferSize: Better for high-traffic servers -
Lower
ObjectVisibilityDistance: Better performance, less visibility -
Disable
DebugMode: Better performance in production - Adjust spawn coordinates: Based on your game world layout
-
Port already in use: Change
Portto an available port - Database access denied: Check file permissions on database path
- Log directory creation failed: Ensure write permissions to log directory
- Invalid numeric values: Check format matches expected type (int/float/bool)
- Configuration errors are logged to console during startup
- Database connection errors are logged with specific details
- Network binding errors include port and system error information
The server validates all configuration values at startup and will log specific errors for:
- Invalid numeric formats
- Inaccessible file paths
- Network configuration issues
- Database connection problems
-
Server
- SphereServer
- Connection Handling
- Authentication
- Configuration
-
Client
- SphereClient
- Client States
- Networking
-
Shared
- Database
- Logging
- Game Data
- BitStream
- Development Setup
- Code Standards
- Testing Guidelines
- Debugging Guide
- Configuration Options
- API Documentation
- Database Schema
- Packet Definitions