thetredev / steamcmd

Sane SteamCMD docker images!
MIT License
6 stars 1 forks source link

Ensure CS2 compatibility #42

Closed thetredev closed 11 months ago

thetredev commented 1 year ago

According to https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers we can finally have dedicated CS2 servers. But some paths have changed. CS2 won't work using this project as is.

Also it seems like they've finally moved to 64 bit 100%, that may be something to keep in mind.

DaVarga commented 1 year ago

I started working on it in my source2 branch. https://github.com/DaVarga/steamcmd/tree/src2 Screenshot

Server kinda boots. Sometime crashes not sure why.

CNetworkGameServerBase::SetServerState (ss_waitingforgamesessionmanifest -> ss_loading)
SDR network config fetch attempt #1 failed.  HTTP 504.  .  Trying again.
SV:  Connection to Steam servers successful.
SV:  ServerSteamID=[A:1:xxxxxx:xxxxxx] (xxxxxx).
[SRC2] Server is healthy! Use 'server.sh attach' to attach to the SRC2 tmux session.
Gameserver logged on to Steam, assigned identity steamid:xxxxxx
AuthStatus (steamid:90176916736141331):  Attempting  (Requesting cert)
Set SteamNetworkingSockets P2P_STUN_ServerList to '162.254.197.39:3478' as per SteamNetworkingSocketsSerialized
Got SDR network config.  Loaded revision 1696448113 OK
SDR RelayNetworkStatus:  avail=Not Attempted  config=OK  anyrelay=Not Attempted   (No need for SDR client network access)
server exited unexpectedly

Sometimes it crashes like this:


Gameserver logged on to Steam, assigned identity steamid:xxxxxx
src/steamnetworkingsockets/clientlib/sdr/steamnetworkingsockets_sdr_common.cpp(6757): Assertion Failed: !s_pConfigFetchInProgress
AuthStatus (steamid:xxxxxx):  Attempting  (Requesting cert)
Set SteamNetworkingSockets P2P_STUN_ServerList to '155.133.226.75:3478' as per SteamNetworkingSocketsSerialized
no server running on /tmp/steamcmd/session.sock```
thetredev commented 1 year ago

I just merged the base image update for CS:GO. Could you try again with the ghcr.io/thetredev/steamcmd:base-csgo-latest image as soon as https://github.com/thetredev/steamcmd/actions/runs/6418325654 is finished?

DaVarga commented 1 year ago

New base image has no effect. I had to patch my stuff into the server-common.sh tho. I basically just replaced the _update function with:

_update() {
    if _is_running steamcmd; then
        echo ${MESSAGE_STEAMCMD_UPDATE_RUNNING}
        return 1
    fi

    if [ -f "${STEAMCMD_STEAM_PASSWORD_FILE}" ]; then
        local pwfile
        pwfile="$(cat "$STEAMCMD_STEAM_PASSWORD_FILE")"
    fi

    local user="${STEAMCMD_STEAM_USER:=anonymous}"
    local pass="${pwfile:=$STEAMCMD_STEAM_PASSWORD}"

    if [[ $pass == '' ]] && [[ $user != 'anonymous' ]]; then
        echo "${MESSAGE_STEAMCMD_NO_PASSWORD}"
        user='anonymous'
        unset pass;
    fi

    echo ${MESSAGE_STEAMCMD_UPDATE_STARTED}

    ${TMUX_CMD} send-keys -t ${STEAMCMD_SERVER_SESSION_NAME} "${STEAMCMD_SH} \
        +force_install_dir ${STEAMCMD_SERVER_HOME} \
        +login ${user} ${pass} \
        ${STEAMCMD_SERVER_APP_CONFIG} \
        +app_update ${STEAMCMD_SERVER_APPID} valdate \
        +quit; ${TMUX_CMD} wait-for -S steamcmd-update-finished" "Enter"

    # Fix SteamCMD runtime error
    # [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.dll.
    mkdir -p "${STEAMCMD_USER_HOME}/.steam"

    if $STEAMCMD_SERVER_LINK_SDK64 ; then 
        ln -sf "${STEAMCMD_INSTALL_DIR}/linux64" "${STEAMCMD_USER_HOME}/.steam/sdk64"
    else 
        ln -sf "${STEAMCMD_INSTALL_DIR}/linux32" "${STEAMCMD_USER_HOME}/.steam/sdk32"
    fi

    ${TMUX_CMD} wait-for steamcmd-update-finished
    echo ${MESSAGE_STEAMCMD_UPDATE_FINISHED}

    return 0
}

Also verified the initialization of STEAMCMD_SERVER_LINK_SDK64 which is mandatory. But i cannot see any problems there, since updating and validating works fine.

I do not understand why it was working yesterday.

Update

I just replaced the start.sh with the following one to have the most simplest startup. It is starting now, so i think there must is something going on with the tmux session. I strongly suspect my server.sh since the other image versions are running fine. Maybe you can have a short look?

if [ -f "${STEAMCMD_STEAM_PASSWORD_FILE}" ]; then
    local pwfile
    pwfile="$(cat "$STEAMCMD_STEAM_PASSWORD_FILE")"
fi

local user="${STEAMCMD_STEAM_USER:=anonymous}"
local pass="${pwfile:=$STEAMCMD_STEAM_PASSWORD}"

if [[ $pass == '' ]] && [[ $user != 'anonymous' ]]; then
    echo "${MESSAGE_STEAMCMD_NO_PASSWORD}"
    user='anonymous'
    unset pass;
fi

${STEAMCMD_SH} \
        +force_install_dir ${STEAMCMD_SERVER_HOME} \
        +login ${user} ${pass} \
        +app_update ${STEAMCMD_SERVER_APPID} \
        +quit;

cd "${STEAMCMD_SERVER_HOME}/game/bin/linuxsteamrt64"
./cs2 -dedicated +map de_inferno

tail -f /dev/null
thetredev commented 1 year ago

Maybe you can have a short look?

I can take a look after work.

I do not understand why it was working yesterday.

Probably because the whole CS2 thing needs some time to mature. I do know that the client runs on SteamRT Sniper on Linux, but I'm not sure about the server. It could be that a package is missing or other things they forgot to mention in their wiki. Guess we'll have to figure it out ourselves. Maybe the guys over at https://github.com/GameServerManagers/LinuxGSM have a fix, but I can't take a look right now.

thetredev commented 1 year ago

First look at your server.sh seems fine. I'll try something on my own. It could be that one of these is the problem:

thetredev commented 1 year ago

@DaVarga do you think it's a good idea to create a temporary steam account without Steam Guard for CS2 servers until Valve creates a "real" server application? Not sure if that's even legal but we could do that I guess. I would use a throwaway email address for that.

thetredev commented 1 year ago

Update: Got it almost running without linking ncurses etc., but it fails with multiple error messages

Loaded /var/lib/steamcmd/server/game/bin/linuxsteamrt64/libserver_valve.so, got (nil)
cs2  |  failed to dlopen /var/lib/steamcmd/server/game/bin/linuxsteamrt64/libserver_valve.so error=/var/lib/steamcmd/server/game/bin/linuxsteamrt64/libserver_valve.so: cannot open shared object file: No such file or directory

Which is reasonable because that file doesn't exist. It segfaults later (maybe because of that).

thetredev commented 1 year ago

Weird, after starting cs2 again, it worked (but the errors persist). Gonna try to connect.

Update: can't even start the game on Linux at the moment. Not sure if my PC or Valve doing Valve things... Will try with Flatpak.

Replacing CS:GO with CS2 was a bad idea. They should've just added CS2 as a separate game with the ability to share workshop stuff / skins between the two games. /rant off

Edit: Flatpak doesn't run either lol

DaVarga commented 1 year ago

First look at your server.sh seems fine. I'll try something on my own. It could be that one of these is the problem:

Behaviour was the same with the original base image from yesterday. So it must be something in my source2 specific image. Also without tmux/tini everything started fine so the image itself shouldn't be the problem. For me it seems like it just doesn't want to run in a tmux session for whatever reason.

@DaVarga do you think it's a good idea to create a temporary steam account without Steam Guard for CS2 servers until Valve creates a "real" server application? Not sure if that's even legal but we could do that I guess. I would use a throwaway email address for that.

Im not sure but i think you must have prime enabled for the game server to be advertised in the server browser? It was like that for csgo. You have to do the authenticator stuff just once as long as you keep the ~/Steam folder. For the login itself, there is a solution in my branch. At first lunch you have to attach and enter the code. Sadly sv_setsteamaccount seems no longer a thing in cs2.

Also not sure if they will release a real server. I doubt it.

thetredev commented 1 year ago

Hhhmmm... if tmux is a problem then this whole project could only be used for legacy servers. I do hope they release a real server this year or Q1 next year. They are constantly patching the SteamRT image tho, that's a good sign.

DaVarga commented 1 year ago

I found it, but im not able to fix it. Script seems to wait until server is healthy and kills it then. This explains why its always stopping right after Connection to Steam servers successful. Something is wrong with this block:

wait() {
    while _is_running ${command}; do :; done

    ${TMUX_CMD} kill-session -t ${STEAMCMD_SERVER_SESSION_NAME}
    ${TMUX_CMD} kill-server

    return 0
}

Either i am calling the run script wrong or the _is_running is failing. I really don't know

thetredev commented 1 year ago

Ah I see, thanks for figuring it out!

thetredev commented 1 year ago

I vote for waiting until there's news from Valve regarding real servers. This all seems too hacky for me at the moment.

thetredev commented 12 months ago

I read the article more closely, and it reads like they are working on a solution, albeit dedicated servers overall not being high priority at the moment:

Note: Be aware that the dedicated server is part of the full game, so you will download the full CS2 game for now (est. 33gb + workshop files if any). As there is currently no solution to download the dedicated server application but it exists.

Emphasis on: for now, currently, and but it exists. Accounting for Valve time, and accounting for them getting the game itself ready for all the season stuff they've planned, my best guess is that they will work on dedicated servers (or have them ready) when the first real season starts (2024/spring because of Valve time I don't think 2023/fall is something they'll achieve as planned).

thetredev commented 11 months ago

@DaVarga the wiki entry removed the line about there not being a real dedicated server application. Maybe they fixed it now. I'll test how far I'll come using the official SteamCMD Docker image.

thetredev commented 11 months ago

Good news! I can finally start the game from Linux, and the dedicated server application now works without any Steam login as well.

I'll try fixing this repo now.

thetredev commented 11 months ago

Works with this repo as well. I've done some quick and dirty changes which are not really well thought out to publish yet. The main problem is that the executable is now called cs2 instead of srcds. I guess the easiest fix would be to link cs2 to srcds if AppID is 730. I'll try that.

Edit: Linking works as expected. Gonna cleanup everything tomorrow and push my changes. If everything looks good I'll create a new release.

thetredev commented 11 months ago

Issue fixed with e34f7aae1e161fac995a35b277dd1c1d33179901.