question

jeffry@itworksonmymachine.net avatar image
jeffry@itworksonmymachine.net asked

JavaScript example game

I was wondering, do you have a simple JavaScript example game that explains the basics of integrating with PlayFab?

I think I understand the principles of the PlayFab SDK. I am more looking into examples of how to connect with the server, wait for matchmaking and turns.

Should I be using something like web sockets or polling?

Practical example:

I have a turn based game and I've invited someone to a game. It could take a while before the invitation is accepted. How do I know that an invitation has been accepted? I can poll the server at an interval and see if there is a match.

Any best practices there?

Thanks!

Jeffry

10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

We don't have a complete JavaScript game that shows this, though we do have a couple for Unity (it's the platform the majority of our customers are using, hence the reason it's over-represented in our samples). When it comes to multiplayer games, it depends upon your needs. At the highest level, you would want to use custom game servers, which we can host. For games with lower requirements, Photon Cloud would be a good option (check out Add-ons Marketplace). We've actually had an extensive discussion on how to do this in the forums, here: https://community.playfab.com/hc/en-us/community/posts/207129407-Persistent-turn-based-games-.

10 |1200

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

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.