https://metaplay.io logo
Unity Multiplayer Support
# questions-and-feedback
u
When testing interactions between online players it is necessary to run multiple clients locally at once. Is there an easy way to do this, as the way Im achieving it now is quite cumbersome.. Basically I clear the credentials, build and run a new Unity client. Then I clear the credentials again and start a second unity client. If I want to restart the 1st client, it will pick up the latest credentials, used by the 2nd client, and kick him out. I wonder if there is a better way to do this process that also will allow restarting clients and keeping the credentials? Thanks!
h
Would the BotClient help in this case? It's a server-side actor which can spin up a lot of players and run actions.
u
Yeah, the BotClient could certainly be helpful, especially for metafeatures or simple player interactions. However when testing the core gameplay (which is realtime multiplayer) and matchmaking, it is nice to see visually how different scenarios integrate with the ui etc. Then it would be good to be able to run a couple of "real" clients easily. The core gameplay is currently done with photon so I guess we could mock all the metafeatures which is using metaplay when testing the gameplay, but it would be nicer not having to do that. Also at some point it would be great to use metaplay for the matchmaking as well.
h
You can look into
MetaplaySDK/Client/Unity/CredentialsStore.cs
to see how the credentials are stored. In Unity Editor, when you reset the credentials from the menu items, it will delete all files in the application's persistent data path (path provided internally by Unity), and delete all keys under Unity's PlayerPrefs We don't have a ready solution for circulating different offline credentials, if you end up writing some editor code for it, let me know! Another way I've found it useful to test multiplayer is make client builds (WebGL works quite nicely given your third party frameworks like Photon support it), and run then alongside with Unity Editor.
u
Alright, yeah currently I make a client build which I run along side the Unity Editor. The only problem is that I can not re-use the credentials between sessions, as the client build and Unity Editor reads them from the same place. Maybe as you say, with WebGL as the credentials are stored in the browser, I can re-use them even after clearing the credentials from the Metaplay menu in Unity. I will try 👍
Just to let you know I got it working with Unity Multiplayer Play Mode (MPPM) in the following way: - Appending the Player tag from Unity multiplayer to the credentials filename in metaplay:
MetaplayCredentials.dat
->
{PlayerTag-}MetaplayCredentials.dat
- Disabling the legacy prefs from the
MetaplaySDK/Client/Unity/CredentialsStore.cs
It is a bit hacky but works for now.
3 Views