Hey guys a relatively short one here but I feel this may be very useful for those who end up in the same predicament as myself.
For a little context, I am working on a project that is going to be targeting Steam, this project will be releasing with dedicated and listen server support, having only worked with listen servers previously, I figured I’d start with dedicated servers (why not start with the challenging task), I want to explicitly avoid using any kind of “sessions” plugin for this functionality, it may be easier to just drop a plugin in for something like this, but I like to rely more on my own implementations just in case X, Y or Z plugin stops being maintained.
After setting up the basics for Steam in the DefaultEngine.ini I moved to the C++ for creating a session on the dedicated server (using the RegisterServer() method in the GameSession class), after spending about 2 hours sifting to find some solid examples/documentation for all of the previous steps that would still be valid for Unreal Engine 4.24, I had finally setup and wrote what seemed sufficient just to get a session registered with Steam so I packaged the project into a dedicated server executable which went absolutely fine, but when running the dedicated server, it loaded fine, however I was receiving the following error/s in the server logs.
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()
Now, I was already copying in the Steamworks steam_api64.dll in from the ThirdParty binaries folder so that was all fine, but I noticed that the steam_appid.txt was not being created for some reason, so I was kind of stuck, I spent another 2 hours scraping every nook and crevice of the unreal forums/internet and came up short of anything useful, I am now a little frustrated at this point, 4 hours to get a simple server up on Steam…. I can implement my present custom backend into a game with less than half this time! Anyway, a sudden idea sprung to mind, I’ll copy the dedicated server package over to my local machine (I have a build server which automates packaging and updating/running test servers for me).
To my suprise, everything booted up 100% fine and I was even able to find the session in Steam , things were getting very interesting, the ol’ “It works on my machine” situation came to mind, so I tried this on another remote machine I have to see if it was an isolated issue with my build server, nope, I had the same issue on the second dedicated server “STEAM: [AppId: 0] Game Server API initialized 0”, this was good news as it now gave my some extra info as to what could be wrong, but it was still somewhat unhelpful as I still had to find out what the problem was….
Then it dawned on me, the only meaningful Steam related difference between my local machine and the two remote servers is the Steam client! So, I quickly installed the Steam client on my build server, signed into my second steam account, tried out the dedicated server package again and eureka! Everything now worked on the server.
So, here we are, at the solution and end to this blog post, I could have condensed everything above into what is about to follow, but that’s no fun, anyway, here’s the too long, didn’t read version.
TL;DR
If your UE4 project is targeting Steam and you are trying to use the Dev AppId 480 for dedicated server testing, you HAVE to have the Steam client installed wherever you are running the server package, once you have your own AppId this limitation will not be present (I am yet to do so, thus that last part is a 100% assumption, not a statement of fact).
If this helps anyone out and you feel like buying me a beer, or pizza, feel free to send me a tip! 🙂
Till next time,
KamikazeXeX