Updated server configuration; add UPnP and JVM memory options, and enhance startup behaviour with dynamic memory allocation and ZUncommitDelay settings.
This commit is contained in:
1 parent
151e1d459f
commit
05eed7e205
4 files changed
+132
-62
No files matched your search
+10
-4
@@ -142,7 +142,9 @@ public final class ShopMod extends Mod
|
|||||||
@Override
|
@Override
|
||||||
public void onLoad() // main thread, registration only
|
public void onLoad() // main thread, registration only
|
||||||
{
|
{
|
||||||
this.events().onMain(TickEvent.class, event -> { /* every frame, on the main thread */ });
|
this.events().onMain(TickEvent.class, event -> {
|
||||||
|
/* every frame, on the main thread */
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -150,8 +152,12 @@ public final class ShopMod extends Mod
|
|||||||
{
|
{
|
||||||
this.modThread().scheduleAtFixedRate(() -> {
|
this.modThread().scheduleAtFixedRate(() -> {
|
||||||
// on zf-mod-shop: slow work, no game objects
|
// on zf-mod-shop: slow work, no game objects
|
||||||
this.main().submit(GameServer::getPlayerCount) // game objects only on the main thread
|
this.main()
|
||||||
.thenAcceptAsync(players -> this.logger().log(INFO, players + " online"), this.modThread());
|
.submit(GameServer::getPlayerCount) // game objects only on the main thread
|
||||||
|
.thenAcceptAsync(
|
||||||
|
players -> this.logger().log(INFO, players + " online"),
|
||||||
|
this.modThread()
|
||||||
|
);
|
||||||
}, Duration.ZERO, Duration.ofMinutes(1));
|
}, Duration.ZERO, Duration.ofMinutes(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +168,7 @@ public final class ShopMod extends Mod
|
|||||||
|
|
||||||
## Services
|
## Services
|
||||||
|
|
||||||
Methods of `Mod`, usable from the constructor on (also in field initializers):
|
Methods of `Mod`, usable from the constructor on, and in field initializers:
|
||||||
|
|
||||||
| Method | Returns | Use |
|
| Method | Returns | Use |
|
||||||
|--------------------|------------------|---------------------------------------------------------------|
|
|--------------------|------------------|---------------------------------------------------------------|
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ podman build --platform linux/amd64 -t zomboidforge . # or: docker build ...
|
|||||||
| `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 |
|
| `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` |
|
| `DISABLED_PATCHES` | | Comma-separated simple class names of build-time patches to skip (debug builds only), e.g. `IsoZombieVehiclePerformancePatch` |
|
||||||
|
|
||||||
Published images are tagged `<forge>-pz<major.minor.build>` (never overwritten),
|
> [!NOTE]
|
||||||
`<forge>-pz<major.minor>` (the newest hotfix of that minor version), and `latest`. A new image
|
> Published images are tagged `<forge>-pz<major.minor.build>`, `<forge>-pz<major.minor>`, and `latest`. <br>
|
||||||
is built for every ZomboidForge release and every Project Zomboid version, hotfixes included:
|
> A new image is built for every ZomboidForge release and every Project Zomboid version,
|
||||||
the server only admits clients with the same version.
|
> hotfixes included, as the server only admits client with the exact same version.
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
@@ -38,24 +38,26 @@ podman run -d --name zomboidforge \
|
|||||||
|
|
||||||
Unset variables keep the value in the server `.ini` (or the game default).
|
Unset variables keep the value in the server `.ini` (or the game default).
|
||||||
|
|
||||||
| Variable | Default | |
|
| Variable | Default | |
|
||||||
|-------------------|----------------|-----------------------------------------------------------------------------------------------------|
|
|----------------------|--------------------------|-----------------------------------------------------------------------------------------------------|
|
||||||
| `SERVER_NAME` | `zomboidforge` | Server config name (`/data/Server/<name>.ini`) |
|
| `SERVER_NAME` | `zomboidforge` | Server config name (`/data/Server/<name>.ini`) |
|
||||||
| `SERVER_PASSWORD` | | Password clients need to join (`.ini` `Password`) |
|
| `SERVER_PASSWORD` | | Password clients need to join (`.ini` `Password`) |
|
||||||
| `PUBLIC` | | `true`/`false`: listed in the in-game server browser |
|
| `PUBLIC` | | `true`/`false`: listed in the in-game server browser |
|
||||||
| `PUBLIC_NAME` | | Name in the server browser |
|
| `PUBLIC_NAME` | | Name in the server browser |
|
||||||
| `PORT` | `16261` | Game port (`-port`) |
|
| `PORT` | `16261` | Game port (`-port`) |
|
||||||
| `UDP_PORT` | `16262` | Direct connection port (`-udpport`) |
|
| `UDP_PORT` | `16262` | Direct connection port (`-udpport`) |
|
||||||
| `ADMIN_USERNAME` | `admin` | First start only |
|
| `UPNP` | | `true`/`false`: UPnP port mapping on the router (`.ini` `UPnP`); `false` recommended (see below) |
|
||||||
| `ADMIN_PASSWORD` | | Required on the first start, ignored afterwards |
|
| `ADMIN_USERNAME` | `admin` | First start only |
|
||||||
| `SERVER_PRESET` | | Sandbox preset for a new server: `Apocalypse`, `Extinction`, `Outbreak`, `Rising`, `SixMonthsLater` |
|
| `ADMIN_PASSWORD` | | Required on the first start, ignored afterwards |
|
||||||
| `MODS` | | Mod IDs, Build 42 format: `\ModA;\ModB` |
|
| `SERVER_PRESET` | | Sandbox preset for a new server: `Apocalypse`, `Extinction`, `Outbreak`, `Rising`, `SixMonthsLater` |
|
||||||
| `WORKSHOP_ITEMS` | | Workshop item IDs: `123;456` |
|
| `MODS` | | Mod IDs, Build 42 format: `\ModA;\ModB` |
|
||||||
| `RCON_PASSWORD` | | Written into the `.ini` on every start; RCON is disabled without it |
|
| `WORKSHOP_ITEMS` | | Workshop item IDs: `123;456` |
|
||||||
| `JVM_MIN_HEAP` | `JVM_MAX_HEAP` | `-Xms` |
|
| `RCON_PASSWORD` | | Written into the `.ini` on every start; RCON is disabled without it |
|
||||||
| `JVM_MAX_HEAP` | `8g` | `-Xmx` |
|
| `JVM_MIN_HEAP` | JVM default | `-Xms`; unused heap memory is returned to the system only down to this size |
|
||||||
| `STEAM` | `1` | `0` runs the server without Steam |
|
| `JVM_MAX_HEAP` | 75 % of the memory limit | `-Xmx`; `8g` when the container has no memory limit |
|
||||||
| `SOFT_RESET` | | `true` starts once in soft reset mode (`-Dsoftreset`); unset it afterwards |
|
| `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 |
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
@@ -66,10 +68,16 @@ Notes:
|
|||||||
items (`/data/steamapps`). The server runs as UID 1000. A bind-mounted host directory
|
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
|
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.
|
`--userns=keep-id:uid=1000,gid=1000` to map it to your own user.
|
||||||
- **Stopping:** `SIGTERM` triggers the game's own save-and-quit. Allow enough time for large
|
- **UPnP:** the game enables UPnP by default. In a container the server sees only its own
|
||||||
worlds (`podman stop -t 120`, `stop_grace_period` in compose).
|
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 there is `compose.yaml` (`podman compose up --build`, settings from `.env`).
|
For local testing use `compose.yaml` (`podman compose up --build`, settings from `.env`).
|
||||||
|
|
||||||
## Mods
|
## Mods
|
||||||
|
|
||||||
@@ -95,24 +103,24 @@ forge/
|
|||||||
podman run ... -v ./forge:/forge zomboidforge
|
podman run ... -v ./forge:/forge zomboidforge
|
||||||
```
|
```
|
||||||
|
|
||||||
Mods are trusted code. They run inside the server process with its full privileges: they can
|
> [!WARNING]
|
||||||
read and write any file the server can, open network connections, and stop the server. The
|
> Mods are trusted code. <br>
|
||||||
class loader isolation and the startup checks catch mistakes; they do not contain a malicious
|
> They run inside the server process with its full privileges, which means they can
|
||||||
mod. Install only mods whose authors you trust.
|
> 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
|
||||||
A mod's settings live in its `config.toml`. When the file is missing, it is created from the
|
> or restrict a malicious mod.
|
||||||
mod's defaults if the folder is writable by UID 1000; otherwise the defaults are used without a
|
>
|
||||||
file. Keys missing from `config.toml` take the default. `enabled = false` in its `[forge]`
|
> Install only mods whose authors you trust, or whose code you can verify yourself!
|
||||||
table switches the mod off; mods that depend on it then fail to load.
|
|
||||||
|
|
||||||
Mods keep their data in `zomboidforge.db` in the world's save folder
|
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
|
(`/data/Saves/Multiplayer/<server>/`). Vanilla backups include it, and deleting the world
|
||||||
deletes it.
|
deletes it.
|
||||||
|
|
||||||
A mod that cannot be loaded stops the server with exit code 1, and the log lists every
|
A mod that cannot be loaded stops the server with exit code 1, and the log lists every
|
||||||
problem: a missing or too old dependency, an unsupported game version, game classes or methods
|
problem. For example, a missing or too old dependency, an unsupported game version,
|
||||||
that do not exist in the running version, invalid settings, or an exception in the mod's
|
game classes or methods that do not exist in the running version, invalid settings,
|
||||||
startup code. Changes to mods and their settings take effect when the server restarts.
|
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:
|
`forge.toml`, every key optional:
|
||||||
|
|
||||||
@@ -139,9 +147,11 @@ server jar, `lib/server/java/projectzomboid.jar` by default (override with `-Ppz
|
|||||||
./gradlew :patcher:patchServerJar # -> patcher/build/server/projectzomboid.jar
|
./gradlew :patcher:patchServerJar # -> patcher/build/server/projectzomboid.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
Game-specific code lives in `compat/b<major>/`; `api` and `core` are version-independent.
|
> [!IMPORTANT]
|
||||||
`pz.version` in `gradle.properties` selects the targeted version. `mod-tools` (the build-time
|
> Game-specific code lives in `compat/b<major>/`; `api` and `core` are version-independent. <br>
|
||||||
mod checks) and `gradle-plugin` (the plugin for mod authors) are for mod builds, not the server.
|
> `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
|
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.
|
(`.gitea/workflows/publish.yml`, `ci/publish.sh`); tags with a `-` are only tested.
|
||||||
+16
-14
@@ -6,20 +6,22 @@ services:
|
|||||||
image: localhost/zomboidforge:dev
|
image: localhost/zomboidforge:dev
|
||||||
platform: linux/amd64
|
platform: linux/amd64
|
||||||
environment:
|
environment:
|
||||||
SERVER_NAME: ${SERVER_NAME:-zomboidforgetest}
|
SERVER_NAME: ${SERVER_NAME:-zomboidforgetest}
|
||||||
SERVER_PASSWORD: ${SERVER_PASSWORD:-}
|
SERVER_PASSWORD: ${SERVER_PASSWORD:-}
|
||||||
PUBLIC: ${PUBLIC:-}
|
PUBLIC: ${PUBLIC:-}
|
||||||
PUBLIC_NAME: ${PUBLIC_NAME:-}
|
PUBLIC_NAME: ${PUBLIC_NAME:-}
|
||||||
PORT: ${PORT:-16261}
|
PORT: ${PORT:-16261}
|
||||||
UDP_PORT: ${UDP_PORT:-16262}
|
UDP_PORT: ${UDP_PORT:-16262}
|
||||||
ADMIN_USERNAME: ${ADMIN_USERNAME:-}
|
ADMIN_USERNAME: ${ADMIN_USERNAME:-}
|
||||||
ADMIN_PASSWORD: ${ADMIN_PASSWORD:-}
|
ADMIN_PASSWORD: ${ADMIN_PASSWORD:-}
|
||||||
SERVER_PRESET: ${SERVER_PRESET:-}
|
SERVER_PRESET: ${SERVER_PRESET:-}
|
||||||
MODS: ${MODS:-}
|
MODS: ${MODS:-}
|
||||||
WORKSHOP_ITEMS: ${WORKSHOP_ITEMS:-}
|
WORKSHOP_ITEMS: ${WORKSHOP_ITEMS:-}
|
||||||
RCON_PASSWORD: ${RCON_PASSWORD:-}
|
RCON_PASSWORD: ${RCON_PASSWORD:-}
|
||||||
JVM_MIN_HEAP: ${JVM_MIN_HEAP:-}
|
UPNP: ${UPNP:-}
|
||||||
JVM_MAX_HEAP: ${JVM_MAX_HEAP:-8g}
|
JVM_MIN_HEAP: ${JVM_MIN_HEAP:-}
|
||||||
|
JVM_MAX_HEAP: ${JVM_MAX_HEAP:-}
|
||||||
|
JVM_UNCOMMIT_DELAY: ${JVM_UNCOMMIT_DELAY:-}
|
||||||
ports:
|
ports:
|
||||||
# Host and container ports must be equal: the server reports its own port
|
# Host and container ports must be equal: the server reports its own port
|
||||||
# to Steam and to clients, so a remapped port is unreachable.
|
# to Steam and to clients, so a remapped port is unreachable.
|
||||||
|
|||||||
+56
-4
@@ -14,6 +14,10 @@
|
|||||||
# PORT Game port (-port). Default: 16261
|
# PORT Game port (-port). Default: 16261
|
||||||
# UDP_PORT Direct connection port (-udpport). Default: 16262
|
# UDP_PORT Direct connection port (-udpport). Default: 16262
|
||||||
# STEAM 1 = Steam mode (required for official Steam clients), 0 = no Steam. Default: 1
|
# STEAM 1 = Steam mode (required for official Steam clients), 0 = no Steam. Default: 1
|
||||||
|
# UPNP true/false: UPnP port mapping on the router (.ini UPnP). false is
|
||||||
|
# recommended: in a container the server sees only its container address,
|
||||||
|
# publishing the ports is the container runtime's job, and the router
|
||||||
|
# discovery delays every start by about 12 s.
|
||||||
#
|
#
|
||||||
# Admin account
|
# Admin account
|
||||||
# ADMIN_USERNAME Admin account name (-adminusername), passed on every start.
|
# ADMIN_USERNAME Admin account name (-adminusername), passed on every start.
|
||||||
@@ -33,8 +37,14 @@
|
|||||||
# RCON_PASSWORD Written into the .ini before every start. RCON is disabled when empty.
|
# RCON_PASSWORD Written into the .ini before every start. RCON is disabled when empty.
|
||||||
#
|
#
|
||||||
# JVM
|
# JVM
|
||||||
# JVM_MIN_HEAP Value for -Xms. Default: JVM default
|
# JVM_MIN_HEAP Value for -Xms. Default: JVM default. ZGC returns unused heap memory
|
||||||
# JVM_MAX_HEAP Value for -Xmx. Default: 8g (the vanilla ProjectZomboid64.json value)
|
# only down to this size.
|
||||||
|
# JVM_MAX_HEAP Value for -Xmx. Default: 75 % of the container memory limit
|
||||||
|
# (cgroup v2 memory.max); 8g, the vanilla ProjectZomboid64.json value,
|
||||||
|
# when the container has no limit
|
||||||
|
# JVM_UNCOMMIT_DELAY
|
||||||
|
# Seconds of disuse after which ZGC returns heap memory to the system
|
||||||
|
# (-XX:ZUncommitDelay). Default: 60 (JVM default: 300)
|
||||||
#
|
#
|
||||||
# Maintenance
|
# Maintenance
|
||||||
# SOFT_RESET true: start in Project Zomboid's soft reset mode (-Dsoftreset).
|
# SOFT_RESET true: start in Project Zomboid's soft reset mode (-Dsoftreset).
|
||||||
@@ -58,6 +68,7 @@ readonly PUBLIC_NAME="${PUBLIC_NAME:-}"
|
|||||||
readonly PORT="${PORT:-}"
|
readonly PORT="${PORT:-}"
|
||||||
readonly UDP_PORT="${UDP_PORT:-}"
|
readonly UDP_PORT="${UDP_PORT:-}"
|
||||||
readonly STEAM="${STEAM:-1}"
|
readonly STEAM="${STEAM:-1}"
|
||||||
|
readonly UPNP="${UPNP:-}"
|
||||||
readonly ADMIN_USERNAME="${ADMIN_USERNAME:-}"
|
readonly ADMIN_USERNAME="${ADMIN_USERNAME:-}"
|
||||||
readonly ADMIN_PASSWORD="${ADMIN_PASSWORD:-}"
|
readonly ADMIN_PASSWORD="${ADMIN_PASSWORD:-}"
|
||||||
readonly SERVER_PRESET="${SERVER_PRESET:-}"
|
readonly SERVER_PRESET="${SERVER_PRESET:-}"
|
||||||
@@ -65,7 +76,8 @@ readonly MODS="${MODS:-}"
|
|||||||
readonly WORKSHOP_ITEMS="${WORKSHOP_ITEMS:-}"
|
readonly WORKSHOP_ITEMS="${WORKSHOP_ITEMS:-}"
|
||||||
readonly RCON_PASSWORD="${RCON_PASSWORD:-}"
|
readonly RCON_PASSWORD="${RCON_PASSWORD:-}"
|
||||||
readonly JVM_MIN_HEAP="${JVM_MIN_HEAP:-}"
|
readonly JVM_MIN_HEAP="${JVM_MIN_HEAP:-}"
|
||||||
readonly JVM_MAX_HEAP="${JVM_MAX_HEAP:-8g}"
|
readonly JVM_MAX_HEAP="${JVM_MAX_HEAP:-}"
|
||||||
|
readonly JVM_UNCOMMIT_DELAY="${JVM_UNCOMMIT_DELAY:-60}"
|
||||||
readonly SOFT_RESET="${SOFT_RESET:-}"
|
readonly SOFT_RESET="${SOFT_RESET:-}"
|
||||||
|
|
||||||
readonly SERVER_INI="${DATA_DIR}/Server/${SERVER_NAME}.ini"
|
readonly SERVER_INI="${DATA_DIR}/Server/${SERVER_NAME}.ini"
|
||||||
@@ -73,6 +85,8 @@ readonly SERVER_SANDBOX_VARS="${DATA_DIR}/Server/${SERVER_NAME}_SandboxVars.lua"
|
|||||||
readonly SERVER_DB="${DATA_DIR}/db/${SERVER_NAME}.db"
|
readonly SERVER_DB="${DATA_DIR}/db/${SERVER_NAME}.db"
|
||||||
# Target of the /opt/pz/steamapps symlink; Steam stores Workshop downloads there.
|
# Target of the /opt/pz/steamapps symlink; Steam stores Workshop downloads there.
|
||||||
readonly STEAMAPPS_DIR="${DATA_DIR}/steamapps"
|
readonly STEAMAPPS_DIR="${DATA_DIR}/steamapps"
|
||||||
|
readonly CGROUP_MEMORY_MAX="/sys/fs/cgroup/memory.max"
|
||||||
|
readonly UNLIMITED_MAX_HEAP="8g"
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
echo "[entrypoint] $*" >&2
|
echo "[entrypoint] $*" >&2
|
||||||
@@ -166,6 +180,16 @@ apply_ini_settings() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${UPNP}" ]]; then
|
||||||
|
if is_true "${UPNP}"; then
|
||||||
|
set_ini_value "UPnP" "true"
|
||||||
|
elif is_false "${UPNP}"; then
|
||||||
|
set_ini_value "UPnP" "false"
|
||||||
|
else
|
||||||
|
fail "UPNP must be true or false, got '${UPNP}'."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n "${RCON_PASSWORD}" ]]; then
|
if [[ -n "${RCON_PASSWORD}" ]]; then
|
||||||
set_ini_value "RCONPassword" "${RCON_PASSWORD}"
|
set_ini_value "RCONPassword" "${RCON_PASSWORD}"
|
||||||
else
|
else
|
||||||
@@ -231,16 +255,44 @@ check_admin_account() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 75 % of the cgroup v2 memory limit in MiB; UNLIMITED_MAX_HEAP without a limit.
|
||||||
|
# The rest of the limit is left for native memory (JVM, native libraries, thread stacks).
|
||||||
|
default_max_heap() {
|
||||||
|
local limit
|
||||||
|
|
||||||
|
if [[ ! -r "${CGROUP_MEMORY_MAX}" ]]; then
|
||||||
|
echo "${UNLIMITED_MAX_HEAP}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
limit="$(< "${CGROUP_MEMORY_MAX}")"
|
||||||
|
if [[ "${limit}" == "max" ]]; then
|
||||||
|
echo "${UNLIMITED_MAX_HEAP}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo "$(( limit * 3 / 4 / 1024 / 1024 ))m"
|
||||||
|
}
|
||||||
|
|
||||||
# Same JVM setup as the vanilla ProjectZomboid64.json and start-server.sh.
|
# Same JVM setup as the vanilla ProjectZomboid64.json and start-server.sh.
|
||||||
# Java runs directly instead of through the native ProjectZomboid64 launcher.
|
# Java runs directly instead of through the native ProjectZomboid64 launcher.
|
||||||
build_jvm_args() {
|
build_jvm_args() {
|
||||||
|
local max_heap="${JVM_MAX_HEAP}"
|
||||||
|
|
||||||
|
if [[ -z "${max_heap}" ]]; then
|
||||||
|
max_heap="$(default_max_heap)"
|
||||||
|
log "JVM_MAX_HEAP is not set: using -Xmx${max_heap}."
|
||||||
|
fi
|
||||||
|
if [[ ! "${JVM_UNCOMMIT_DELAY}" =~ ^[0-9]+$ ]]; then
|
||||||
|
fail "JVM_UNCOMMIT_DELAY must be a number of seconds, got '${JVM_UNCOMMIT_DELAY}'."
|
||||||
|
fi
|
||||||
|
|
||||||
jvm_args=(
|
jvm_args=(
|
||||||
"-javaagent:${AGENT_JAR}"
|
"-javaagent:${AGENT_JAR}"
|
||||||
"-Dzomboidforge.dir=${FORGE_DIR}"
|
"-Dzomboidforge.dir=${FORGE_DIR}"
|
||||||
"-Djava.awt.headless=true"
|
"-Djava.awt.headless=true"
|
||||||
"--enable-native-access=ALL-UNNAMED"
|
"--enable-native-access=ALL-UNNAMED"
|
||||||
"-Xmx${JVM_MAX_HEAP}"
|
"-Xmx${max_heap}"
|
||||||
"-XX:+UseZGC"
|
"-XX:+UseZGC"
|
||||||
|
"-XX:ZUncommitDelay=${JVM_UNCOMMIT_DELAY}"
|
||||||
"-XX:-OmitStackTraceInFastThrow"
|
"-XX:-OmitStackTraceInFastThrow"
|
||||||
"-Dzomboid.steam=${STEAM}"
|
"-Dzomboid.steam=${STEAM}"
|
||||||
"-Dzomboid.znetlog=1"
|
"-Dzomboid.znetlog=1"
|
||||||
|
|||||||
Reference in new issue
Block a user