Files
ZomboidForge/README.md
T
OverlordandClaude Bot 43df96391c
ci / image (42, public) (push) Successful in 3m23s
Update README
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 15:32:34 +02:00

162 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ZomboidForge
An official‑client‑compatible, container‑ready Project Zomboid dedicated server with
first‑class support for custom Java mods and drop‑in server builds.
## Building
The container image downloads the vanilla dedicated server (Steam app 380870) with an
anonymous steamcmd login while it builds, and patches it. No game files are part of this
repository. The build fails when the downloaded server is not the Project Zomboid
version in `gradle.properties` (`pz.version`).
```sh
podman build --platform linux/amd64 -t zomboidforge . # or: docker build ...
```
| Build argument | Default | |
|--------------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `PZ_BRANCH` | `public` | Steam branch: `public`, `unstable`, or a version branch such as `42.19` |
| `PZ_VERSION` | `pz.version` | Expected Project Zomboid version |
| `STEAMCLIENT` | `bundled` | `steamcmd` replaces the server's `steamclient.so` files with steamcmd's newer copies (workaround for failing Workshop downloads) |
| `FORGE_VERSION` | `0.0.0-prerelease` | ZomboidForge version (jar manifest, image label). The build stage has no `git`, so the version is never read from a tag there; `ci/release.sh` passes it |
| `DISABLED_PATCHES` | | Comma-separated simple class names of build-time patches to skip (debug builds only), e.g. `IsoZombieVehiclePerformancePatch` |
> [!NOTE]
> Published images are tagged `<forge>-pz<major.minor.build>`, `<forge>-pz<major.minor>`, and `latest`. <br>
> A new image is built for every ZomboidForge release and every Project Zomboid version,
> hotfixes included, as the server only admits client with the exact same version.
## Running
```sh
podman run -d --name zomboidforge \
-e ADMIN_PASSWORD=... -e RCON_PASSWORD=... \
-p 16261:16261/udp -p 16262:16262/udp -p 127.0.0.1:27015:27015/tcp \
-v zomboid-data:/data zomboidforge
```
Unset variables keep the value in the server `.ini` (or the game default).
| Variable | Default | |
|-------------------------------|--------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| `SERVER_NAME` | `zomboidforge` | Server config name (`/data/Server/<name>.ini`) |
| `SERVER_PASSWORD` | | Password clients need to join (`.ini` `Password`) |
| `PUBLIC` | | `true`/`false`: listed in the in-game server browser |
| `PUBLIC_NAME` | | Name in the server browser |
| `PORT` | `16261` | Game port (`-port`) |
| `UDP_PORT` | `16262` | Direct connection port (`-udpport`) |
| `UPNP` | | `true`/`false`: UPnP port mapping on the router (`.ini` `UPnP`); `false` recommended (see below) |
| `ADMIN_USERNAME` | `admin` | First start only |
| `ADMIN_PASSWORD` | | Required on the first start, ignored afterwards |
| `SERVER_PRESET` | | Sandbox preset for a new server: `Apocalypse`, `Extinction`, `Outbreak`, `Rising`, `SixMonthsLater` |
| `MODS` | | Mod IDs, Build 42 format: `\ModA;\ModB` |
| `WORKSHOP_ITEMS` | | Workshop item IDs: `123;456` |
| `RCON_PASSWORD` | | Written into the `.ini` on every start; RCON is disabled without it |
| `JVM_MIN_HEAP` | JVM default | `-Xms`; unused heap memory is returned to the system only down to this size |
| `JVM_MAX_HEAP` | 75 % of the memory limit | `-Xmx`; `8g` when the container has no memory limit |
| `JVM_UNCOMMIT_DELAY` | `60` | Seconds after which unused heap memory is returned to the system (`-XX:ZUncommitDelay`) |
| `STEAM` | `1` | `0` runs the server without Steam |
| `SOFT_RESET` | | `true` starts once in soft reset mode (`-Dsoftreset`); unset it afterwards |
| `ZF_EXPERIMENTAL_PERFORMANCE` | `false` | `true`/`false`: performance changes that alter timing or resource use (more threads, shorter waits); overrides `forge.toml` |
Notes:
- **Ports:** host and container ports must be the same. The server announces its own
port, so `-p 17000:16261/udp` is unreachable; set `PORT=17000` and publish
`17000:17000/udp` instead.
- **Data:** `/data` holds the server config, saves, database, logs, and downloaded Workshop
items (`/data/steamapps`). The server runs as UID 1000. A bind-mounted host directory
must be writable by UID 1000 (`chown 1000:1000 <dir>`); with rootless Podman, use
`--userns=keep-id:uid=1000,gid=1000` to map it to your own user.
- **UPnP:** the game enables UPnP by default. In a container the server sees only its own
container address and cannot map the host's ports, and the router search delays every start
by about 12 s; set `UPNP=false` and publish the ports instead.
- **Memory:** with a memory limit (`--memory`, `mem_limit`), the heap gets 75 % of it and the
rest stays for native memory. The startup briefly needs a large heap; with 8 players
exploring, the heap held up to 4.4 GB of live data in tests. A limit below about 6 GB is
not recommended. Without a limit the heap is `8g`, as in vanilla.
- **Stopping:** `SIGTERM` triggers the game's own save-and-quit. Allow enough time for large worlds.
For local testing use `compose.yaml` (`podman compose up --build`, settings from `.env`).
## Mods
ZomboidForge loads server-side Java mods. They run only on the server, so players keep the
official, unmodified client. Project Zomboid's own Lua and Workshop mods are configured as
usual with `MODS` and `WORKSHOP_ITEMS`.
### Installing mods
Mount a directory at `/forge` with one folder per mod:
```
forge/
├── forge.toml optional global settings
└── mods/
└── <id>/
├── <id>.jar the mod
├── lib/*.jar libraries of the mod (optional)
└── config.toml settings of the mod (optional)
```
```sh
podman run ... -v ./forge:/forge zomboidforge
```
> [!WARNING]
> Mods are trusted code. <br>
> They run inside the server process with its full privileges, which means they can
> read and write any file the server can, open network connections, and stop the server. <br>
> The class loader isolation and the startup checks catch mistakes; they do not contain
> or restrict a malicious mod.
>
> Install only mods whose authors you trust, or whose code you can verify yourself!
Mods keep their data in `zomboidforge.db` in the world's save folder
(`/data/Saves/Multiplayer/<server>/`). Vanilla backups include it, and deleting the world
deletes it.
A mod that cannot be loaded stops the server with exit code 1, and the log lists every
problem. For example, a missing or too old dependency, an unsupported game version,
game classes or methods that do not exist in the running version, invalid settings,
or an exception in the mod's startup code. Changes to mods and their settings take
effect when the server restarts.
`forge.toml`, every key optional:
```toml
[main_thread]
budget_ms = 2 # time per tick for tasks that mods hand to the main thread
[shutdown]
timeout_s = 10 # time the mods' threads get to finish when the server stops
[features]
experimental_performance = false # default false; ZF_EXPERIMENTAL_PERFORMANCE takes precedence when set
```
### Mod development
Writing a mod (descriptor, entry point, threads, events, settings, startup checks):
[MOD_DEVELOPMENT.md](MOD_DEVELOPMENT.md).
## Development
Requires JDK 25 (the game's runtime). The Gradle build compiles against a local vanilla
server jar, `lib/server/java/projectzomboid.jar` by default (override with `-Ppz.jar=...`).
```sh
./gradlew build # compile + tests
./gradlew :patcher:patchServerJar # -> patcher/build/server/projectzomboid.jar
```
> [!IMPORTANT]
> Game-specific code lives in `compat/b<major>/`; `api` and `core` are version-independent. <br>
> `pz.version` in `gradle.properties` selects the targeted version. <br>
> `mod-tools` (the build-time mod checks) and `gradle-plugin` (the plugin for mod authors)
> are for mod builds, not the server.
Release tags publish `api`, `mod-tools`, and the Gradle plugin to the Gitea Maven registry
(`.gitea/workflows/publish.yml`, `ci/publish.sh`); tags with a `-` are only tested.