Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux support #16

Open
GeorgSchenzel opened this issue Jul 28, 2023 · 19 comments
Open

Linux support #16

GeorgSchenzel opened this issue Jul 28, 2023 · 19 comments

Comments

@GeorgSchenzel
Copy link

Similar to #15, having Linux support would also be greatly appreciated. Are there any plans for that?

@nassosterz-ms
Copy link
Collaborator

Yes adding Linux support here is on the roadmap but unfortunately cannot provide an estimate about this yet. Same as with the macOS issue, you can try following the steps from the PlayFab Party Unity repository and achieve it in this repo. If you want more guidance on that, let me know!

@GeorgSchenzel
Copy link
Author

Do you mean by using SignalR like described here? That actually doesn't seem too difficult, unless I am missing something?

All I want to do is get matchmaking and lobby updates without continuously polling.

@nassosterz-ms
Copy link
Collaborator

I was thinking of the following.

Pull the Windows unity plugin (the one from this repo).

Inside /Assets/PlayFabMultiplayerSDK/Source/DLLs, create a new directory and name it Linux. Inside the Linux directory, add the Linux binaries that you can download from here: https://github.com/PlayFab/PlayFabMultiplayer/releases (unzip Microsoft.PlayFab.PlayFabMultiplayer.Cpp.Linux.zip. Specifically add libPlayFabMultiplayer.so.

Then, in Assets/PlayFabMultiplayerSDK/Source/Scripts/Interop/InteropConfiguration.cs, before the else, add another elif statement as:

#elif (UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX) const string ThunkDllName = "libPlayFabMultiplayer";

That should do it. Let me know if it helps you achieve your target!

@cprenoveau-illogika
Copy link

Hello! I'm also trying to implement Linux support.
I was wondering if anyone had any luck with it so far. I can't get it to work on my VMWare Ubuntu 22.04 virtual machine.

I get an assembly not found error, even though the .so is in the build in the correct folder.
DllNotFoundException: libPlayFabMultiplayer.so assembly: type: member:(null)

@cprenoveau-illogika
Copy link

cprenoveau-illogika commented Aug 11, 2023

Version 1.6.2 seems to be the issue. Version 1.5.2 loads correctly.
Now I'm getting an error 0x8923620C. But that's progress at least

@nassosterz-ms
Copy link
Collaborator

This error code hints that the PlayFab service returned an http status error code that is neither in the 400 nor in the 500 group.

What APIs are you using / calling from PlayFab?

@cprenoveau-illogika
Copy link

I tried the following:
CreateAndJoinLobby
FindLobbies
CreateMatchmakingTicket

They fail with the same error in their respective ProcessLobbyStateChanges and ProcessMatchmakingStateChanges trigger responses.

@nassosterz-ms
Copy link
Collaborator

nassosterz-ms commented Aug 28, 2023

Just to be sure, you are first calling PlayFabMultiplayer.Initialize(), correct?

Also, it would help whether we could get a trace of the Http calls through Fiddler (I believe it works for linux) or any other means you might be aware of.

Moreover, to make sure that your PlayFab setup is correct, do you also have a Windows integration somewhere you can easily use to test? Or, are you only interested and working with Linux?

@cprenoveau-illogika
Copy link

Yes, Initialize is called and completes without error.
We have a windows setup fully working with all the functionalities we need and we're trying to port the game to Linux and Mac.
My pessimistic guess is that some data structure or api has changed in between version 1.5.2 and 1.6.0 and so my best hope would be to get version 1.6.2 to load. It is significantly smaller than the previous version, so my guess is that external dependencies have changed which could account for it not loading. Unfortunately, Unity doesn't give me much information as to why it fails to load.
I'll see if I can find anything useful through Fiddler in the meantime.

@nassosterz-ms
Copy link
Collaborator

In terms of the PlayFabMultiplayer API, there is not any difference for the API calls you are using bw 1.5.x and 1.6.x versions. You can see here Release Notes that 1.6.0 only introduces one new search key.

For now, lets see if we can make it work with 1.5.2 Linux native binaries. Any chance as to getting more information about why you are getting these HTTP response codes would greatly help.

@RocketsReuben
Copy link

RocketsReuben commented Nov 20, 2023

Hi all,

I've been attempting to get Linux support working, using the instructions mentioned above (grabbing the linux binary and adding the additional define to the InteropConfiguration.cs script. We're running our PlayFab game servers inside of linux docker containers, and are trying to use the 'PFMultiplayerCreateAndClaimLobby' functionality for our game servers to host PF Lobbies that our clients can join.

Unfortunately, we're seeing the same dll not found exception. Specifically, we get an initial log that the plugin was unable to be preloaded, and then when we attempt to use it during our initialization, it's not found. So far, I've tried the 1.5.2, 1.6.2 and 1.6.3 versions of the plugin. If there's any information on when Linux will officially be supported, or more information on how we can get this up and running, that would be wonderful.

@nassosterz-ms
Copy link
Collaborator

Hello @RocketsReuben, I aim to provide an update to this thread in the coming 2-3 weeks. Appreciate your patience as we are looking into this!

@ReubenMH
Copy link

Hi all. We've managed to get things mostly working, but are still running into some issues. To elaborate -> We followed the above instructions for copying in the Linux .dll into our docker container. Our DockerFile uses Ubuntu 20:04 as the base version, and the PlayFabMultiplayerAPI works. However, the request that we're sending (PlayFabMultiplayer.PlayFabMultiplayerServer.CreateAndClaimServerLobby()) is failing to work. It never succeeds (never sending the callback or updating the cache for the returned Lobby object, so we can never use it.

@nassosterz-ms if you have any advice on what might be causing this issue, that would be great. Not sure if it's related to Linux support or is a separate issue, so I'll split it into its own thread if you think that would be helpful.

@nassosterz-ms
Copy link
Collaborator

nassosterz-ms commented Nov 29, 2023

@ReubenMH, I am not sure whether you want to point to a link when you mention the above instructions. Glad that it worked! If you have the link to the instructions handy it would help us a lot!

One thing that would help would be to get the Linux logs, following the instructions here: https://github.com/PlayFab/PlayFabMultiplayer/tree/main/TraceScripts#linux-instructions:~:text=target%20local%20directory%3E-,Linux%3A%20Instructions,-Download%20the%20PlayFabMultiplayerLogger

Also, are you calling the API with a PlayFab game_server entity? What is the error code of PlayFabMultiplayer.PlayFabMultiplayerServer.CreateAndClaimServerLobby() call?

Also, what version of the PlayFabMultiplayer library did you end up using for Linux?

Thank you for the patience and the cooperation!

@RocketsReuben
Copy link

RocketsReuben commented Nov 30, 2023

Hi @nassosterz-ms . Thanks for your quick response.

To clarify, when I say we tried the above instructions, I mean the ones you provided above in this thread of grabbing the Linux dll and changing the InteropConfiguration.cs. We're using the 1.5.2 dll.

I've followed the instructions to attempt to get the log file, but it unfortunately hasn't worked. As mentioned, we're running within a container, so perhaps that has made a difference? The PlayFabMultiplayerLogger.json is in place - are there any additional commands or arguments we need to pass in the Dockerfile or as part of the start command to use this PlayFabMultiplayerLogger.json config file?

Yes, we are calling the API with a game_server entity. There is no error code returning. The asynchronous operation never completes -> we never get a callback on PFLobbyCreateAndClaimServerLobbyCompletedStateChange, so it seems like the call is just not processing.

Hopefully this answers all your questions. If there is any additional information you can provide that would help explain this issue it would be great.

@RocketsReuben
Copy link

In case it's useful, this is the specific code we're using to attempt to create and claim the lobby as the game server.

The execution is stalling in that loop (e.g. the callback is never firing). I've also added a log in to the API in PlayFabMultiplayerSDK/Source/Scripts/API/PlayFabMultiplayer.cs on the ProcessServerLobbyStateChanges to confirm that it's not just my callback not firing. The ProcessServerLobbyStateChanges callback static function is never being called, so clearly something is going wrong at the library level (there is no success OR failure state change, just nothing ever happens).

private async UniTask<Lobby> CreateAndClaimServerLobby(PlayFabAuthenticationContext authContext, LobbyCreateConfiguration configuration)
	{
		Lobby lobby = null;
		bool lobbyCreated = false;
		int result = 0;
		void OnServerLobbyCreated(Lobby l, int r)
		{
			lobby = l;
			result = r;
			lobbyCreated = true;

			Debug.Log("Server lobby create and claim completed");
		}

		PlayFabMultiplayer.PlayFabMultiplayerServer.OnServerLobbyCreateAndClaimCompleted += OnServerLobbyCreated;
		Lobby lobbyObject = PlayFabMultiplayer.PlayFabMultiplayerServer.CreateAndClaimServerLobby(authContext, configuration);

		Debug.Log("Waiting for server lobby create and claim completion");
		while (!lobbyCreated)
		{
			Debug.Log($"Lobby create has not yet completed");
			Debug.Log($"Placeholder lobby object ID is '{lobbyObject.Id}'");
			await UniTask.Delay(TimeSpan.FromSeconds(2f));
		}
		PlayFabMultiplayer.PlayFabMultiplayerServer.OnServerLobbyCreateAndClaimCompleted -= OnServerLobbyCreated;

		if (result == LobbyError.Success)
		{
			return lobby;
		}
		else
		{
			Debug.LogError($"Failed to create and claim server lobby, with result code {result}");
			return null;
		}
	}

@nassosterz-ms
Copy link
Collaborator

Sorry for the late response, I was traveling to Europe the past 5 days and was fully offline.

Let me ask you something, are you saying that the method: PlayFabMultiplayerServer.ProcessServerLobbyStateChanges(stateChange); is never called?

Are you calling ProcessLobbyStateChanges()? See here

@RocketsReuben
Copy link

RocketsReuben commented Dec 5, 2023

Hi @nassosterz-ms - no worries! I hope you had a good trip :).

Thank you for letting me know about that - I wasn't calling it (might be good to have that mentioned in the docs a bit more, didn't know I was missing it).

I am still getting an error on my result. I am getting error 0x9023520C, or error code -1994169844, which just seems to be an unexpected and generic error. Is there any further information on how I can diagnose this error in more depth?

Thanks!

@nassosterz-ms
Copy link
Collaborator

You are right, I noticed that our Quickstart does not mention it. Logging an item to fix it.

Just as a sanity check, are you calling PlayFabMultiplayer.Initialize()?

With the information I have in hand it is quite difficult to assess why the PlayFab Service is returning an HTTP code different than 4xx or 5xx, that is the only information this error code gives me looking at the Multiplayer client SDK.

My hunch is that there might be an issue with how CreateAndClaimServerLobby is called. Are you setting the OwnerMigrationPolicy = LobbyOwnerMigrationPolicy.Server of the LobbyCreateConfiguration struct?

Moreover, since it looks like your call is making it to the PlayFab servers, if you shared your PlayFab title Id I could ask the related service team to look at their data and see if they can get more info about the reason your calls are failing (if you dont want to share this in public, email me at [email protected]).

Finally, any diagnostics from your side would further assist the investigation. I do not have much experience with setting up Fiddler for Linux on containers, but that could give us some more information. Also, the PlayFab logs would help, I understand you were unable to get them but if you could poke with it a bit more, they would add a lot of help to unblock you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants