From f7e2f71a42d74fb25105f56e441c9059e918ca9c Mon Sep 17 00:00:00 2001 From: Jerry Aldrich Date: Thu, 4 Aug 2022 21:36:14 -0700 Subject: [PATCH] Add crispy-doom --- README.md | 58 ++------------------ crispy-doom/Dockerfile | 28 ++++++++++ crispy-doom/README.md | 53 ++++++++++++++++++ crispy-doom/entrypoint.sh | 21 +++++++ failed_attempts/README.md | 3 - failed_attempts/chocolate-doom/Dockerfile | 18 ------ failed_attempts/chocolate-doom/README.md | 7 --- failed_attempts/odamex/Dockerfile | 39 ------------- failed_attempts/odamex/README.md | 6 -- failed_attempts/odamex/build_odamex.sh | 16 ------ failed_attempts/odamex/odasrv.cfg | 2 - Dockerfile => zandronum/Dockerfile | 0 entrypoint.sh => zandronum/entrypoint.sh | 0 extract_libs.sh => zandronum/extract_libs.sh | 0 server.cfg => zandronum/server.cfg | 0 15 files changed, 107 insertions(+), 144 deletions(-) create mode 100644 crispy-doom/Dockerfile create mode 100644 crispy-doom/README.md create mode 100755 crispy-doom/entrypoint.sh delete mode 100644 failed_attempts/README.md delete mode 100644 failed_attempts/chocolate-doom/Dockerfile delete mode 100644 failed_attempts/chocolate-doom/README.md delete mode 100644 failed_attempts/odamex/Dockerfile delete mode 100644 failed_attempts/odamex/README.md delete mode 100755 failed_attempts/odamex/build_odamex.sh delete mode 100644 failed_attempts/odamex/odasrv.cfg rename Dockerfile => zandronum/Dockerfile (100%) rename entrypoint.sh => zandronum/entrypoint.sh (100%) rename extract_libs.sh => zandronum/extract_libs.sh (100%) rename server.cfg => zandronum/server.cfg (100%) diff --git a/README.md b/README.md index 4bbe484..1cc49a9 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,7 @@ -# Docker Doom Server +# Doom Server -## Usage +## Project Layout -```text -docker run --rm -it \ - -e IWAD_URL=https://files.jerryaldrichiii.com/public/doom2.wad \ - -e RETRO_MODE=true \ - -e ITEM_RESPAWN=true \ - -e SV_HOSTNAME=doom.yourdomain.com \ - -p 10666:10666/udp \ - jerryaldrichiii/doom-server -``` - -### Configurables (set via ENV) - - - IWAD_URL=https://files.jerryaldrichiii/public/doom2.wad - Specify IWAD : - - RETRO_MODE=true - Enable my idea of retro doom. It does the following: - - Disables jumping - - Disables mouse look - - Disables crouching - - Disables altering FOV - - Disables crosshairs - - Enables forced weapon switching on pickup - - ITEM_RESPAWN=true - Enable item (including weapons) respawning - -## Connecting - -### Locally (For testing) - -- Download Zandronum: [https://zandronum.com/download](https://zandronum.com/download) -- Download the same Doom IWAD that is on the server (Set via IWAD_URL env var) - - `wget https://files.jerryaldrichiii.com/public/freedm.wad` -- Connect to the server: - - `zandronum -iwad /path/to/freedm.wad -connect localhost` - -### FreeDM - doom.jerryaldrichiii.com - -- Download Zandronum: [https://zandronum.com/download](https://zandronum.com/download) -- Download the same Doom IWAD that is on the server: - - `wget https://files.jerryaldrichiii.com/public/freedm.wad` -- Connect to the server: - - `zandronum -iwad /path/to/freedm.wad -connect doom.jerryaldrichiii.com` - -### Doom 2 (Shareware) - doom.jerryaldrichiii.com - -- Download Zandronum: [https://zandronum.com/download](https://zandronum.com/download) -- Download the same Doom IWAD that is on the server - - `wget https://files.jerryaldrichiii.com/public/doom2.wad` -- Connect to the server: - - `zandronum -iwad /path/to/doom2.wad -connect doom.jerryaldrichiii.com:10667` - -## Notes - -See WIP/ for other nearly finished attempts of other servers +Different flavors of DOOM can be found in their respective folders. Only +crispy-doom and zandronum are currently functioning. See the README.md in those +folders for more info. diff --git a/crispy-doom/Dockerfile b/crispy-doom/Dockerfile new file mode 100644 index 0000000..3d61b6f --- /dev/null +++ b/crispy-doom/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine as build + +RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories +RUN apk --no-cache add autoconf automake gcc git make musl-dev sdl2-dev sdl2_mixer-dev sdl2_net-dev + +WORKDIR /src/ + +ARG VERSION=5.11.1 + +RUN git clone -b crispy-doom-${VERSION} --depth 1 https://github.com/fabiangreffrath/crispy-doom +RUN cd crispy-doom && ./autogen.sh && make + +FROM alpine + +RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories +RUN apk --no-cache add sdl2 sdl2_mixer sdl2_net tini + +EXPOSE 2342/udp + +COPY --from=build /src/crispy-doom/src/crispy-server /usr/local/bin/crispy-server + +RUN adduser -D doom +USER doom + +COPY ./entrypoint.sh . + +# Using tini here because the crispy-doom process does not respect signals +ENTRYPOINT ["tini", "--", "/entrypoint.sh"] diff --git a/crispy-doom/README.md b/crispy-doom/README.md new file mode 100644 index 0000000..3f0ac3e --- /dev/null +++ b/crispy-doom/README.md @@ -0,0 +1,53 @@ +# Doom Server (Crispy Doom) + +## Usage + +```text +docker run --rm -it \ + -e DOOM_SERVER_NAME=doom.yourdomain.com \ + -p 2342:2342/udp \ + jerryaldrichiii/doom-server-crispy:latest +``` + +## Environment Variables + +### `DOOM_SERVER_PORT` + +The UDP port for the server to listen on. + +### `DOOM_SERVER_PUBLIC` + +If set to `true`, then it will register the server with +[master.chocolate-doom.org](https://master.chocolate-doom.org) + +### `DOOM_SERVER_NAME` + +If `DOOM_SERVER_PUBLIC="true"` then the value of this variable will be used for +the server name on [master.chocolate-doom.org](https://master.chocolate-doom.org). + +## Connecting + +First, download [Crispy Doom](http://latest.chocolate-doom.org/) + +Then, if you are the first player (the host), connect using the following: + +``` +crispy-doom -iwad ~/path/to/your/IWAD -connect DOCKER_HOST_IP -deathmatch -nomonsters +``` + +Or, if you are joining a game, connect using the following: + +``` +crispy-doom -iwad ~/path/to/same/IWAD/as/host -connect DOCKER_HOST_IP +``` + +### NOTES + +Some things to keep in mind about using this server: + - The first person connecting "configures" the server (e.g. `-nomonsters`, `-iwad`, etc) + - All players must end their game for another player to join + - There is a max of 8 players + +## More Info + +See: [https://www.chocolate-doom.org/wiki/index.php/Multiplayer](https://www.chocolate-doom.org/wiki/index.php/Multiplayer) diff --git a/crispy-doom/entrypoint.sh b/crispy-doom/entrypoint.sh new file mode 100755 index 0000000..3c47918 --- /dev/null +++ b/crispy-doom/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ "$DOOM_SERVER_PUBLIC" = "true" ]; then + DOOM_SERVER_PUBLIC="-server" +else + DOOM_SERVER_PUBLIC="-privateserver" +fi + +if [ -n "$DOOM_SERVER_NAME" ]; then + DOOM_SERVER_NAME="-servername ${DOOM_SERVER_NAME}" +else + DOOM_SERVER_NAME="" +fi + +set -eux + +crispy-server \ + -port "${DOOM_SERVER_PORT:-2342}" \ + ${DOOM_SERVER_PUBLIC} \ + "${DOOM_SERVER_NAME}" + diff --git a/failed_attempts/README.md b/failed_attempts/README.md deleted file mode 100644 index 30ae3d5..0000000 --- a/failed_attempts/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Failed Attempts - -Failed attempts at getting various other servers running diff --git a/failed_attempts/chocolate-doom/Dockerfile b/failed_attempts/chocolate-doom/Dockerfile deleted file mode 100644 index b704d0d..0000000 --- a/failed_attempts/chocolate-doom/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM debian:stable-slim - -RUN apt-get update -y && apt-get install -y chocolate-doom - -RUN apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/ - -RUN mkdir -p /export/libs - -COPY extract_server.sh / -RUN bash /extract_server.sh /usr/games/chocolate-server /export/libs - -FROM debian:stable-slim - -COPY --from=0 /export /srv - -EXPOSE 10666/udp - -CMD LD_LIBRARY_PATH=/srv/libs /srv/chocolate-server -privateserver -port 10666 diff --git a/failed_attempts/chocolate-doom/README.md b/failed_attempts/chocolate-doom/README.md deleted file mode 100644 index ef98140..0000000 --- a/failed_attempts/chocolate-doom/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Chocolate Doom - -Chocolate Doom is neat for it's retro appeal, but it doesn't really work -outside of a LAN party imo. I eventually went with Zandronum due to it's Linux -support and modern online play capabilities. - -If you want to build this make sure you copy in extract_server.sh from above. diff --git a/failed_attempts/odamex/Dockerfile b/failed_attempts/odamex/Dockerfile deleted file mode 100644 index 1557290..0000000 --- a/failed_attempts/odamex/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -# Switch to alpine to serve content built above -FROM ubuntu:latest - -RUN apt-get update -y -RUN apt-get install -y cmake wget g++ unzip - -RUN mkdir /src - -WORKDIR /src - -RUN wget https://github.com/odamex/odamex/archive/0.8.1.tar.gz -RUN tar xvzf *.tar.gz - -COPY build_odamex.sh /build_odamex.sh -RUN /build_odamex.sh - -RUN wget https://github.com/freedoom/freedoom/releases/download/v0.12.1/freedm-0.12.1.zip -RUN unzip freedm*.zip -RUN cp freedm*/freedm.wad /export - -# Using debian slim as opposed to alpine because -# odamex uses libraries only available in glibc -FROM debian:stable-slim - -COPY --from=0 /export/odasrv /srv/odasrv -COPY --from=0 /export/odamex.wad /srv/odamex.wad -COPY --from=0 /export/freedm.wad /srv/freedm.wad -COPY odasrv.cfg /srv/odasrv.cfg - -# RUN useradd --no-create-home --shell /bin/false odamex -RUN useradd -m --shell /bin/false odamex - -RUN chown -R odamex:odamex /srv/ - -USER odamex - -CMD /srv/odasrv -config /srv/odasrv.cfg - -EXPOSE 10666/udp diff --git a/failed_attempts/odamex/README.md b/failed_attempts/odamex/README.md deleted file mode 100644 index be079da..0000000 --- a/failed_attempts/odamex/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Docker Odamex - -You can use this to build a Odamex Doom server. - -I put a lot of work into this, but ultimately went with Zandronum due to it's -compatibility with Linux. I couldn't get audio working with Odamex :( diff --git a/failed_attempts/odamex/build_odamex.sh b/failed_attempts/odamex/build_odamex.sh deleted file mode 100755 index 935a9f6..0000000 --- a/failed_attempts/odamex/build_odamex.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -e - -cd /src/odamex* - -mkdir /export - -cp odamex.wad /export - -mkdir build -cd build && cmake .. -DCMAKE_BUILD_TYPE=MinSizRel -DBUILD_CLIENT=0 -DBUILD_ODALAUNCH=0 - -make odasrv - -cp server/odasrv /export diff --git a/failed_attempts/odamex/odasrv.cfg b/failed_attempts/odamex/odasrv.cfg deleted file mode 100644 index ddd4945..0000000 --- a/failed_attempts/odamex/odasrv.cfg +++ /dev/null @@ -1,2 +0,0 @@ -sv_usemasters 0 - diff --git a/Dockerfile b/zandronum/Dockerfile similarity index 100% rename from Dockerfile rename to zandronum/Dockerfile diff --git a/entrypoint.sh b/zandronum/entrypoint.sh similarity index 100% rename from entrypoint.sh rename to zandronum/entrypoint.sh diff --git a/extract_libs.sh b/zandronum/extract_libs.sh similarity index 100% rename from extract_libs.sh rename to zandronum/extract_libs.sh diff --git a/server.cfg b/zandronum/server.cfg similarity index 100% rename from server.cfg rename to zandronum/server.cfg