Skip to content
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

Most games are borked when launched through steamcmd or directly - consider launching games using steam -silent -applaunch <id> by default #51

Closed
zeerooth opened this issue Sep 3, 2022 · 6 comments
Milestone

Comments

@zeerooth
Copy link
Contributor

zeerooth commented Sep 3, 2022

Hi!
I've tried to use steam-tui for a fair while now and unfortunately it seems like most often than not games are borked and refuse to launch.
For example, lately I've tried to make 4 linux native games work with different launch scripts, both on NixOS and Ubuntu and this is the result:

  • Terraria - doesn't launch, steamcmd reports CHIDDeviceListSDL(): Couldn't load libSDL2-2.0.so.0, not enumerating devices
    I managed to get around that by preloading the SDL2 library packaged by steam and running the binary directly with LD_LIBRARY_PATH=~/.steam/bin32/:$LD_LIBRARY_PATH ~/.local/share/Steam/steamapps/common/Terraria/Terraria but it threw an exception anyway Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Xna.Framework.FNAPlatform' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object. On Ubuntu it terminates with [S_API FAIL] SteamAPI_Init() failed; create pipe failed.. I gave up on that one. Works on steam GUI.
  • missed messages - steamcmd reports that ERROR! AppId 812810 launch failed (Update required) but when I run app_update 812810 there's nothing to update. Running the binary directly runs the game in 0x0 window which well, makes it pretty unplayable. Works on steam GUI.
  • War Thunder - steamcmd reports ERROR! AppId 236390 launch failed (Missing executable). Works if launched directly either from steam or command line, but steam-tui reports that it can't find the executable anyway (because of steamcmd) or gets stuck on launching... if steam is running in the background.
  • You Have to Win the Game - basically the same as missed messages, but when run directly this one can't even load steam api by default error while loading shared libraries: libsteam_api.so: cannot open shared object file: No such file or directory. Again, steam-tui gets stuck in launching... phase. And again, works through steam GUI.

All in all, I don't know if it's only happening to me, but based on my experience and the discussions I've read online it seems like steamcmd is pretty ill-equipped for launching games beside simple servers, as it doesn't manage the libraries correctly and probably isn't even properly maintained (looking at the tiny documentation and non-existent support). To make user experience better, I'd simply offload the game launch phase straight to steam GUI and with -silent -nobrowser which seems to work, at least for me, 100% of the time (and this should also auto detect and start games with steam proton).
However, that's just my opinion for now - I'd like to hear if anyone else encountered such errors and if you were able to solve it, if it's possible at all.

@dmadisetti
Copy link
Owner

so executing run-steam steam-tui works for some of my use-cases. I only really play a handful of games so this hasn't been a major sticking point for me.

I see 2 major ways to address this.

  • More fallbacks for launching.
  • Allowing custom run scripts.

Let me know if you think this would address your issues

@zeerooth
Copy link
Contributor Author

Yes, I think that'd work great!

I think that that steam -silent -applaunch <appid> or steam steam://rungameid/<appid> should be used by default if steam is running instead of currently used runscript in steamcmd.

It's because I found out why my games are stuck on the launching... phase - it seems that if app_launch fails in steamcmd it doesn't properly return any errors and simply exits with an error code 0, which means what steam-tui is unable to detect if an app was actually launched or not, see:

❯ steamcmd +@ShutdownOnFailedCommand 1 +@NoPromptForPassword 1 +@sStartupScript
Redirecting stderr to '/home/radek/.local/share/Steam/logs/stderr.txt'
Looks like steam didn't shutdown cleanly, scheduling immediate update check
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation - version 1660762488
-- type 'quit' to exit --
Loading Steam API...OK
"@ShutdownOnFailedCommand" = "1"
"@NoPromptForPassword" = "1"
"@sStartupScript" = ""

Steam>runscript /home/radek/test.launch
Logging in user '####' to Steam Public...OK
Waiting for client config...OK
Waiting for user info...OK
app_update "105600" -validate
 Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
 Update state (0x5) verifying install, progress: 15.63 (109429880 / 700338209)
 Update state (0x5) verifying install, progress: 94.18 (659576994 / 700338209)
 Update state (0x5) verifying install, progress: 96.62 (676682291 / 700338209)
Success! App '105600' fully installed.
app_run 105600
Game process added : AppID 105600 "/home/radek/.local/share/Steam/linux32/reaper SteamLaunch AppId=105600 -- '/home/radek/.local/share/Steam/steamapps/common/Terraria/Terraria.exe'", ProcID 24583, IP 0.0.0.0:0
chdir /home/radek/.local/share/Steam/steamapps/common/Terraria
CHIDDeviceListSDL(): Couldn't load libSDL2-2.0.so.0, not enumerating devices
Game process removed: AppID 105600 "/home/radek/.local/share/Steam/linux32/reaper SteamLaunch AppId=105600 -- '/home/radek/.local/share/Steam/steamapps/common/Terraria/Terraria.exe'", ProcID 24583
quit
❯ echo $?
0

However, if there is an error reported by steamcmd itself, it'll correctly return an error exit code, see:

❯ steamcmd +@ShutdownOnFailedCommand 1 +@NoPromptForPassword 1 +@sStartupScript
Redirecting stderr to '/home/radek/.local/share/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation - version 1660762488
-- type 'quit' to exit --
Loading Steam API...OK
"@ShutdownOnFailedCommand" = "1"
"@NoPromptForPassword" = "1"
"@sStartupScript" = ""

Steam>runscript /home/radek/test.launch
Logging in user '#####' to Steam Public...OK
Waiting for client config...OK
Waiting for user info...OK
app_update "812810" -validate
 Update state (0x0) unknown, progress: 0.00 (0 / 0)
Success! App '812810' fully installed.
app_run 812810
ERROR! AppId 812810 launch failed (Missing executable)quit
❯ echo $?
13

@purplebar0
Copy link

purplebar0 commented Feb 4, 2023

Dun dun duuuuuuun!

The LaunchOptionIndex argument of app_launch must be used to select the OS flavour of the game. (Source)

Maybe out of the question, but under app_info_print for the corresponding app, the "<AppID>" > "config" > "launch" > "<#>" > "config" > "oslist" value determines which launch option is for which OS.

The final part is to link these two binaries used by Steam to launch games to the working directory of SteamCMD:
ln -s ~/.local/share/Steam/ubuntu12_32/{reaper,steam-launch-wrapper} ~/.steam/steamcmd/linux32

As for games with other Steam dependencies, for all I know, it may be possible to make a clean Steam install and run SteamCMD in it. I would assume that many of them would have to be updated by the client rather often, so if you find where to run it or what else to link to its working directory, it may be possible to use Steam DRM (alongside a full client install) too. (edit: superseded by newer comment)

@ghost
Copy link

ghost commented May 18, 2023

Copy steamconsole.so into your Steam install's ubuntu12_32 folder and run steam -textclient for a surprise.

This console seems to be able to open games in the proper Ubuntu environment, but the Steam auth service isn't running so most games will refuse to start. I think that to have proper control over things you end up needing to play the role of the steam executable (or steamclient.so???).

@purplebar0
Copy link

purplebar0 commented May 24, 2023

Copy steamconsole.so into your Steam install's ubuntu12_32 folder and run steam -textclient for a surprise.

This console seems to be able to open games in the proper Ubuntu environment, but the Steam auth service isn't running so most games will refuse to start. I think that to have proper control over things you end up needing to play the role of the steam executable (or steamclient.so???).

Here's what I learned so far through my own research, testing and asking around.

Running SteamCMD (or, rather, Steam with -textclient) this way is no different than running SteamCMD without forcing the install directory, provided a full Steam installation is present. SteamCMD finds the existing Steam client installation, works in it and inherits all libraries and custom library folders, so don't force the install directory unless you absolutely have to.

steamclient.so is only responsible for VAC, to my knowledge (edit: confused it with steamservice.so). Basically, you need either the full Steam client, or a re-implementation like SteamLite (Windows-only) in order for games to communicate with Steam.


TL;DR: The original proposal in this issue is indeed the optimal solution.

@dmadisetti dmadisetti added this to the v0.3.0 milestone Feb 1, 2024
@dmadisetti
Copy link
Owner

I have this as a fallback if the script doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants