rlabrecque / Steamworks.NET

Steamworks wrapper for Unity / C#
http://steamworks.github.io
MIT License
2.83k stars 368 forks source link

20.2.0 SDK 1.57 not initializing on Steam Deck #557

Closed hbaInfinity closed 4 months ago

hbaInfinity commented 1 year ago

After updating from 15.0.0 (Steamworks 1.49/05.92.36.75) to the latest version 20.2.0 (SDK 1.57/ 08.02.21.95), our game seems to no longer Initialize on Steam Deck. According to the logs, we are only getting the [Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information. error, but digging down deeper, the part of the initialization that it is failing on is in Steam.cs, line 316: m_pSteamUser = SteamClient.GetISteamUser(hSteamUser, hSteamPipe, Constants.STEAMUSER_INTERFACE_VERSION);, which returns an IntPtr.Zero.

This issue seems to only happen on the Steam Deck, where running the exact same code on PC has no issues.

For reference, we are using Unity 2021.3.16f1, and tp upgrade, we completely removed our 15.0.0 code from the codebase, and added 20.2.0 into the game via Unity Package Manager. I did also notice that the steam_api64.dll is no longer in the root of the Steam Build Directory, and assuming that is intended as well (athough manually copying it into the Steam Deck install folder does not fix this issue)?

Any thoughts on what could be causing this issue?

hbaInfinity commented 1 year ago

@rlabrecque @TwoPoint-AndyChappell - Just did a test on the new Steamworks.Net 20.2.0 (1.57 Steamworks SDK) using the Steamworks.Net-Test Project and I am seeing the same issues when running on this test project.

Here is an example of the test project running fine on 20.1.0 (1.53 Steamworks SDK) SteamDeck_Steamworks_20 1

And here is the exact same code failing on 20.2.0 (1.57 Steamworks SDK) SteamDeck_Steamworks_20 2

Any thoughts on what in this new Steamworks SDK could be breaking only on Steam Deck?

nictringali commented 1 year ago

Also encountered this issue with 20.2.0. SteamAPI.Init() always failed only when running on steam deck, with a windows build. Unity version 2021.3.0, from a completely fresh importing of steamworks.net from the unitypackage.

trentburke commented 1 year ago

We are seeing the same issue. SteamAPI.Init() works on 20.1.0, but on 20.2.0 on steam deck it fails.

TwoPoint-AndyChappell commented 1 year ago

This is strange - I've double checked the codegen verses the standard Steamworks SDK and the interface versions match correctly - it should be requesting the 1.57 version of SteamUser, and I don't know why this wouldn't be working on the Steam Deck. Is your Steam Deck fully up to date? I do have one here which I can try out and see if I'm able to get the samples working, but I'm super busy with work tasks right now so this would have to wait until next week.

It's worth double checking that your Steam API .dll / .bundle / .so is correctly updated in your unity project. It should be 8.2.21.95 - if this hasn't been updated then it might fail to find the specified interface version?

Otherwise have you tried building the SpaceWar example for Windows from the 1.57 SDK and running that on the Deck? This should also attempt to request the same SteamUser interface version.

TwoPoint-AndyChappell commented 1 year ago

Right, I managed to sneak some time over lunch to deploy a build of the Steamworks.NET example to my SteamDeck. The deck itself is up to date, and the Windows build ran using Proton Experimental without any reported errors, and was able to make Steam calls successfully.

I used Unity 2022.2.0b9 seeing as this was just what I had installed in Unity Hub that wasn't currently in use - I removed the 20.1.0 package from Package Manager, then added 20.2.0 from Git as per the installation instructions. I then deleted my Library as Unity hung for 5 minutes "building assets" and I wanted to be sure everything was being rebuilt correctly. I did a Mono build as it turns out I didn't have the il2cpp backend installed for this version - although given that we're fundamentally dealing with native calls I doubt this would be an issue. I enabled Developer Mode on my Steam Deck, installed Space Wars via the console and then deployed the build using Steam Devkit Management Tool. I was able to launch it without any issues - there was no errors reported in the Unity Console.

I'm not sure what else to recommend except checking your deck is up to date (there have been a number of updates recently) and check which version of Steam Play / Proton you are set to use. I left mine up to the deck to decide, and it picked Proton Experimental for this. Also worth noting that I added the encryptedappticket dll even though the example doesn't use it just out of habit.

trentburke commented 1 year ago

Proton compatibility seems to be the culprit here.

Some more background info: we are on Unity 2020.3.25f1, checked the dlls and they are version 8.2.21.95. I also tried building Steamworks.NET-Example as you described, and it worked on 20.1.0 but 20.2.0 had the init fail.

Both our game and the example project don't run on the default compatibility, this may be an issue with the version of Unity we are on. In the past we've used Proton 7.0-6 to successfully launch the game. I tried Proton 8.0-2 and the init call does not fail there. I've tried the following compatability settings:

Default - ❌ GE-Proton7-24 - ⚠️ Proton Experimental - ✔️ Proton 8.0-2 - ✔️ Proton 7.0-6 - ⚠️

❌ - App fails to launch ⚠️ - App launches, init fails ✔️ - App launches, init succeeds

Maybe this is just a problem with dev builds. In steamworks developer dashboard we have a recommended runtime of proton-stable, which might now default to Proton 8.0-2? We at least have a work around and have something to tell customers if they ask. I don't see a way to force a recommended runtime in the steamworks dashboard, I think that was set by Valve's review team, but that's a question for somewhere else.

Thanks for pointing out Proton versions!

TwoPoint-AndyChappell commented 1 year ago

Great, thanks for confirming :) I suspected it'd be something like this - I didn't consciously select Proton Experimental either, I'm guessing it might just do this if you sideload a build and tick "Steam Play"? Either that or Valve have set Proton Experimental for SpaceWar and the "borrowed" AppID just picked this up.

STARasGAMES commented 1 year ago

Places where you need to remove old Steamworks.NET before installing the new version: Assets/Editor/Steamworks.NET/ Assets/Plugins/Steamworks.NET/ Assets/Plugins/steam_api.bundle/ Assets/Plugins/x86/libsteam_api.so Assets/Plugins/x86/steam_api.dll Assets/Plugins/x86_64/libsteam_api.so Assets/Plugins/x86_64/steam_api64.dll

After the deletion of all these folders and files our build on Steam Deck starts working. Unity 2019.4.30

trentburke commented 1 year ago

We didn't have those folders in our project, everything was under Assets\com.rlabrecque.steamworks.net. But to try, I removed that completely, and re-added using package manager and I'm seeing the same issue reported above. We cannot initialize steamworks properly on the noted proton versions.

hbaInfinity commented 1 year ago

Places where you need to remove old Steamworks.NET before installing the new version: Assets/Editor/Steamworks.NET/ Assets/Plugins/Steamworks.NET/ Assets/Plugins/steam_api.bundle/ Assets/Plugins/x86/libsteam_api.so Assets/Plugins/x86/steam_api.dll Assets/Plugins/x86_64/libsteam_api.so Assets/Plugins/x86_64/steam_api64.dll

After the deletion of all these folders and files our build on Steam Deck starts working. Unity 2019.4.30

As mentioned in the original comment, we had completly removed the old plugin from the project before moving to the Unity Package Manager version of the plugin.

It is as @trentburke mentioned, our game will work fine in Proton 8.0-2, and Experimental, but unfortunately not on the other versions. I did try asking on the Steamworks Forums if there was a way that we can set our default Proton version to use on Steam Deck, but I haven't been successful finding a way on our end.

hbaInfinity commented 1 year ago

Just as a heads up, after opening a support ticket with Steam, it seems like Steamworks SDK 1.57 will only work on Proton version 8.0 and higher, and does not support 7 or lower (it was posted above). This does not seem to be an issue with the Steamworks.Net plugin itself, and instead with the actual DLLs provided by Steam. I thought I would provide this as I couldn't find any other information about this posted anywhere else on the Steamworks forums or patch notes.