Skip to content

Commit

Permalink
Merge pull request #138 from ampreeT/readme-update-0
Browse files Browse the repository at this point in the history
README Update
  • Loading branch information
ampreeT committed Aug 31, 2024
2 parents b22eef1 + 83bf243 commit 0a51e51
Show file tree
Hide file tree
Showing 9 changed files with 565 additions and 69 deletions.
338 changes: 269 additions & 69 deletions README.md

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions edt/bms/bm_stadium4_a4.edt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#base "base/bm_sp_campaign.edt"

"config"
{
"campaign" "Stadium"
"chapter" "Stadium"

"equipment"
{
"item" "item_suit"
"item" "item_weapon_crowbar"
"item" "item_weapon_glock"
"item" "item_weapon_357"
"item" "item_weapon_mp5"
"item" "item_weapon_shotgun"
"item" "item_weapon_crossbow"
"item" "item_weapon_rpg"
"item" "item_weapon_satchel"
"item" "item_weapon_tau"
"item" "item_weapon_gluon"
"item" "item_weapon_hivehand"
"item" "item_weapon_snark"
"item" "item_weapon_snark"
"item" "item_weapon_snark"
"item" "item_weapon_satchel"
"item" "item_weapon_satchel"
"item" "item_weapon_satchel"
"item" "item_weapon_satchel"
"item" "item_weapon_satchel"
"item" "item_weapon_frag"
"item" "item_weapon_frag"
"item" "item_weapon_frag"
"item" "item_weapon_frag"
"item" "item_weapon_frag"
"item" "item_weapon_frag"
"item" "item_weapon_frag"
"item" "item_weapon_frag"
"item" "item_weapon_frag"
"item" "item_weapon_frag"
"item" "item_weapon_tripmine"
"item" "item_weapon_tripmine"
"item" "item_weapon_tripmine"
"item" "item_weapon_tripmine"
"item" "item_weapon_tripmine"
"item" "item_ammo_mp5"
"item" "item_ammo_mp5"
"item" "item_ammo_mp5"
"item" "item_ammo_mp5"
"item" "item_ammo_mp5"
"item" "item_ammo_mp5"
"item" "item_grenade_rpg"
"item" "item_grenade_rpg"
"item" "item_ammo_shotgun"
"item" "item_ammo_shotgun"
"item" "item_ammo_shotgun"
"item" "item_ammo_shotgun"
"item" "item_ammo_shotgun"
"item" "item_ammo_shotgun"
"item" "item_ammo_shotgun"
"item" "item_ammo_shotgun"
"item" "item_ammo_357"
"item" "item_ammo_357"
"item" "item_ammo_energy"
"item" "item_ammo_energy"
"item" "item_ammo_energy"
"item" "item_ammo_energy"
"item" "item_ammo_energy"
"item" "item_longjump"
"item" "item_battery"
"item" "item_battery"
"item" "item_battery"
"item" "item_battery"
"item" "item_battery"
"item" "item_battery"
"item" "item_battery"
"item" "item_grenade_mp5"
"item" "item_grenade_mp5"
"item" "item_grenade_mp5"
}

"checkpoint"
{
"use_map_spawnpoint" "1"
}
}
Binary file added images/icon-bms-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-hl2dm-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-sourcemod-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-steam-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/logo-sc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
106 changes: 106 additions & 0 deletions scripts/srccoop-bms-linux-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/bin/bash -e

# Install packages for SteamCMD and Black Mesa Dedicated Server.
sudo dpkg --add-architecture i386
sudo apt-get update -y
sudo apt-get install unzip -y
sudo apt-get install wget -y
# Required for running SteamCMD.
sudo apt-get install lib32gcc-s1 -y
# Required for running Black Mesa Dedicated Server.
sudo apt-get install lib32stdc++6 -y
sudo apt-get install libncurses5 libncurses5:i386 -y

# Install SteamCMD.
mkdir -p "./SteamCMD"
wget "http://media.steampowered.com/client/steamcmd_linux.tar.gz" -O ".tmp.tar.gz"
tar -xf ".tmp.tar.gz" -C "./SteamCMD"
rm ".tmp.tar.gz"

# Install Black Mesa Dedicated Server.
# TODO: Check error code of process and early exit on failure.
mkdir -p "./Black Mesa Dedicated Server"
echo -e "force_install_dir \"../Black Mesa Dedicated Server\"\nlogin anonymous\napp_update 346680\nquit" | ./SteamCMD/steamcmd.sh

# Install the latest version of Metamod Source.
wget $(wget -qO- "https://www.sourcemm.net/downloads.php" | grep "<a class='quick-download download-link'" | grep -m1 "linux.tar.gz" | sed -n 's/.*href='\''//; s/'\''.*//p') -O ".tmp.tar.gz"
tar -xf ".tmp.tar.gz" -C "./Black Mesa Dedicated Server/bms"
rm ".tmp.tar.gz"

# Install the latest version of Metamod Source.
wget $(wget -qO- "https://www.sourcemod.net/downloads.php" | grep "<a class='quick-download download-link'" | grep -m1 "linux.tar.gz" | sed -n 's/.*href='\''//; s/'\''.*//p') -O ".tmp.tar.gz"
tar -xf ".tmp.tar.gz" -C "./Black Mesa Dedicated Server/bms"
rm ".tmp.tar.gz"

# Install the latest version of Accelerator.
wget "https://builds.limetech.io/"$(wget -qO- "https://builds.limetech.io/?p=accelerator" | grep -m1 "linux.zip" | cut -d '"' -f2) -O ".tmp.zip"
unzip ".tmp.zip" -d "./Black Mesa Dedicated Server/bms"
rm ".tmp.zip"

# Install the latest release of SourceCoop.
wget $(wget -qO- "https://api.github.com/repos/ampreeT/SourceCoop/releases/latest" | grep "browser_download_url" | grep -m1 "bms.zip" | cut -d '"' -f 4) -O ".tmp.zip"
unzip ".tmp.zip" -d "./Black Mesa Dedicated Server/bms"
rm ".tmp.zip"

## OPTIONAL: Remove textures to save ~9 GB.
## On the server, materials are needed but textures are not.
## If the server ever needs to be updated, these files will be redownloaded again.
#rm ./Black\ Mesa\ Dedicated\ Server/bms/bms_textures*
#rm ./Black\ Mesa\ Dedicated\ Server/hl2/hl2_textures*

# Create a script to run and automatically restart the server.
srcds_coop_bash=$(cat << EOF
#!/bin/bash
./srcds_run -console -game bms -ip 0.0.0.0 +maxplayers 32 +mp_teamplay 1 +map bm_c0a0a
EOF
)
echo "$srcds_coop_bash" > "./Black Mesa Dedicated Server/srcds_coop.sh"
chmod +x "./Black Mesa Dedicated Server/srcds_coop.sh"

# Create a `mapcycle.txt` consisting of the starting chapter maps.
map_cycle_txt=$(cat << EOF
bm_c0a0a
bm_c1a0a
bm_c1a1a
bm_c1a2a
bm_c1a3a
bm_c1a4a
bm_c2a1a
bm_c2a1a
bm_c2a2a
bm_c2a3a
bm_c2a4a
bm_c2a4e
bm_c2a5a
bm_c3a1a
bm_c3a2a
bm_c4a1a
bm_c4a2a
bm_c4a3a
EOF
)
echo "$map_cycle_txt" > "./Black Mesa Dedicated Server/bms/mapcycle.txt"

# Create a `server.cfg` with ideal default settings.
server_cfg=$(cat << EOF
// SourceCoop settings.
mp_timelimit 0 // Prevents map switch from round timers.
mp_fraglimit 0 // Prevents the match from ending when a player has a high enough score.
mp_teamplay 1 // Enables the scientist team.
mp_friendlyfire 0 // Disables friendly fire.
mp_forcerespawn 1 // Forces the player to respawn.
// Add your settings below.
hostname "Black Mesa: Cooperative" // The name of the server.
sv_password "" // Sets a server password for locking the server.
rcon_password "" // Sets a RCON password for accessing adminstrative features. This is not recommended and SourceMod should be used instead.
EOF
)
echo "$server_cfg" > "./Black Mesa Dedicated Server/bms/cfg/server.cfg"

# Empty the default `autoexec.cfg` as it does nothing for the server.
> "./Black Mesa Dedicated Server/bms/cfg/autoexec.cfg"

# Create an empty `userconfig.cfg` to suppress console warnings.
> "./Black Mesa Dedicated Server/bms/cfg/userconfig.cfg"
105 changes: 105 additions & 0 deletions scripts/srccoop-bms-windows-install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
$ErrorActionPreference = "Stop"

# Install SteamCMD.
New-Item -Name "SteamCMD" -ItemType Directory
Invoke-WebRequest -Uri "https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip" -OutFile ".tmp.zip"
Expand-Archive -LiteralPath ".tmp.zip" -DestinationPath "./SteamCMD"
Remove-Item -Path ".tmp.zip" -Force

# Install Black Mesa Dedicated Server.
# TODO: Check error code of process and early exit on failure.
New-Item -Name "Black Mesa Dedicated Server" -ItemType Directory
Start-Process -FilePath "./SteamCMD/steamcmd.exe" -ArgumentList '+force_install_dir "../Black Mesa Dedicated Server"', "+login anonymous", "+app_update 346680", "+quit" -Wait -NoNewWindow

# Install the latest version of Metamod Source.
Invoke-WebRequest -OutFile ".tmp.zip" -Uri (((Invoke-WebRequest -Uri "https://www.sourcemm.net/downloads.php").Links | Where-Object { $_.href -like "*-windows.zip" }).href | Select-Object -First 1)
Expand-Archive -LiteralPath ".tmp.zip" -DestinationPath "./Black Mesa Dedicated Server/bms"
Remove-Item -Path ".tmp.zip" -Force

# Install the latest version of SourceMod.
Invoke-WebRequest -OutFile ".tmp.zip" -Uri (((Invoke-WebRequest -Uri "https://www.sourcemod.net/downloads.php").Links | Where-Object { $_.href -like "*-windows.zip" }).href | Select-Object -First 1)
Expand-Archive -LiteralPath ".tmp.zip" -DestinationPath "./Black Mesa Dedicated Server/bms"
Remove-Item -Path ".tmp.zip" -Force

# Install the latest version of Accelerator.
Invoke-WebRequest -OutFile ".tmp.zip" -Uri ("https://builds.limetech.io/" + ((Invoke-WebRequest -Uri "https://builds.limetech.io/?p=accelerator").Links | Where-Object { $_.href -like "*-windows.zip" } | Select-Object -First 1).href)
Expand-Archive -LiteralPath ".tmp.zip" -DestinationPath "./Black Mesa Dedicated Server/bms"
Remove-Item -Path ".tmp.zip" -Force

# Install the latest release of SourceCoop.
Invoke-WebRequest -OutFile ".tmp.zip" -Uri ((Invoke-WebRequest "https://api.github.com/repos/ampreeT/SourceCoop/releases/latest" | ConvertFrom-Json).assets | Where-Object { $_.name -like "*-bms.zip" } | Select-Object -First 1).browser_download_url
Expand-Archive -LiteralPath ".tmp.zip" -DestinationPath "./Black Mesa Dedicated Server/bms"
Remove-Item -Path ".tmp.zip" -Force

## OPTIONAL: Remove textures to save ~9 GB.
## On the server, materials are needed but textures are not.
## If the server ever needs to be updated, these files will be redownloaded again.
#Remove-Item -Path "./Black Mesa Dedicated Server/bms/bms_textures*" -Force
#Remove-Item -Path "./Black Mesa Dedicated Server/hl2/hl2_textures*" -Force

# Commented out due to stdout being malformed.
## Install Alien Swarm: Reactive Drop Dedicated Server.
## The default `srcds.exe` will always spawn a new console while the `srcds_console.exe` that is shipped with Alien Swarm: Reactive Drop does not.
## https://github.com/Facepunch/garrysmod-issues/issues/3771#issuecomment-1507467323
#New-Item -Name "Alien Swarm Reactive Drop" -ItemType Directory
#Start-Process -FilePath "./SteamCMD/steamcmd.exe" -ArgumentList '+force_install_dir "../Alien Swarm Reactive Drop"', "+login anonymous", "+app_update 582400", "+quit" -Wait -NoNewWindow
#Copy-Item "./Alien Swarm Reactive Drop/srcds_console.exe" -Destination "./Black Mesa Dedicated Server" -Force
#Remove-Item -Path "./Alien Swarm Reactive Drop" -Force -Recurse

# Create a script to run and automatically restart the server.
$srcds_coop_bat = @'
@echo off
echo [%time%] Starting Black Mesa Dedicated Server..
:loop
start /WAIT /B srcds.exe -nomessagebox -console -game bms -ip 0.0.0.0 +maxplayers 32 +mp_teamplay 1 +map bm_c0a0a
echo [%time%] Restarting Black Mesa Dedicated Server..
timeout 5 > nul
goto loop
'@
Set-Content -Path "./Black Mesa Dedicated Server/srcds_coop.bat" -Value $srcds_coop_bat

# Create a `mapcycle.txt` consisting of the starting chapter maps.
$map_cycle_txt = @'
bm_c0a0a
bm_c1a0a
bm_c1a1a
bm_c1a2a
bm_c1a3a
bm_c1a4a
bm_c2a1a
bm_c2a1a
bm_c2a2a
bm_c2a3a
bm_c2a4a
bm_c2a4e
bm_c2a5a
bm_c3a1a
bm_c3a2a
bm_c4a1a
bm_c4a2a
bm_c4a3a
'@
Set-Content -Path "./Black Mesa Dedicated Server/bms/mapcycle.txt" -Value $map_cycle_txt

# Create a `server.cfg` with ideal default settings.
$server_cfg = @'
// SourceCoop settings.
mp_timelimit 0 // Prevents map switch from round timers.
mp_fraglimit 0 // Prevents the match from ending when a player has a high enough score.
mp_teamplay 1 // Enables the scientist team.
mp_friendlyfire 0 // Disables friendly fire.
mp_forcerespawn 1 // Forces the player to respawn.
// Add your settings below.
hostname "Black Mesa: Cooperative" // The name of the server.
sv_password "" // Sets a server password for locking the server.
rcon_password "" // Sets a RCON password for accessing adminstrative features. This is not recommended and SourceMod should be used instead.
'@
Set-Content -Path "./Black Mesa Dedicated Server/bms/cfg/server.cfg" -Value $server_cfg

# Empty the default `autoexec.cfg` as it does nothing for the server.
Set-Content -Path "./Black Mesa Dedicated Server/bms/cfg/autoexec.cfg" -Value ""

# Create an empty `userconfig.cfg` to suppress console warnings.
Set-Content -Path "./Black Mesa Dedicated Server/bms/cfg/userconfig.cfg" -Value ""

0 comments on commit 0a51e51

Please sign in to comment.