question

duartedd avatar image
duartedd asked

playfab and photon client / server side

Hello I was wondering if you guys knew how you would do the following:

I have 2 separate unity projects - a client side unity project and a server side unity project

i need to make client calls to the server side unity project for match making and passing over event notifications which would pass those notifications to the client side - i already have game states and such already configured on the client side and notifications will affect game states and other things in the game.

Do I install and configure PUN2 / playfab on both the client and the server unity projects? do i just use the same API keys if so? for the server side, i am planning to start on a match maker to grab some user leaderboard stuff and then create a room of sorts between the 2 clients where the server is a mediator between- is there some documentation on scripting and compiling the server to continously run and listen on a specified port? Or am I going about this all wrong and need to look at some documentation that would help me understand ?

finally, is it commonly used to have the server side and the client side programs in 1 project or separate?

thank you!

10 |1200

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

JayZuo avatar image
JayZuo answered

I'm not sure if you have used Photon in your game. If you have used PUN2 in client, then PlayFab's matchmaker is not relevant here. You will use the matchmaking system provided by Photon. Besides also, it’s not clear what you mean about your server code. Are you using Photon Enterprise Cloud? Could you please share more details about what you’re trying to do?

If you are not using Photon, then here is a basic Unity server project using Unity Networking: https://github.com/PlayFab/PlayFabGameServer. You can use as a starting point to creating your own. And for matchmaking, you can use the default PlayFab matchmaker, which gives you the ability to match players based upon Region, Game Mode, and a Statistic. For more information, please see this answer: https://community.playfab.com/answers/8106/view.html.

10 |1200

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

duartedd avatar image
duartedd answered

Hi JayZuo - thanks for the reply - I have not used anything in my game yet. dont even have the plugins installed (except for playfab in my client project) I am looking to go the playfab/photon integration route but unsure what the options actually called..i thought pun2 was another name for photon and i would just install it on the server project and use api calls to match make and pass notifications between clients but it sounds like i am wrong here?

I was looking to go the route of a personal photon server then transfer it to their cloud system and thought how it works is i configure it via unity - tell it how i want to authenticate the clients request and pass it through with photon plugin. At a later time i thought i could just simply upload the exe that i compiled to the photon cloud and kind of convert it into that system automatically.

so lets say If i cant just easily just transfer my standalone photon server (or w.e) to the photon enterprise cloud then I would rather go just the cloud route since it comes with 20 free CCU licenses. But how will i be able to customer the server side logic that is needed to say ' in playfab i need to access the leaderboards to find the client's best match, and things like that.

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.

brendan avatar image brendan commented ·

I'd recommend talking through the options for how to use the various offerings Exit Games (the maker of Photon, in all its forms) with that team directly. @Hamza Lazaar may be able to provide some guidance on this, as well.

If you wind up going the route of custom game servers which run your own code, I'd recommend having a look at our upcoming server hosting V2 (https://api.playfab.com/docs/tutorials/landing-tournaments/thunderhead).

0 Likes 0 ·
Hamza Lazaar avatar image Hamza Lazaar commented ·

Hi @duartedd,

Thank you for choosing Photon!

PUN (1/Classic) or PUN2 is one product from the family of Photon products provided by Exit Games.
PUN is meant for a client-side pseudo authoritative room based logic.
It looks like your need for server-side code is basically for an external custom matchmaker based on PlayFab's stats, leaderboards, etc.
You do not need two projects.
You do not need a Unity server instance. The headless server use case is not a PUN thing, maybe Bolt.
What you need is a web server that does the custom matchmaking for you (if PlayFab does not support that out of the box).
Then clients can communicate with that custom matchmaker via HTTP, optionally via Photon WebRPCs or a Photon plugin.
For custom Photon plugins you need self-hosting or Enterprise Cloud.

0 Likes 0 ·
duartedd avatar image duartedd Hamza Lazaar commented ·

thanks Brendan and Hamza - that clears things up. thank you!

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.