Steamworks - Failing to Find DLLs

Hello. Yet another problem with Steamworks API.
Let’s see, I am trying to get Steamworks running on UE 4.2.0 and I tried both Steamv128 and Steamv129 packages downloaded from SteamPipe.

I did EXACTLY what is in here: Online Subsystem Steam Interface in Unreal Engine | Unreal Engine 5.3 Documentation

My UE4Game.Build.cs file has this:

if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
{
    DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
}

The Steamworks.build.cs is like this:

using UnrealBuildTool;
public class Steamworks : ModuleRules
{
	public Steamworks(TargetInfo Target)
	{
		/** Mark the current version of the Steam SDK */
		string SteamVersion = "Steamv128";
		Type = ModuleType.External;
		PublicIncludePaths.Add(UEBuildConfiguration.UEThirdPartyDirectory + "Steamworks/" + SteamVersion + "/sdk/public");
		string LibraryPath = UEBuildConfiguration.UEThirdPartyDirectory + "Steamworks/" + SteamVersion + "/sdk/redistributable_bin/";
		string LibraryName = "steam_api";
        if ((Target.Platform == UnrealTargetPlatform.Win64) ||
			(Target.Platform == UnrealTargetPlatform.Win32))
		{
			if (Target.Platform == UnrealTargetPlatform.Win64)
			{
				LibraryPath += "win64";
				LibraryName += "64";
			}
			PublicLibraryPaths.Add(LibraryPath);
			PublicAdditionalLibraries.Add(LibraryName + ".lib");
			PublicDelayLoadDLLs.Add(LibraryName + ".dll");
		}
		else if (Target.Platform == UnrealTargetPlatform.Mac)
		{
            LibraryPath += "osx32/libsteam_api.dylib";
			PublicDelayLoadDLLs.Add(LibraryPath);
			PublicAdditionalShadowFiles.Add(LibraryPath);
		}
		else if (Target.Platform == UnrealTargetPlatform.Linux)
		{
			LibraryPath += "linux64";
			PublicLibraryPaths.Add(LibraryPath);
			PublicAdditionalLibraries.Add(LibraryName);
		}
	}
}

I have scanned the whole source code to make sure the #define and hardcoded references are using the
‘Steamv128’ folder:
#define STEAM_SDK_VER TEXT(“Steamv128”)

I also have all DLLs in place:

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/Ue4Stw_zps2775c393.jpg~original

.
.
.

ThirdParty\Steamworks\Steamv128\sdk

Package is in place as well. Still, everytime I try to build a project, editor gives me this:

LogPlayLevel: Display: STEAM: Steam DLLs not present or failed to load! LogOnline:Warning: Unable to load default OnlineSubsystem module Steam, using NULL interface.

Anybody have any idea what is going on??

With “ThirdParty\Steamworks\Steamv128\sdk” I mean
“Source\ThirdParty\Steamworks\Steamv128\sdk”

I am still trying to make it work.
I’ve downloaded a new copy of the engine and rebuilt it, re-installed the v129 sdk folder, copied the correct binary files to the Win32 and Win64 folders.
I’ve added to my Target.cs file

bUsesSteam = true;

I have in my .ini file:

[OnlineSubsystemSteam]

bEnabled=true

But always, always always… When I open the Editor, Log gives me this:

LogOnline:Warning: STEAM: Steam API
disabled! LogOnline:Display: STEAM: OnlineSubsystemSteam::Shutdown()
LogOnline:Warning: Unable to load default OnlineSubsystem module Steam, using NULL interface

Epic, please; Need help!
I can package/launch and run the game just fine for Win32 or Win64; but Steam is always ignored.

Make sure you settle down on a single Steamworks SDK version. Search through files (cs;.cpp;*.h) and make sure that they all use “v128” (or “v129”, but not both). Also, make sure you have a Steam client running while you are trying the game (initialization will fail at later stage otherwise), and appid is appropriate for your account.

Provided that the above is taken care of, there is no obvious error in what you are doing. You can break in FOnlineSubsystemSteamModule::LoadSteamModules() and check what happens inside FPlatformProcess::GetDllHandle(), i.e. whether it is using a wrong path, or there is a problem loading the DLL.

I’ve downloaded latest engine snapshot which has sdk set to v129.
I’ve re-downloaded and installed from Steampipe sdk v129a.
There are no v128 references in engine, ini, Build.cs, etc.

I didn’t mess with GetDllHandle(), it is like you guys shipped. (%s = Steamv129):

#if PLATFORM_WINDOWS
	#if PLATFORM_64BITS
		FString RootSteamPath = FPaths::EngineDir() / FString::Printf(TEXT("Binaries/ThirdParty/Steamworks/%s/Win64/"), STEAM_SDK_VER); 
		FPlatformProcess::PushDllDirectory(*RootSteamPath);
		SteamDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steam_api64.dll"));
#if 0 //64 bit not supported well at present, use Steam Client dlls
		// Load the Steam dedicated server dlls (assumes no Steam Client running)
		if (IsRunningDedicatedServer())
		{
			SteamServerDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steamclient64.dll"));
		}
#endif 
		FPlatformProcess::PopDllDirectory(*RootSteamPath);
	#else	//PLATFORM_64BITS
		FString RootSteamPath = FPaths::EngineDir() / FString::Printf(TEXT("Binaries/ThirdParty/Steamworks/%s/Win32/"), STEAM_SDK_VER); 
		FPlatformProcess::PushDllDirectory(*RootSteamPath);
		SteamDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steam_api.dll"));
		if (IsRunningDedicatedServer())
		{
			SteamServerDLLHandle = FPlatformProcess::GetDllHandle(*(RootSteamPath + "steamclient.dll"));
		}
		FPlatformProcess::PopDllDirectory(*RootSteamPath);
	#endif	//PLATFORM_64BITS
#elif PLATFORM_MAC
	SteamDLLHandle = FPlatformProcess::GetDllHandle(TEXT("libsteam_api.dylib"));
#endif	//PLATFORM_WINDOWS

Only thing I can think of, for some reason engine can’t load the DLLs I’ve copied from my Steam installation (which is up to date).
UE Editor do not show the previous error massage anymore, only the

STEAM: Steam API disabled!

Do I understand properly that you don’t get any other Steam-related error messages except for that “Steam API disabled!”? I suggest that you double check that DLL handle returned in the above function is valid.

SteamAPI can fail to initialize at later stage though. One more thing to check for is whether steam_appid.txt gets created with appropriate application id (this may fail silently if editor binary is run from a read-only folder like Program Files). Alas steam_appid.txt needs to be located in the exe directory, and because of this, it may be worth testing on a packaged game first.

Yes, when I open UE editor project, log says this on start:

Warning: STEAM: Steam API disabled!

Display: STEAM: OnlineSubsystemSteam::Shutdown()

Warning: Unable to load default OnlineSubsystem module Steam, using NULL interface

When I try to build, package a shipping game, steam is ignored. There is no steam_app.txt file generated and no Steamworks folder is copied to the built game folder, no dlls. But also that “ERROR” I had do not print on log anymore when building. It now fails silently like you said.
I don’t get massages about missing dll anymore, only that ‘disabled!’ thing…
This is after I’ve updated to latest engine 4.2 snapshot.

Also tried to manually copy the Steamworks folder to a packaged directory.

Nothing happens when running the exe.

There are several error messages displayed for the various possibilities.

You are not seeing this

Steam DLLs not present or failed to load!

which would happen before the Steam subsystem is enabled to verify the DLLs are present. So presumably the first problem “dlls in right place” is not the issue. The next hurdle is that Steam is trying to initialize itself but is being rejected with a

Warning: STEAM: Steam API disabled!

A quick look in bool FOnlineSubsystemSteam::IsEnabled() shows that is checking to see if you have the DefaultEngine.ini setting

[OnlineSubsystemSteam]
bEnabled=true

which you say you’ve added, so the last and final part of this is the check to see if you are running the game or dedicated server and NOT the editor itself.

	if (bEnableSteam)
	{
		bEnableSteam = IsRunningDedicatedServer() || IsRunningGame();
	}

Which if you are trying to launch the editor then play in “Play In Editor” for example, you will have Steam disabled. If you run the editor with -game or -server you will then be able to use Steam directly.

You can also remove this check so that Steam is enabled in the editor. The reason it was disabled by default was that people didn’t want to have the Steam client open to run the editor and/or see the “user is playing GAME” messages from Steam presence every time an artist/coder started up the editor (and maybe you don’t want to show non dev friends what you are up to as well).

I hope this is your issue, happy to take it further if you run into more problems, and sorry if this kind of warning is unclear. Let’s get you past your troubles and we can talk about how we can improve this afterward.

Thank you very much. I came across that line but I was afraid to change it.
Now Steam loads on Editor and shows the overlay popup. Thank you! :slight_smile:

I just have to figure out now how to package the game and make the standalone load Steamworks too. I copy the dlls to (where I built the game) Desktop\WindowsNoEditor\Engine\Binaries\ThirdParty\Steamworks\Steamv129\Win32 .
But the standalone wont load Steam, or at least no Overlay displays. Also copied Steam dlls to the same folder of the output game exe. Wont load too :[
Sorry, this is my first time in the Unreal fields.

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/UESteamworks_zps94c95ed1.jpg~original

I have to check with QA to see if “deployment/staging” copies the Steam binaries to your “ready for packaging” directory structure. Assuming it doesn’t, you do need all the binaries in the same relative location as you already did for the editor “binaries/thirdparty/…”. Putting the dlls in the same location as the exe will not work because I’m explicitly loading the dlls. All in the name of “keeping the binary dir free of extraneous things”.

Several issues could be in play here.

  • the steam_appid.txt file isn’t being created/working
  • the dlls aren’t loading
  • the bEnabled flag isn’t taking
  • SteamAPI_Init is failing to do its thing

What do you get in the logs when running this way? And what is your commandline? This is with a game executable (mygame.exe) and not (ue4editor.exe mygame …)?

Ok, I forgot to create in the packed exe’s folder the “steam_appid.txt” with the my AppID.
Now overlay loads onto standalone after I copy the dlls + txt file.
Problem solved! Yay! :smiley:

For further reference if anyone have trouble with this too:
DLLs must really go into the “\Engine\Binaries\ThirdParty\Steamworks\Steamv129\Win32” even for the packed standalone. Moving to the same exe’s folder won’t work.
The .txt file however must be side by side with the standalone exe.

Well I’m not so sure this is a good thing in the end though. Firstly, my code should be creating a steam_appid.txt file and deleting it on exe completion as long as you have the SteamAppId=yourId in the DefaultEngine.ini

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=123456789

Additionally, this txt file is NOT required and should probably not be included when you actually ship your product with Valve. This is simply a stop gap so you don’t have to launch your game from the Steam client directly. Valve handles this for you in “shipping”.

Josh, then this must be investigated because I can confirm that the packing process won’t create a .txt file, wont copy the dlls to /ThirdParty/ directory and the game will load Steam only if I have the .txt file there…
And yes, I have SteamDevAppId=xxxxxx in the ini file.

Just to register that the standalone is working when I create the txt file there:

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/UEWwS_zps5f4ed23c.jpg~original

Can you attach a log or otherwise make one available when its not working? I’d like to see where the failure lies.

The copying thing we can certainly address, but assuming they are there (ie you manually copied them), then identifying the failure is important.

Just wanted to to chime in and say “Hi Josh!” :slight_smile:

And also thanks Josh and Bruno for working on this Steam matter so vigorously, I hope to contribute to this Steam party soon once my multiplayer game is ready :slight_smile:

#:heart:

Rama

Sure. Oh god… I changed ‘Build Configuration’ from “Shipping” to “Development”; and suddenly everything works both on x86 and x64 packages.
Dlls are copied, the txt file is created and deleted by the game.
I don’t know how to generate logs from the standalone though. Now that I removed the

bEnableSteam = IsRunningDedicatedServer() || IsRunningGame();

line, Editor won’t fail to load anymore.

Edit: Yep. If I change Build Configuration back to “Shipping”, nothing works. The Steamworks folders wont be created on the packed game.
If I pack on Development mode, everything is fine. No error logs :expressionless:

Well I can’t speak to how shipping works as a whole for UE4 because I don’t run in that mode very much, but I do disable all dev mode options when in Shipping via this function.

OnlineSubsystemSteam.cpp

ConfigureSteamInitDevOptions 

That final build needs to be put up on SteamPipe and run through the Steam client. All other modes are still considered “development” and therefore provide access to the game outside the Steam client with steam_appid.txt

I’m not sure “nothing works” is the right answer, its just that Steam expects you to launch from the client.

The logs you provided are from your packaging step. I was hoping to see the logs from launching MyGame.exe against a cooked version of your game in shipping mode. I would expect to see

[AppId: 123456789] Client API initialized (0 or 1)

Because the DLLs would be there and the inis setup correctly. If launched outside the client I would expect 0 (failure)

So, if I get it right…
We upload the final build to Steam without any of those DLLs we download from SDK?! That is why when packing in ‘Shipping’ mode there is no Steamworks folder?
If that is the case, everything is fine then.
This is my first game on Steam and also my first project with Unreal, I see Steam sdk’s dlls in Dota2’s folder then I though I should upload the sdk dlls too.

Sorry, not quite. You’re going to have to read all the documents on the Valve webpage here.

You do need to have all the binaries and such in your depot. What you don’t need is the steam_appid.txt file because the Steam client will know what app is launching when you launch that way.

Shipping in the engine apparently is missing a few things (like copying the binaries). If you manually do that for now (or use Development mode until you get the hang of it), it should work fine. Once you have the development build working via the Steam content system, then I would worry about Shipping mode.