Skip to content

Add SRB2 #1454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions srb2.kvp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
Meta.DisplayName=SRB2
Meta.Description=SRB2 Dedicated Server (v2.2.15)
Meta.Arch=x86_64
Meta.Author=Hacksawfred3232
Meta.URL=https://www.srb2.org/
Meta.MinAMPVersion=2.4.6.6
Meta.SpecificDockerImage=cubecoders/ampbase:deb12-srb2
Meta.DockerRequired=True
Meta.ContainerPolicy=RequiredOnLinux
Meta.ContainerPolicyReason=Sonic Junior Team does not supply native Linux binaries. As such, the game needs to be compiled.
Meta.ExtraSetupStepsURI=https://github.com/Hacksawfred3232/CustAMPTemplates/issues/1
Meta.Prerequsites=[]
Meta.EndpointURIFormat=steam://connect/{ip}:{GenericModule.App.Ports.$SteamQueryPort}
Meta.ExtraContainerPackages=[]
Meta.AppConfigId=2f92c0eb-ac61-4a06-b50a-29e73d123d12
App.AdminMethod=STDIO
App.HasReadableConsole=true
App.HasWritableConsole=true
App.DisplayName=SRB2
App.CommandLineArgs={{$PlatformArgs}} {{$FormattedArgs}} -dedicated -nofork -serverport {{$MainGamePort}}
App.WindowsCommandLineArgs=
App.CommandLineParameterFormat=-{0} "{1}"
App.CommandLineParameterDelimiter=
App.RapidStartup=false
App.ApplicationReadyMode=RegexMatch
App.ExitMethod=OS_CLOSE
App.ExitString=stop
App.ExitTimeout=30
App.ExitFile=app_exit.lck
App.SupportsLiveSettingsChanges=False
App.LiveSettingChangeCommandFormat=set {0} "{1}"
App.ApplicationIPBinding=0.0.0.0
App.AdminPortRef=RemoteAdminPort
App.UniversalSleepApplicationUDPPortRef=GamePort1
App.PrimaryApplicationPortRef=GamePort1
App.UniversalSleepSteamQueryPortRef=SteamQueryPort
App.MaxUsers=8
App.UseRandomAdminPassword=True
App.RemoteAdminPassword=
App.AdminLoginTransform=None
App.RCONConnectDelaySeconds=30
App.RCONConnectRetrySeconds=15
App.RCONHeartbeatCommand=ping
App.RCONHeartbeatMinutes=0
App.TelnetLoginFormat={0}
App.SteamUpdateAnonymousLogin=True
App.SteamForceLoginPrompt=False
App.SupportsUniversalSleep=False
App.WakeupMode=Any
App.TemplateMatchRegex={{(\$?[\w]+)}}
App.MonitorChildProcess=False
App.MonitorChildProcessWaitMs=1000
App.MonitorChildProcessName=
App.Compatibility=1
App.SteamWorkshopDownloadLocation={{$FullBaseDir}}undefined
Console.FilterMatchRegex=
Console.FilterMatchReplacement=
Console.ThrowawayMessageRegex=(WARNING|ERROR): Shader.+
Console.UpdateAvailableRegex=^\[\d\d:\d\d:\d\d\] \[INFO\] A new server update is available! v[\d\.]+.$
Console.SuppressLogAtStart=False
Console.ActivateLogRegex=
Console.UserActions={}
Console.SleepMode=False
Console.SleepOnStart=False
Console.SleepDelayMinutes=5
Console.DozeDelay=2
Console.AutoRetryCount=5
Console.SleepStartThresholdSeconds=25
Console.AppReadyRegex=^Entering\smain\sgame\sloop\.\.\.$
Console.UserJoinRegex=^\*(?<username>.+)\shas\s(?:rejoined|joined)\sthe\sgame\s\(player\s(?<userid>.+)\)$
Console.UserLeaveRegex=^\*(?<username>.+)\sleft\sthe\sgame$
Console.UserChatRegex=^(?:|\[PM\])\<(?<username>.+)\>\s(?<message>.+)$
Meta.OS=Linux
Meta.ConfigManifest=srb2_config.json
Meta.MetaConfigManifest=srb2_metaconfig.json
Meta.ConfigRoot=srb2.kvp
App.RootDir=./srb2/
Meta.DisplayImageSource=url:https://cdn2.steamgriddb.com/thumb/cae4a57bcd2fa803df2270f5d8bbbbae.png
App.BaseDirectory=./srb2/
App.WorkingDir=
App.ExecutableWin=
App.ExecutableLinux=srb2linux.exe
App.LinuxCommandLineArgs=
App.Ports=@IncludeJson[srb2_ports.json]
App.UpdateSources=@IncludeJson[srb2_updates.json]
App.EnvironmentVariables={"LD_LIBRARY_PATH": "{{$FullBaseDir}}linux64:{{$FullRootDir}}linux64:%LD_LIBRARY_PATH%", "WINEPREFIX": "{{$FullRootDir}}.wine", "WINEARCH": "win64", "WINEDEBUG": "-all"}
35 changes: 35 additions & 0 deletions srb2_Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM debian:bookworm-20250407 AS build

# Running upgrade command.
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y upgrade

# Apt-get install all required dependencies to compile this release.
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential git wget unzip nasm gcc libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev libminiupnpc-dev
# Goto root and then clone the github repo.
WORKDIR /root
RUN git clone -b "SRB2_release_2.2.15" https://github.com/STJr/SRB2.git
ENV LIBGME_CFLAGS=""
ENV LIBGME_LDFLAGS="-lgme"
# Goto SRB2 and then make the program.
WORKDIR /root/SRB2
RUN make -j 4
# Binary should be compiled now.
# There are still debug symbols on this file. Strip them.
WORKDIR /
RUN strip --strip-debug /root/SRB2/bin/lsdl2srb2
# Copy the binary file.
RUN cp /root/SRB2/bin/lsdl2srb2 /root/srb2
# This is where the build ends here.

FROM cubecoders/ampbase:deb12
# Retarget the above to cubecoders/ampbase:deb12-srb2
# Copy from our builder the main file. updates.json will copy this to our working directory.
COPY --from=build /root/srb2 /srb2linux.exe
# Running upgrade command.
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y upgrade
# Shortened version of the list above.
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install wget unzip libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev libminiupnpc-dev
# Running clean up.
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Ensure that WORKDIR is /
WORKDIR /
1 change: 1 addition & 0 deletions srb2_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions srb2_metaconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
9 changes: 9 additions & 0 deletions srb2_ports.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"Protocol": "UDP",
"Port": "5029",
"Name": "Main Game Port",
"Description": "Port used for main game traffic",
"Ref": "MainGamePort"
}
]
36 changes: 36 additions & 0 deletions srb2_updates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
{
"UpdateStageName": "Fetching Assets",
"UpdateSourcePlatform": "All",
"UpdateSource": "FetchURL",
"UpdateSourceData": "https://github.com/STJr/SRB2/releases/download/SRB2_release_2.2.15/SRB2-v2215-Full.zip",
"UpdateSourceArgs": "",
"UpdateSourceTarget": "",
"UnzipUpdateSource": true,
"OverwriteExistingFiles": true,
"DeleteAfterExtract": true,
"OneShot": true
},
{
"UpdateStageName": "Copy linux binary",
"UpdateSourcePlatform": "Linux",
"UpdateSource": "CopyFilePath",
"UpdateSourceData": "./srb2/srb2linux.exe",
"UpdateSourceArgs": "/srb2linux.exe",
"UnzipUpdateSource": false,
"OverwriteExistingFiles": false,
"DeleteAfterExtract": true,
"OneShot": true
},
{
"UpdateStageName": "Make game executable",
"UpdateSourcePlatform": "Linux",
"UpdateSource": "Executable",
"UpdateSourceData": "/usr/bin/chmod",
"UpdateSourceArgs": "+x srb2/srb2linux.exe",
"UnzipUpdateSource": false,
"OverwriteExistingFiles": false,
"DeleteAfterExtract": true,
"OneShot": true
}
]