Deploying The Battle for Wesnoth Server
Introduction
The Battle for Wesnoth is a free, open-source turn-based strategy game with a high fantasy theme. The game features deep tactical combat, numerous campaigns, and a thriving multiplayer community. By hosting your own Wesnoth multiplayer server, you can create private gaming sessions with friends, run tournaments, or build a community around your server.
Key features of The Battle for Wesnoth server include:
- Multiplayer Game Hosting: Host simultaneous multiplayer matches for your community
- Campaign Support: Play cooperative campaigns with friends
- Custom Scenarios: Support for user-created maps and scenarios
- Persistent Lobbies: Players can gather, chat, and organize games
- Add-on Support: Compatible with community add-ons and modifications
- Cross-Platform: Players on Windows, macOS, and Linux can all connect
- Open Source: Licensed under GPLv2 with an active development community
This guide walks you through deploying a Wesnoth multiplayer server on Klutch.sh, configuring server settings, and managing your gaming community.
Why Deploy Wesnoth Server on Klutch.sh
Deploying The Battle for Wesnoth server on Klutch.sh provides several benefits:
Always-On Availability: Your server remains accessible 24/7, allowing players to connect and play whenever they want without depending on your local machine.
Simplified Deployment: Klutch.sh handles container orchestration, letting you focus on managing your gaming community rather than server infrastructure.
Persistent Storage: Game saves, replays, and server configuration persist across restarts and redeployments.
Global Accessibility: Players from anywhere can connect to your Klutch.sh-hosted server with consistent performance.
Scalable Resources: Allocate resources based on expected player count and adjust as your community grows.
Prerequisites
Before deploying The Battle for Wesnoth server on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your server configuration
- Basic familiarity with Docker and game server administration
- The Battle for Wesnoth client installed for testing (same version as server)
Understanding Wesnoth Server Architecture
The Wesnoth server (wesnothd) handles:
Game Lobby: A central hub where players can chat, view available games, and create new matches.
Match Coordination: Manages active games, synchronizing turns between players and handling disconnections.
Replay Recording: Optionally records game replays for later viewing.
Add-on Compatibility: Ensures players have compatible versions of add-ons for the games they join.
Preparing Your Repository
Create a GitHub repository with the following structure:
wesnoth-server/├── Dockerfile├── .dockerignore└── config/ └── wesnothd.cfgCreating the Dockerfile
FROM ubuntu:22.04
# Install Wesnoth serverRUN apt-get update && apt-get install -y \ wesnoth-1.16-server \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*
# Create server directoriesRUN mkdir -p /var/lib/wesnoth /var/log/wesnoth /etc/wesnoth
# Copy server configurationCOPY config/wesnothd.cfg /etc/wesnoth/wesnothd.cfg
# Create non-root user for securityRUN useradd -r -s /bin/false wesnoth \ && chown -R wesnoth:wesnoth /var/lib/wesnoth /var/log/wesnoth
# Expose the game server portEXPOSE 15000
# Switch to non-root userUSER wesnoth
# Start the Wesnoth serverCMD ["wesnothd", "-c", "/etc/wesnoth/wesnothd.cfg", "-p", "15000"]Server Configuration File
Create config/wesnothd.cfg:
# Wesnoth Server Configuration
# Server identification[server] # Server name shown in the lobby name = "My Wesnoth Server"
# Message of the day motd = "Welcome to our Wesnoth server! Have fun and play fair."
# Maximum number of simultaneous connections max_connections = 100
# Allow registered users only (false = allow guests) registered_users_only = false
# Enable replays save_replays = true replay_save_path = "/var/lib/wesnoth/replays"
# Logging log_level = info[/server]
# Banning configuration[ban_times] # Default ban duration in minutes default = 1440
# Maximum ban duration max = 43200[/ban_times]Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
WESNOTH_PORT | No | 15000 | Port for game connections |
MAX_CONNECTIONS | No | 100 | Maximum simultaneous players |
SERVER_NAME | No | Wesnoth Server | Name shown in server list |
Deploying on Klutch.sh
- Traffic type: TCP
- Internal port: 15000
Push Your Repository to GitHub
Commit and push your Dockerfile and configuration to GitHub.
Create a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project named “wesnoth-server” or similar.
Create the Wesnoth Server App
Within your project, create a new app and connect your GitHub repository.
Configure TCP Traffic
The Wesnoth server uses TCP connections. Configure:
Attach Persistent Volumes
Add persistent storage for game data:
| Mount Path | Size | Purpose |
|---|---|---|
/var/lib/wesnoth | 5 GB | Replays and game data |
/var/log/wesnoth | 1 GB | Server logs |
Deploy Your Application
Click Deploy to build and launch your Wesnoth server.
Connect and Test
Launch the Wesnoth client and connect to your server using the provided hostname and port 15000.
Server Administration
Connecting to Your Server
Players connect through the Wesnoth game client:
- Launch The Battle for Wesnoth
- Select “Multiplayer”
- Choose “Connect to Server”
- Enter your server address (e.g.,
your-app-name.klutch.sh:15000) - Join the lobby and create or join games
Managing Players
Server administrators can manage players through in-game commands:
| Command | Description |
|---|---|
/kick <player> | Remove a player from the server |
/ban <player> | Ban a player temporarily |
/unban <player> | Remove a ban |
/mute <player> | Prevent a player from chatting |
/unmute <player> | Restore chat privileges |
/adminmsg <message> | Send a message as admin |
Moderator Privileges
Assign moderators to help manage your community:
- Edit the server configuration to add admin accounts
- Moderators can access admin commands in-game
- Keep the moderator list updated as your community evolves
Game Configuration
Version Compatibility
Ensure your server version matches the clients:
- Players must use the same major version as the server
- Minor version differences may cause compatibility issues
- Communicate the required version to your community
Add-on Support
Custom content requires coordination:
- Players need matching add-ons to join games using them
- Consider creating an approved add-on list for your server
- Test add-ons for compatibility before recommending them
Map and Scenario Settings
Configure available content:
- Standard maps are included by default
- User-created maps can be added to the server
- Scenario restrictions can be set in configuration
Production Best Practices
Security Recommendations
- Rate Limiting: Configure connection limits to prevent abuse
- Ban Management: Maintain a ban list for problematic users
- Moderator Team: Assign trusted community members as moderators
- Log Monitoring: Review logs regularly for suspicious activity
Performance Optimization
- Resource Allocation: Allocate adequate CPU and memory for expected player count
- Connection Limits: Set reasonable maximum connections
- Replay Management: Periodically clean old replays to save storage
Community Management
Building a healthy gaming community:
- Establish clear rules and post them in the MOTD
- Respond promptly to player reports
- Encourage fair play and sportsmanship
- Organize regular events or tournaments
Troubleshooting
Players Cannot Connect
- Verify the server is running in the Klutch.sh dashboard
- Check that TCP port 15000 is properly configured
- Ensure players are using a compatible game version
- Review server logs for connection errors
Game Desync Issues
- Ensure all players have matching add-ons
- Check for version mismatches
- Review network stability for affected players
Server Crashes
- Check memory and CPU usage
- Review logs for error messages
- Reduce maximum connections if resource-constrained
- Ensure persistent volumes are properly mounted
Replays Not Saving
- Verify the replay directory has write permissions
- Check available disk space
- Confirm replay saving is enabled in configuration
Additional Resources
- The Battle for Wesnoth Official Website
- Wesnoth Server Documentation
- Wesnoth GitHub Repository
- Wesnoth Community Forums
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
Conclusion
Deploying The Battle for Wesnoth server on Klutch.sh allows you to create a private multiplayer environment for friends or build a community around the game. With always-on availability, persistent storage for replays, and simplified deployment, you can focus on enjoying the game and managing your community rather than dealing with server infrastructure. Whether hosting casual games with friends or organizing competitive tournaments, your Klutch.sh-hosted Wesnoth server provides a reliable platform for turn-based strategy gaming.