question

iniside avatar image
iniside asked

Multiplayer 2.0 - Unreal Engine - full source code ?

I downloaded nuget package for C++ GSDK, but it doesn't seem to contain any source code beyond header.

That makes it quite hard to integrate with unreal custom builds, since unreal comes with it's own ssl, crypto and curl libraries which might be different than GSDK.

Would it be possible to provide source code library ? If it cloud be header only, it would be even better :).

unrealCustom Game Servers
1 comment
10 |1200

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

jital avatar image jital ♦ commented ·

Hello,

I know this is not what you're looking for, it is the source code for a multiplayer server in Unity but maybe it will help.

0 Likes 0 ·

1 Answer

·
Mircea Pricop avatar image
Mircea Pricop answered

I actually just ran through this. Here's my solution, hope it helps:

Unpack the nuget package into a ThirdParty folder in my project folder. This gives you access to the .dll and .lib files, as well as the gsdk.h header. You can use an app from the Windows Store for this.

In my .Build.cs file, I added:

if (Target.bWithServerCode) {
  bEnableExceptions = true;


  PublicIncludePaths.Add(
    @"C:\YourGamePath\Source\ThirdParty\GSDK\include");
  PublicAdditionalLibraries.Add(
    @"C:\YourGamePath\Source\ThirdParty\GSDK\lib\Windows\x64\Release\dynamic\GSDK_CPP_Windows.lib");
  PublicAdditionalLibraries.Add(
    @"C:\YourGamePath\Source\ThirdParty\GSDK\lib\Windows\x64\Release\dynamic\libcurl.lib");

}

You don't need the if, but since my client will be android, I want to avoid including or linking the GSDK on client code. Now you can use the GSDK in your server code:

#if WITH_SERVER_CODE
  #include "gsdk.h"
#endif


void UMatchRoyaleGameInstance::Init() {
	Super::Init();


#if WITH_SERVER_CODE
	try {
		Microsoft::Azure::Gaming::GSDK::start();
		Microsoft::Azure::Gaming::GSDK::registerHealthCallback([] { return true; });
	} catch (Microsoft::Azure::Gaming::GSDKInitializationException& e) {
		UE_LOG(LogTemp, Error, TEXT("GSDK Initialization failed: %s"), *FString(UTF8_TO_TCHAR(e.what())));
	}
#endif
}

This will fail at runtime, unless you copy the files from ThirdParty\GSDK\lib\Windows\x64\Release\dynamic into your Binaries folder in your project path. When you package your game, you need to also copy the files next to your packaged binary. More info here.

3 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.

Andy avatar image Andy ♦♦ commented ·

Thanks for helping out! In addition, we do eventually plan to add in the GSDK functionality to our core SDK, which would make it a bit easier to pull into UE4. I don't have a timeline to share right now, but it's definitely something we've looked at.

1 Like 1 ·
rahul-1 avatar image rahul-1 Andy ♦♦ commented ·

Hi,

I did all the steps above, and got the Playfab GSDK integration work on the local Plafab Environment (PlayFabVmAgent). It works absolutely fine, I can connect clients to 127.0.0.1:777 . but when I deploy the same on Playfab server, I get the Server IP and port but somehow it dose not connect I have spent two days in just figuring out but still not clue.

0 Likes 0 ·
Andy avatar image Andy ♦♦ rahul-1 commented ·

Sorry for the delay! You might want to spin up a new thread to discuss this, as I don't think it's exactly related. In the meantime, there are a couple of things to check:

1. When you run the server locally, are you running inside the container?

2. What does status does the server instance report as in Game Manager?

When you do create a new thread, please include your title id so we can have a look.

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.