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. It features both single-player campaigns and online/hotseat multiplayer combat. Running your own Wesnoth multiplayer server allows you to host private games for friends, create custom game communities, and maintain full control over your gaming environment.
The Wesnoth multiplayer daemon (wesnothd) handles game lobbies, player matchmaking, and game state synchronization. It’s lightweight enough to run on modest hardware while supporting dozens of concurrent players in multiple game rooms.
Key highlights of The Battle for Wesnoth Server:
- Multiplayer Game Hosting: Host turn-based strategy matches for friends and community members
- Custom Campaign Support: Run user-created campaigns and scenarios in multiplayer mode
- Lobby System: Built-in game lobby for players to find and join matches
- Observer Mode: Allow spectators to watch ongoing games
- Save/Load Support: Players can save and resume multiplayer games
- Moderation Tools: Ban and kick problematic players from your server
- Era and Faction Support: All official eras and factions available for multiplayer
- Cross-Platform: Players on Windows, macOS, and Linux can all connect
- 100% Open Source: Licensed under GPL with an active development community
This guide walks through deploying a Battle for Wesnoth multiplayer server on Klutch.sh using Docker, configuring game settings, and managing your gaming community.
Why Deploy Wesnoth Server on Klutch.sh
Deploying your Wesnoth server on Klutch.sh provides several advantages for hosting multiplayer games:
Always-On Availability: Your game server remains accessible 24/7, allowing players to connect and start games at any time without waiting for you to manually start the server.
Reliable Connectivity: Klutch.sh provides stable network infrastructure, eliminating common home hosting issues like dynamic IPs, port forwarding, and router configuration.
Simplified Deployment: Push your configuration to GitHub and Klutch.sh handles building and running your server. No complex server administration required.
Persistent Storage: Game saves, ban lists, and server configurations persist across restarts, ensuring continuity for your gaming community.
GitHub Integration: Manage your server configuration through version control, with automatic redeployments when you push changes.
Scalable Resources: Start with minimal resources and scale up as your community grows, paying only for what you need.
Custom Domains: Give your server a memorable address that players can easily share and remember.
Prerequisites
Before deploying 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 containerization concepts
- The Battle for Wesnoth game client installed for testing connections
- (Optional) A custom domain for your game server
Understanding Wesnoth Server Architecture
The Wesnoth multiplayer server (wesnothd) is designed for simplicity and reliability:
Single Binary Daemon: The wesnothd process handles all multiplayer functionality, including lobby management, game synchronization, and player communication.
TCP Networking: Wesnoth uses TCP port 15000 by default for all game traffic, ensuring reliable packet delivery for turn-based gameplay.
In-Memory Game State: Active games are held in memory during play, with optional save states written to disk for game continuation.
Configuration Files: Server behavior is controlled through command-line arguments and optional configuration files.
User Database: Player bans, registered users, and server statistics can be stored persistently.
Preparing Your Repository
Create a GitHub repository containing your Dockerfile and server configuration.
Repository Structure
wesnoth-server/├── Dockerfile├── wesnothd.cfg├── README.md└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM ubuntu:22.04
# Install Wesnoth serverRUN apt-get update && \ apt-get install -y wesnoth-1.18-server && \ apt-get clean && \ rm -rf /var/lib/apt/lists/*
# Create data directoriesRUN mkdir -p /var/lib/wesnoth /var/log/wesnoth
# Copy custom configuration if presentCOPY wesnothd.cfg /etc/wesnoth/wesnothd.cfg
# Set environment variablesENV WESNOTH_PORT=15000ENV WESNOTH_LOG_LEVEL=warning
# Expose the game portEXPOSE 15000
# Create non-root user for running the serverRUN useradd -r -s /bin/false wesnoth && \ chown -R wesnoth:wesnoth /var/lib/wesnoth /var/log/wesnoth
USER wesnoth
# Start the Wesnoth serverCMD ["wesnothd", "-p", "15000", "--config", "/etc/wesnoth/wesnothd.cfg"]Creating the Server Configuration
Create a wesnothd.cfg file with your server settings:
# Wesnoth Server Configuration
# Server identification[server] # Server name shown in the lobby name = "My Wesnoth Server"
# Message of the day shown to connecting players motd = "Welcome to our Wesnoth server! Play fair and have fun."
# Maximum number of simultaneous connections max_connections = 100
# Allow unregistered users allow_unregistered = yes
# Save replays of completed games save_replays = yes
# Replay save directory replay_save_path = /var/lib/wesnoth/replays[/server]
# Administrative settings[admin] # Admin password for remote management (set via environment variable) # password =[/admin]
# Logging configuration[log] # Log file location path = /var/log/wesnoth/wesnothd.log
# Log level: error, warning, info, debug level = warning[/log]Creating the .dockerignore File
Create a .dockerignore file:
.git.github*.mdLICENSE.gitignore*.log.DS_Store.envDeploying Wesnoth Server on Klutch.sh
Follow these steps to deploy your Wesnoth multiplayer server:
- Select TCP as the traffic type
- Set the port to 15000 (Wesnoth’s default port)
- Build your Docker image
- Attach persistent volumes
- Start the Wesnoth server
- Configure TCP networking
Push Your Repository to GitHub
Initialize and push your repository:
git initgit add Dockerfile wesnothd.cfg .dockerignore README.mdgit commit -m "Initial Wesnoth server configuration"git remote add origin https://github.com/yourusername/wesnoth-server.gitgit push -u origin mainCreate a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project. Name it something descriptive like “wesnoth-server” or “game-server”.
Create a New App
Within your project, create a new app. Connect your GitHub account and select the repository containing your Wesnoth Dockerfile.
Configure TCP Traffic
The Wesnoth server uses TCP for game communication. In the deployment settings:
Set Environment Variables
Configure optional environment variables:
| Variable | Value |
|---|---|
WESNOTH_PORT | 15000 |
WESNOTH_LOG_LEVEL | warning |
Attach Persistent Volumes
Add persistent storage for server data:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/var/lib/wesnoth | 5 GB | Game saves, replays, and user data |
/var/log/wesnoth | 1 GB | Server logs |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
Connect and Test
Once deployed, note your server’s address from the Klutch.sh dashboard. Open The Battle for Wesnoth client, go to Multiplayer, and select “Connect to Server”. Enter your server address and port 15000.
Server Administration
Connecting as Administrator
To perform administrative tasks, connect with the admin password:
- Launch The Battle for Wesnoth client
- Navigate to Multiplayer > Connect to Server
- Enter your server address
- Use the
/query admin <password>command in chat
Moderation Commands
Administrators have access to moderation commands:
| Command | Description |
|---|---|
/kick <player> | Remove a player from the server |
/ban <player> | Permanently ban a player |
/unban <player> | Remove a player’s ban |
/mute <player> | Prevent a player from chatting |
/unmute <player> | Restore chat privileges |
/msg <player> <message> | Send a private message |
Managing the Ban List
Bans are stored in the persistent volume at /var/lib/wesnoth/bans.txt. You can manually edit this file or use in-game commands.
Customizing Your Server
Enabling Specific Eras
Restrict your server to specific eras by modifying wesnothd.cfg:
[era] # Only allow Default era allowed = "Default"[/era]Setting Up Tournaments
For tournament play, configure private games:
[tournament] # Require password for game creation require_password = yes
# Limit games to registered players registered_only = yes[/tournament]Message of the Day
Update your MOTD to communicate with players:
[server] motd = "Welcome! Current tournament: Winter Championship. See rules at example.com/rules"[/server]Performance Tuning
Resource Allocation
Wesnoth server is lightweight but consider these guidelines:
| Concurrent Players | Recommended RAM | Recommended CPU |
|---|---|---|
| 1-10 | 256 MB | 0.5 vCPU |
| 10-50 | 512 MB | 1 vCPU |
| 50-100 | 1 GB | 2 vCPU |
Connection Limits
Adjust maximum connections based on your resources:
[server] max_connections = 50 max_games = 20[/server]Monitoring Your Server
Viewing Logs
Access server logs through:
- Klutch.sh Dashboard: View runtime logs in your app’s dashboard
- Persistent Storage: Logs are stored in
/var/log/wesnoth/wesnothd.log
Server Statistics
The server tracks statistics including:
- Total connections
- Games played
- Active players
- Peak concurrent users
Query these with administrative commands in-game.
Troubleshooting Common Issues
Players Cannot Connect
Symptoms: Connection timeout or refused errors.
Solutions:
- Verify TCP traffic type is configured with port 15000
- Check that the server container is running in Klutch.sh dashboard
- Confirm players are using the correct server address
- Test connectivity from your own game client
Server Crashes During Games
Symptoms: All players disconnected mid-game.
Solutions:
- Check logs for error messages
- Increase memory allocation if seeing OOM errors
- Verify persistent volume has available space
- Update to the latest Wesnoth server version
Save Games Not Persisting
Symptoms: Saved games lost after restart.
Solutions:
- Verify
/var/lib/wesnothvolume is attached - Check volume permissions allow writing
- Confirm
save_replaysis enabled in configuration
High Latency
Symptoms: Slow turn synchronization.
Solutions:
- Wesnoth is turn-based, so some latency is normal
- Check server resource utilization
- Reduce maximum concurrent games if overloaded
- Verify network connectivity
Updating Your Server
To update to a newer Wesnoth version:
- Update the package version in your Dockerfile
- Commit and push to trigger redeployment
- Test with a game client after deployment completes
# Update to specific versionRUN apt-get install -y wesnoth-1.18-serverAdditional Resources
- Official Battle for Wesnoth Website
- Wesnoth Multiplayer Server Documentation
- Server Administration Guide
- Wesnoth GitHub Repository
- Wesnoth Community Forums
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
Conclusion
Running your own Battle for Wesnoth server on Klutch.sh gives you complete control over your multiplayer gaming experience. Whether you’re hosting casual games with friends, running competitive tournaments, or building a community around this beloved strategy game, Klutch.sh provides the reliable infrastructure you need.
The combination of persistent storage for game saves and replays, stable networking for player connections, and simple deployment through GitHub integration means you can focus on playing and managing your community rather than server administration.
With cross-platform support, an active player base, and years of content including campaigns, eras, and user-generated content, The Battle for Wesnoth remains one of the best open-source strategy games available. Your own dedicated server takes the experience to the next level.