question

Yaroslav Lazarev avatar image
Yaroslav Lazarev asked

GSDK Gameport issues

I've come across a strange issue, where I had integrated Playfab with test project (which I ultimately successfully deployed and tested on cloud), then started integration with my actual project which had issues and now no project will work with Playfab plugin enabled.

Specifically problem occurs when 'Set Default Server Host Port' is called (from Blueprint or C++ implementation) it would call GSDKUtils.cpp:GetGameServerConnectionInfo this results in: Exception thrown: read access violation. __that was 0x138.

This occurs when running from inside the development game editor.

I've reinstalled everything now, including Visual Studio and all the build tools, I've re-installed the UE engine from scratch and re-downloaded and re-integrated the GSDK plugin too, however the problem still persists.

if I package the project and run it from client, the error is: Unreal GSDK requires a named port: gameport. This was not provided by MPS build port-configuration.

Any thoughts how to debug this issue?

Custom Game Servers
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

As you can see in https://github.com/PlayFab/gsdk/blob/main/UnrealPlugin/Source/PlayFabGSDK/Private/GSDKUtils.cpp#L165 method, the error occurs when no port with the name "gameport" is found after iterating through all game port configurations. May I know if you follow https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/server-sdks/unreal-gsdk/third-person-mp-example-gsdk-project-setup to integrate the GSDK with your project and follow https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/server-sdks/unreal-gsdk/third-person-mp-example-project-local-deployment-and-debugging to set the MultiplayerSettings.json and run the packaged project from client?

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Yaroslav Lazarev avatar image Yaroslav Lazarev commented ·

Hi @Xiao Zha, thank you for the reply

I will have to comment in more than 1 reply due to size.

yes, let me go in order and i will use the simple, empty project as example, which I had already compiled and deployed successfully before, but no longer works.

If I use default GameInstance, the game will work as expected, obviously not connected with GSDK - just to confirm that project works fine without GSDK integration.

6878-image.png

When you use the introduced GameInstance, one of the first things you do is enter:

 void UPlayFabGameInstance::OnStart()
 {
     UE_LOG(LogPlayFabGSDKGameInstance, Warning, TEXT("Reached onStart!"));
     UGSDKUtils::ReadyForPlayers();
 }

And during the execution of ReadyForPlayers, you will get the below stacktrace.

6886-image.png

0 Likes 0 ·
image.png (174.2 KiB)
image.png (142.2 KiB)
Yaroslav Lazarev avatar image Yaroslav Lazarev commented ·

weirdly, it comes from here:

 void FGSDKInternal::ReadyForPlayers()
 {
     UE_LOG(LogPlayFabGSDK, Display, TEXT("ReadyForPlayers, setting game state to StandingBy!"));
 #if !(WITH_DEV_AUTOMATION_TESTS && WITH_EDITOR)
     AsyncTask(ENamedThreads::GameThread, [this]()
     {
 #endif
         SetState(EGameState::StandingBy);
         if (OnReadyForPlayers.IsBound())
         {
             OnReadyForPlayers.Execute();
         }
 #if !(WITH_DEV_AUTOMATION_TESTS && WITH_EDITOR)
     });
 #endif
 }

specifically:

 SetState(EGameState::StandingBy);

which is defined in GSDKInternal.cpp:

 void FGSDKInternal::SetState(EGameState State)
 {
     FScopeLock ScopeLock(&StateMutex);
    
     if (HeartbeatRequest.CurrentGameState != State)
     {
         HeartbeatRequest.CurrentGameState = State;
         SignalHeartbeatEvent->Trigger();
     }
 }

and here, specifically:

 FScopeLock ScopeLock(&StateMutex);
0 Likes 0 ·
Yaroslav Lazarev avatar image Yaroslav Lazarev commented ·

So I just checked out GSDK from several commits back and it appears to work. It appears that there's been some breaking changes introduced recently.. unfortunately I lost a week due to that. I am not 100% sure, but i expect it was this commit that broke it for me: https://github.com/PlayFab/gsdk/commit/ca26f5be14ff9c3efb8e3f37eaee1fd043fa952d

i will raise it on github

0 Likes 0 ·
mohammadhabibiwork avatar image mohammadhabibiwork Yaroslav Lazarev commented ·

hi on your local multiplayer agent file MultiplayerSettings.json i change game_port to gameport on line 28 to it fixedfor me.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.