question

drallcom3 avatar image
drallcom3 asked

Custom game server example: Connection doesn't work

I'm trying to use https://github.com/PlayFab/PlayFabGameServer to run a local game server.

According to the tutorial:

  1. Create a new title (37EC)
  2. Start GameServerSource project in Unity
  3. Fill in title ID in PlayFabServerManager
  4. Run

Of course this doesn't work. PlayfabSharedSettings demands to be set up.

  1. Enter title ID, secret, API url (without last /) and disable compressing
  2. Title ID, secret and build version (gameserver) in PlayFabServerManager
  3. Allow external server in the game manager. I'm pretty sure it has to be set, although not setting it didn't make a difference.

Slightly better result. Now I get the following after around 30s and then a timeout:

SocketException:
 A connection attempt failed because the connected party did not 
properly respond after a period of time, or established connection 
failed because connected host has failed to respond.

I also played around with pretty much every setting there is, with the same result. There also isn't any log anywhere. Making a Windows build and running the exe has the same result.


Am I missing something? The experience so far is quite frustrating.

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

pfnathan avatar image pfnathan ♦ commented ·

@drallcom3 here is the updated response from our Engineer, Marco. I have removed original response.

0 Likes 0 ·

1 Answer

·
marcowilliamspf avatar image
marcowilliamspf answered

Hi drallcom3, I'll have to look into if the tutorial is out of date or not. I would suspect that you need to add your secret key to the PlayFabServerManager as well when running locally.

From your post it sounds like your are mixing a couple of concepts together. When you download the repo and add your title & secret and press run, you are now running the custom game server locally. This means that it is listening on port 7777 for connections. You can use the client that is also in the repo to test the connection while the game server is running.

The checkbox about external game servers is supposed to be unchecked, that is if you are hosting your own servers on your own hardware or cloud and are scaling them yourself. If you plan to use PlayFab and upload your game server executable to us via the Multiplayer tab, then this checkbox should remain unchecked.

These are the only two fields you should have to complete. As a matter of fact, Title Secret is really only needed to run locally.

All of the other fields are populated by the server host when an instance is instantiated.
https://api.playfab.com/docs/tutorials/landing-tournaments/custom-game-servers

The documents Nathan provided do have some relevance here, as it explains how our hosting works.

Basically it is like this.. You can use the out-of-box example from the repository, or roll your own game server. either way, the link above describes what happens when you upload your game server files to PlayFab. In short, you make a build, zip it up and upload it on the builds tab of the Multiplayer section in Game Manager. Once uploaded, an EC2 instance is spun up in the region you've selected. When you use our match making API it will request a server, that instantiates a new instance (when needed) of your game server, and it passes in everything as command line args.

In the out of box solution, we just did a lot of the work for you so that you can focus on making the game server functionality.

Now, when running locally, you will probably need the TitleId & Secret Key for your title. Then you can connect to it via the Example Game Client

Let us know if you still have trouble, you should not experience the errors. Leave all other fields default.


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.

drallcom3 avatar image drallcom3 commented ·

Thank you for your lengthy response.

I'm pretty sure I got all the concepts right. In this case, following your instructions:

  1. download the repo and open scene
  2. add your title & secret
  3. press run

results in a spam of:

PlayFabException: You must set PlayFabSettings.TitleId before making API Calls

Title & secret is set and saved in the server manager, same as your pic.

The good news (and totally unrelated to above):

While waiting for a fix I started coding my own server with your SDK. It's pretty easy and you have great tools. It's an external one running on my machine.

It works. It shows up in the gamemanager, clients can connect via matchmaker and I can send messages around. I'm actually glad now yours didn't work, since I know nothing about StrangeIoC.

-1 Like -1 ·

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.