Dedicated server keeps deleting our steam_appid

We have a dedicated server on Playfab and we are trying to make it use the steam online subsystem. When it starts, we get the following error:

LogOnline: Display: STEAM: Loading Steam SDK 1.42
LogOnline: OSS: Creating online subsystem instance for: Steam
LogOnline: STEAM: [AppId: 0] Game Server API initialized 0
LogOnline: Warning: STEAM: Failed to initialize Steam, this could be due to a Steam server and client running on the same machine. Try running with -NOSTEAM on the cmdline to disable.
LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()
LogOnline: Warning: STEAM: Steam API failed to initialize!
LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()
LogOnline: OSS: Unable to create OnlineSubsystem module Steam
LogOnline: OSS: Creating online subsystem instance for: NULL

We noticed that our dedicated server deletes the steam_appid.txt file when it starts, which explains the line:
LogOnline: STEAM: [AppId: 0] Game Server API initialized 0

Is this suppose to be happening? How do we make sure our dedicated server uses the correct appid?

@KevinDuguay
I checked out the Steam forums, and it actually seems like this has been a pretty common issue, and I actually found a Megathread where a ton of people posted their solutions to it:

It seems around #27 is where the solutions begin - but the thread is about 10 years old. Other answers stipulate a firewall problem.
I hope some of this can help!
-Zen

Thank you, but my question was about my steam_appid.txt being deleted:

Is this suppose to be happening? How do we make sure our dedicated server uses the correct appid?

Are you using Playfabs’ API to access Steam? I don’t think that is supposed to be happening.
In order to integrate Steam Login through PlayFab, You need to install Steam on the Add-ons page using both the Steam App ID and the Steam Web API key. Unreal requires a little bit of work on its end too, so here’s the quickstart guide to help you along the way:

I hope this can help you out
-Zen :vulcan_salute:

Playfab works perfectly with our project. We have steam installed on the add-ons page. When we open the game with a steam client, playfab will create an account linked to that player steam accounts. Also, our clients have access to the steam overlay and can easily do request to playfab without issues. The dedicated server can be found and the matchmaking is ok.

Our issue is that the dedicated server fails to initialize the steam online subsystem because it deletes it’s own steam_appid.txt. What could possibly explain such a behavior?

It’s probably not on the right path, so its getting garbage collected.

Where could I find the path it uses?

The OnlineSubsystemSteam contains code to explicitly delete the file during shutdown of the module (https://github.com/EpicGames/UnrealEngine/blob/46544fa5e0aa9e6740c19b44b0628b72e7bbd5ce/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSubsystemSteam.cpp#L566). However this should only happen when you’re not building a SHIPPING configuration of your project. Is there a reason you aren’t using SHIPPING, otherwise switching to it should at least prevent the file from being deleted.

We are using a shipping version, but it still deletes the steam_appid.txt file. Before we start the server, our steam_appid.txt file is in WindowsNoEditor/OurProject/Binaries/Win64/. Once it is started, it is gone.

We did a recent test where we ran the dedicated server from one of our computers. We got the same error, except if we had a steam client open. This might be something obvious that we just missed, but do a dedicated server absolutely need a steam client open and connected in order to work? Is there any way to make it work without that?

@KevinDuguay
I think the test file if used through the Steam Client, as in launched from Steam, is not necessary at all from what I understand.
My only other suggestion would be to maybe place it in the WindowsServer folder rather than the WindowsNoEditor folder.
I hope this can help, and please keep updating!
-Zen :vulcan_salute:

I’m not sure I understand your last reply. What do you mean by test file? Also, are you suggesting renaming our WindowsNoEditor folder to WindowsServer? What difference would that make?

@KevinDuguay
This is the tutorial I followed to create the server from Microsoft and Unreal:

I’ve referred to those specifically because that’s how I’ve created my servers through these tutorials.
By test file, I just mean that if you’re using steam to launch the game / connect to its servers, the API key is automatically added, so usually, that file has 480 code for testing purposes.
Happy developing! :vulcan_salute:
-Zen

Your reply contains a lot of useful information, but it unfortunately has nothing about steam. Our dedicated server already works, we can use Playfab without any problems and we can play 3 vs 3 matches, but only when we don’t use the steam OSS.

I still digged a little deeper and found that the issue seems to come from SteamGameServer_Init method of the steam_api64.dll (Called in FOnlineSubsystemSteam::InitSteamworksServer()). Unfortunaly, I can’t figure out how to get some accurate info on why this fails.

@KevinDuguay
I found this from the Steamworks issues in GitHub:

Maybe try putting the .txt on the same level as the DLL?
-Zen :vulcan_salute:

I tried and it didn’t change anything. I also got more info. After digging in the steam OSS plugin, I found out that the problem comes from the OnlineSubsystemSteam.cpp in the method FOnlineSubsystemSteam::InitSteamworksServer() at line 699. The plugin attempts to call SteamGameServer_Init of the steam api dll (steam_gameserver.h (Steamworks Documentation)). This unfortunately failed and we do not get any kind of specific error to tell us more.

Looking around, I found this page in the steamwork doc. It shows that I should be able to have debug messages from the steam api dll, but I don’t know if unreal can show me those:
https://partner.steamgames.com/doc/sdk/api/debugging

UPDATE:

I was able to build the default FPS project with Unreal 4.27.2 and start the dedicated server without issue. Unfortunaly, doing the same with UE 4.23.1 leaves me with the same issue where the steam dedicated server fail to initialize UNLESS the steam client is running (which is obviously something that we don’t want to have to do) and I tried that twice from scratch. Any idea why 2.23.1 wants the steam client to be running?

@ZenLeviathan

@KevinDuguay
So everything that I’ve gathered from this setup:

Pretty much has told me that “during a graceful shutdown of the engine, UE deletes this file”. Other than it needs to be on the same level/path as the executable file of the server.
The only other insight I think I could provide is in the 4.23 path notes, under the Online Section, it has a portion about certain files no longer being automatically included by Unreal and needing to be included in a specific directory.

I hope this can help,
-Zen

@ZenLeviathan

I got some good news. It turns out that the reason steam wouldn’t initialize on our dedicated server was because we did need the following dll (just has mentioned in the doc you linked):

  • steamclient64.dll
  • tier0_s64.dll
  • vstdlib_s64.dll

Now, we still have an issue where the client times out when attempting to client travel to the server.

Interesting detail, our server creates a session, but the clients don’t join it. I assumed that since playfab’s matchmaking returns to all client the ip addresse and port to connect to, we can simply client travel without needing to join the session.

Using the exact same code, but with the default ipnet driver works flawlessly (we don’t join the session either in that case).

Can travelclient() be used even if my client didn’t join the steam session? Could that be the source of the time out?