#
ageLANServer
**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.
This template covers the original three games. It has no BattleServer; for Age of Empires IV or Age of
Mythology: Retold use [ageLANServer-BattleServer](../ageLANServer-BattleServer/README.md).
**Template:** [`templates/ageLANServer.xml`](../templates/ageLANServer.xml)
**Image:** `ghcr.io/indyone/agelanserver`
**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
## 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/certificates` | SSL certificates, generated on first run. Keep it so they survive restarts. |
| Config Path | `/app/resources/config` | `/mnt/user/appdata/agelanserver/config` | Server configuration (see [config.toml](#configtoml)). |
| Logs Path | `/app/logs` | `/mnt/user/appdata/agelanserver/logs` | Log files. Add `--log` to Post Arguments for detailed 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 |
The template uses **host** networking. Port `443` must be free on the host.
### 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`, 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-aoe2/...`.
- Name each container after its game: `agelanserver-aoe2`, `agelanserver-aoe3`, ...
## Playing the game
### Hosting a game
When you create a lobby:
- Choose **Use Local Lan Server** in the game's Server list.
### 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 **Use Local Lan Server** when creating the lobby.
- **The container keeps restarting.** Open the container's log. Port `443` 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 the [ageLANServer-BattleServer](../ageLANServer-BattleServer/README.md)
image, which runs the game's own `BattleServer.exe` under Wine next to the server.
- **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).