question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Steamworks.GameServer.Init doesn't take 6 arguments / gameserver.init "bad_response"

See original GitHub issue

Steam.cs : lines 156/162

public static bool Init(uint unIP, ushort usAuthPort, ushort usGamePort, ushort usQueryPort, EServerMode eServerMode, string pchVersionString) { // added AuthPort variable 
            InteropHelp.TestIfPlatformSupported();

            bool ret;
            using (var pchVersionString2 = new InteropHelp.UTF8StringHandle(pchVersionString)) {
                ret = NativeMethods.SteamInternal_GameServer_Init(unIP, usAuthPort, usGamePort, usQueryPort, eServerMode, pchVersionString2); // use NativeMethods.SteamInternal_GameServer_Init instead
}

Steamworks GameServer won’t initialize correctly without the Authentication port, this allows the use of the Authentication port.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
JamesMcGheecommented, Apr 10, 2021

That’s the worksround we are using at the moment Simply passing in a value of 0 on the usSteam port I think the param is called.

We are seeing issues with GameServers not getting messages from clients when using SteamNetworking or SteamNetworkingSockets (and its GameServer varients) even with this work around in place. That issue may be releated to something else around Mirror or similar but was hoping the server intialization and transport issue was related for a single easy fix 😃

For the moment we using a modified Steam.cs which calls SteamInternal_GameServer_Init, from what I saw in the game server header this is what SteamGameServer_Init does anyway so I think that will do us for now.

1reaction
JamesMcGheecommented, Apr 10, 2021

I have done a re-read and some more testing on this one

  1. using the source from this project directly so the assemblies are the ones included in this project’s Plugin folder.

  2. As is e.g. without any changes when we initalize GameServer.init … we see the issue reported above, that is the odd looking UDP port binding on port 1 and the server will not show up in Steam Game Server Browser either via query through the API nor via the view in the Steam Client.

  3. If we modify Steam.cs to call SteamInternal_GameServer_Init passing in any value even 0 as the second param the most apparent issues appear to resolve and the server shows up in the browser.

Having a look over the change you linked from Steamworks SDK and the related steam_gameserver.h I do see a note there

// SteamGameServer_InitSafe has been replaced with SteamGameServer_Init and
// is no longer supported. Use SteamGameServer_Init instead.

When I examen the NativeMethods.cs of Steamworks.NET for the method in question SteamGameServer_Init I see its referencing an entry point SteamGameServer_InitSafe

[DllImport(NativeLibraryName, EntryPoint = "SteamGameServer_InitSafe", CallingConvention = CallingConvention.Cdecl)]

That is as far as I got, its far to late in the evening 😃 … or well early in the day now 😦 … to keep poking Hopfully that is of some use to others

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Steamworks.NET] Could not initialize GameServer
I've got this error every time i start a game. ERR [Steamworks.NET] Could not initialize GameServer. I've reinstalled Steam and 7 days to ......
Read more >
Dedicated Server dying on launch after today's update
Dedicated Server dying on launch after today's update. The error was: InvalidOperationException: Steamworks GameServer is not initialized.
Read more >
[Steamworks.NET] Could not initialize GameServer
I've got this error every time i start a game. ERR [Steamworks.NET] Could not initialize GameServer. I've reinstalled Steam and 7 days to...
Read more >
steam_api.h
Provides the core foundation to initialize and access the Steamworks API. ... k_EResultBadResponse, 76, Bad Response due to a Parse failure, missing field, ......
Read more >
GameServer.LogOn timed out issues - no player can ...
I started dedicated server, forwarded ports, (26900-26910) but server still goes to time out. (see last row from log).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found