Skip to content
Closed
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
89 changes: 89 additions & 0 deletions game/tc2/gameinfo_server.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
"GameInfo"
{
game "Team Comtress 2"
type multiplayer_only
nomodels 1
nohimodel 1
nocrosshair 0
hidden_maps
{
"test_speakers" 1
"test_hardware" 1
}
nodegraph 0
GameData "tf.fgd"
AdditionalLocalization "tf"
InstancePath "maps/instances/"
advcrosshair 1
supportsvr 0
ReplayRequired 1

DependsOnAppID 440

FileSystem
{
SteamAppId 243750

SearchPaths
{
// First, mount all user customizations. This will search for VPKs and subfolders
// and mount them in alphabetical order. The easiest way to distribute a mod is to
// pack up the custom content into a VPK. To "install" a mod, just drop it in this
// folder.
//
// Note that this folder is scanned only when the game is booted.
game+mod+custom_mod tc2/custom/*
// Enable this if you want to load your TF custom content.
//game+mod |appid_440|tf/custom/*

// Now search loose files. We'll set the directory containing the gameinfo.txt file
// as the first "mod" search path (after any user customizations). This is also the one
// that's used when writing to the "mod" path.
mod+mod_write |all_source_engine_paths|tc2
game+game_write |all_source_engine_paths|tc2
default_write_path |all_source_engine_paths|tc2
gamebin |all_source_engine_paths|tc2/bin

// We search VPK files before ordinary folders, because most files will be found in
// VPK and we can avoid making thousands of file system calls to attempt to open files
// in folders where they don't exist. (Searching a VPK is much faster than making an operating
// system call.)
game_lv |all_source_engine_paths|tf/tf2_lv.vpk
game+mod |all_source_engine_paths|tf/tf2_textures.vpk
game+mod |all_source_engine_paths|tf/tf2_sound_vo_english.vpk
game+mod |all_source_engine_paths|tf/tf2_sound_misc.vpk
game+mod+vgui |all_source_engine_paths|tf/tf2_misc.vpk
game |all_source_engine_paths|hl2/hl2_textures.vpk
game |all_source_engine_paths|hl2/hl2_sound_vo_english.vpk
game |all_source_engine_paths|hl2/hl2_sound_misc.vpk
game+vgui |all_source_engine_paths|hl2/hl2_misc.vpk
platform+vgui |all_source_engine_paths|platform/platform_misc.vpk

// Last, mount in shared HL2 and TF2 loose files
// game |all_source_engine_paths|tf
// game |all_source_engine_paths|hl2
// platform |all_source_engine_paths|platform


// Random files downloaded from gameservers go into a seperate directory, so
// that it's easy to keep those files segregated from the official game files
// or customizations intentially installed by the user.
//
// This directory is searched LAST. If you visit a server and download
// a custom model, etc, we don't want that file to override the default
// game file indefinitely (after you have left the server). Servers CAN have
// custom content that overrides the default game files, it just needs to be
// packed up in the .bsp file so that it will be mounted as a map search pack.
// The map search pack is mounted at the top of the search path list,
// but only while you are connected that server and on that map.
game+download tc2/download
}
}
ToolsEnvironment
{
"Engine" "Source"
"UseVPLATFORM" "1"
"PythonVersion" "2.7"
"PythonHomeDisable" "1"
}
}
55 changes: 55 additions & 0 deletions src/builddedicatedserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

set -euo pipefail

script=$(readlink -f -- "$0")
pushd "$(dirname -- "$script")" > /dev/null

source sdk_container
run_in_sniper "$@"

if [ $# -eq 0 ]; then
export VPC_NINJA_BUILD_MODE="release"
else
if [[ "$1" == "debug" ]]; then
export VPC_NINJA_BUILD_MODE="debug"
elif [[ "$1" == "release" ]]; then
export VPC_NINJA_BUILD_MODE="release"
else
echo "Usage: $0 [debug|release]"
exit 1
fi
fi

solution_out="_vpc_/ninja/sdk_server_$VPC_NINJA_BUILD_MODE"

if [[ ! -e "$solution_out.ninja" ]]; then
devtools/bin/vpc /hl2mp /tf /linux64 /ninja /define:SOURCESDK +dedicated /mksln "$solution_out"

# Generate compile commands.
ninja -f "$solution_out.ninja" -t compdb > compile_commands.json

# Remove some unsupported clang commands.
sed -i 's/-fpredictive-commoning//g; s/-fvar-tracking-assignments//g' compile_commands.json
sed -i 's|/my_mod/src|.|g' compile_commands.json

# Reflect changes done in compile_commands.json for easier diagnostics
sed -i 's|-D_DLL_EXT=\.so|-D_DLL_EXT=_srv.so|g' compile_commands.json
sed -i 's|-D_EXTERNAL_DLL_EXT=\.so|-D_EXTERNAL_DLL_EXT=_srv.so|g' compile_commands.json
sed -i 's|server\.so|server_srv.so|g' compile_commands.json
sed -i 's|lvstdlib|lvstdlib_srv|g' compile_commands.json
sed -i 's|ltier0|ltier0_srv|g' compile_commands.json

sed -i 's|-D_DLL_EXT=\.so|-D_DLL_EXT=_srv.so|g' "$solution_out.ninja"
sed -i 's|-D_EXTERNAL_DLL_EXT=\.so|-D_EXTERNAL_DLL_EXT=_srv.so|g' "$solution_out.ninja"
sed -i 's|server\.so|server_srv.so|g' "$solution_out.ninja"
sed -i 's|libtier0\.so|libtier0_srv.so|g' "$solution_out.ninja"
sed -i 's|libvstdlib\.so|libvstdlib_srv.so|g' "$solution_out.ninja"
sed -i 's|lvstdlib|lvstdlib_srv|g' "$solution_out.ninja"
sed -i 's|ltier0|ltier0_srv|g' "$solution_out.ninja"
Copy link

@ReplayCoding ReplayCoding Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels really hacky, is it possible to instead use the proper /dedicated option for VPC?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Darn i guess that would be easier just to copy every .a file in the /lib/common and /lib/public to have suffix _srv.a
still to run server properly, from testing now it's neccessary to have server libraries for libtier0 and libvstdlib otherwise random things start to break like ClientCommandKeyValues.


fi

ninja -f "$solution_out.ninja" -j$(nproc)

popd
Binary file added src/lib/public/linux64/libtier0_srv.so
Binary file not shown.
Binary file added src/lib/public/linux64/libvstdlib_srv.so
Binary file not shown.