Rebuilds (not Wine) the login/char/world servers natively for Linux via CMake, and ships a single Docker image plus docker-compose stack (MariaDB + 3 servers) with all settings configurable via .env. Linux portability: - Src/Common/compat.h shims MSVC-only CRT calls (fopen_s, _strdup, strncpy_s, sprintf_s, SYSTEMTIME/GetLocalTime, WSAGetLastError, __cdecl) and adds a case-insensitive/backslash-tolerant path resolver for the Windows-authored STB/AIP data file paths. - Fixed case-sensitive header includes and filenames (charserver.h vs CharServer.h, worldserver.h vs WorldServer.h, ../common vs ../Common). - rose_inet_addr() resolves hostnames (not just literal IPs) for the server-to-server links, so docker-compose service names work. Fixed three real bugs that only crashed on 64-bit Linux (silently tolerated on 32-bit Windows): - CIntStb::LoadSTB had an inverted fopen success/failure check, so STB game data (zones, items, etc.) was never actually loaded. - GenerateCryptTables allocated its pointer table with sizeof(unsigned) instead of sizeof(unsigned*) -- a 1x vs 2x-size heap overflow on 64-bit. - Crypto bit-twiddling relies throughout on signed-overflow-as-wraparound, which is UB in C++; GCC's -O3 exploited it and miscompiled GenerateCryptTables (Release-only crash). Fixed via -fwrapv. Plus smaller fixes: off-by-one array bounds (inventory/storage/sell data), SO_REUSEADDR on server sockets (containers restarting in the same netns hit TIME_WAIT otherwise), and a va_list reused across multiple vprintf/vfprintf calls in Log() that garbled every formatted log line on the Linux ABI. Docker: - CMakeLists.txt builds all three servers + shared Common code. - Dockerfile: multi-stage build, one runtime image for all three servers, server role selected via `command: [login|char|world]`. - docker-compose.yml: MariaDB (auto-imports database sql files/ on first run) + login/char/world (single channel), config rendered from docker/conf/*.conf.tmpl via envsubst at container start. - .env.example documents every setting (ports, server names, rates, inter-server passwords, PUBLIC_HOST for internet-facing deployments). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
1.3 KiB
Bash
37 lines
1.3 KiB
Bash
# Copy to .env and adjust. All server settings are controlled from here -
|
|
# docker compose renders them into the .conf files at container start.
|
|
|
|
# --- Database -----------------------------------------------------------
|
|
DB_NAME=ktrose
|
|
DB_USER=rose
|
|
DB_PASSWORD=change_me
|
|
|
|
# --- Public address -------------------------------------------------------
|
|
# The address game clients connect to. For a LAN-only server this can stay
|
|
# 127.0.0.1 / the LAN IP; for an internet-exposed server this MUST be the
|
|
# public IP or DNS name of this host, otherwise clients won't be able to
|
|
# reach the char/world server after the login server hands them off.
|
|
PUBLIC_HOST=127.0.0.1
|
|
|
|
# --- Ports (published to the host) ----------------------------------------
|
|
LOGIN_PORT=29000
|
|
CHAR_PORT=29100
|
|
WORLD_PORT=29200
|
|
|
|
# --- Server / channel naming -----------------------------------------------
|
|
LOGIN_SERVER_NAME=ROSE Login
|
|
CHAR_SERVER_NAME=Server 1
|
|
WORLD_CHANNEL_NAME=Channel 1
|
|
WORLD_WELCOME_MSG=Welcome to ROSE
|
|
|
|
# --- Gameplay knobs ---------------------------------------------------------
|
|
WORLD_MAX_CONNECTIONS=500
|
|
WORLD_SAVE_TIME=3600
|
|
CHAR_DELETE_TIME=3600
|
|
LOGIN_CREATE_ACCOUNT=1
|
|
|
|
# --- Inter-server auth (must just be consistent across the 3 servers) -------
|
|
SHARED_LOGIN_PASS=789456
|
|
SHARED_CHAR_PASS=456123
|
|
SHARED_WORLD_PASS=321654
|