# ageLANServer-BattleServer **ageLANServer** is a LAN server emulator for the Age of Empires Definitive Edition games, developed by [luskaner](https://github.com/luskaner/ageLANServer). It replaces the online services (accounts, profiles and the lobby list) with a server running on your Unraid box, so you can play multiplayer over your local network without an internet connection. The game on each PC connects to it with a launcher. A **BattleServer** is the program that runs a match while it is played. `BattleServer.exe` ships with the game and relays the game traffic between the players. Normally the host's own PC runs it; with a BattleServer on the server, matches do not depend on one player's PC. Age of Empires IV and Age of Mythology: Retold only work this way. **This template is the same as [ageLANServer](../ageLANServer/README.md) plus a BattleServer** running inside the same container. It includes Wine to run the Windows `BattleServer.exe`, so the download is about 1.3 GB. For the original three games alone, ageLANServer is enough. **Template:** [`templates/ageLANServer-BattleServer.xml`](../templates/ageLANServer-BattleServer.xml) **Image:** `ghcr.io/indyone/agelanserver-battleserver` **Upstream:** [luskaner/ageLANServer](https://github.com/luskaner/ageLANServer) ## Supported games - Age of Empires: Definitive Edition - Age of Empires II: Definitive Edition - Age of Empires III: Definitive Edition - Age of Empires IV: Anniversary Edition (requires a BattleServer) - Age of Mythology: Retold (requires a BattleServer) ## Configuring the Unraid template ### Settings | Setting | Container path / variable | Default | Purpose | |---------|---------------------------|---------|---------| | Game | `GAMES` | `age2` | The game this container serves (see below). | | Certificates Path | `/app/resources/certificates` | `/mnt/user/appdata/agelanserver-battleserver/certificates` | SSL certificates, generated on first run. Keep it so they survive restarts. | | Config Path | `/app/resources/config` | `/mnt/user/appdata/agelanserver-battleserver/config` | Server configuration (see [config.toml](#configtoml)). | | BattleServer Folder | `/app/battleserver` | `/mnt/user/appdata/agelanserver-battleserver/battleserver` | Folder with `BattleServer.exe` (see [below](#providing-battleserverexe)). | | Logs Path | `/app/logs` | `/mnt/user/appdata/agelanserver-battleserver/logs` | Server and BattleServer logs. Add `--log` to Post Arguments for detailed server logging. | Each container runs **one game**. Set `GAMES` to one of: | `GAMES` value | Game | |---------------|------| | `age1` | Age of Empires: Definitive Edition | | `age2` (default) | Age of Empires II: Definitive Edition | | `age3` | Age of Empires III: Definitive Edition | | `age4` | Age of Empires IV: Anniversary Edition | | `athens` | Age of Mythology: Retold | The template uses **host** networking. Port `443` and TCP ports `27012`, `27112` and `27212` (the BattleServer) must be free on the host. If the BattleServer stops, the container stops, so its restart policy brings both back. ### Providing BattleServer.exe `BattleServer.exe` ships with the game and cannot be redistributed. Copy it from your own install into the **BattleServer Folder**; it starts automatically with the container. Use the one from the game the container serves, except for two games: - **Age of Empires IV** does not ship a `BattleServer.exe`. - **Age of Mythology: Retold** ships one that is buggy. For both, use the `BattleServer.exe` from Age of Empires II: DE, the newer version. Do not also add a BattleServer for the same game in `config.toml`. ### config.toml On the first start the config folder is filled with the per-game folders (do not delete them) and a fully commented `config.toml.example`. Rename it to `config.toml`, edit it, and restart the container. ### Multiple games Each container serves one game, so for several games run one container per game: - With host networking only one container can use port `443` and the BattleServer ports, so create an **ipvlan L2** network (Settings > Docker > Docker custom networks) and give each container its own LAN IP. ipvlan is preferred over macvlan because it does not need promiscuous mode. - Use separate appdata folders for each container, for example `.../appdata/agelanserver-battleserver-aoe4/...`. - Name each container after its game: `agelanserver-battleserver-aoe4`, `agelanserver-battleserver-aoe2`, ... ## Playing the game ### Hosting a game When you create a lobby: - Choose **Server** in the game's Server list to use the BattleServer in this container. - Alternatively, choose **Use Local Lan Server** to run the match on your own PC. ### Connecting from your PC Use the [launcher](https://github.com/luskaner/ageLANServer/tree/main/launcher) from the [upstream releases](https://github.com/luskaner/ageLANServer/releases). In `resources/config.toml` set: ```toml [Server] Start = 'false' Host = '' ``` Then run the game's start script (for example `start_age2.bat`) **as administrator**. The launcher points the game at your server and undoes its changes when you quit. ## Troubleshooting - **Multiplayer is greyed out.** The server's data is for the newest game build. Update the game (check it is the copy the launcher starts). - **"Could not create game. Unknown error".** Choose **Server** (or **Use Local Lan Server**) when creating the lobby. - **The container stops right after starting.** For `age4` and `athens` the BattleServer Folder must contain `BattleServer.exe`. Open the container's log. - **The container keeps restarting.** Open the container's log. Port `443` and the BattleServer ports must be free on the host. ## About the image ageLANServer is developed by [luskaner](https://github.com/luskaner/ageLANServer). The Docker image comes from my fork, [indyone/ageLANServer](https://github.com/indyone/ageLANServer): - **Kept in sync with upstream.** A GitHub Actions workflow merges `luskaner/ageLANServer` into the fork every day, and every change to the source rebuilds the images and publishes them to the GitHub Container Registry. - **The server itself is untouched.** The fork only adds files: a Docker setup under [`tools/server-docker-unified`](https://github.com/indyone/ageLANServer/tree/main/tools/server-docker-unified) and the build workflows. What the fork adds so that it works well on Unraid: - **One image instead of two.** Upstream's Docker setup runs the certificate generator and the server as separate containers. Here they are combined: the SSL certificates are generated on the first start and reused afterwards. - **Volumes that work with Unraid shares.** Per-game config files and a commented `config.toml.example` are placed into the config folder on first run, so a bind-mounted appdata folder works from the start. - **One game per container**, chosen with the `GAMES` variable, so several games never fight over port `443` or the UDP discovery port. - **An optional BattleServer**, in this image, which runs the game's own `BattleServer.exe` under Wine next to the server. The [ageLANServer](../ageLANServer/README.md) template uses the image without it. - **The Unraid templates** in this repository. ## Support - **Unraid setup** (this template, the Docker image, volumes, networking, installing on Unraid): [open an issue here](https://github.com/indyone/unraid-templates/issues). - **The server software itself** (game behaviour, launcher, bugs, feature requests): supported by its original author, [luskaner/ageLANServer issues](https://github.com/luskaner/ageLANServer/issues).