question

martidore avatar image
martidore asked

Checking PlayFab features as BaaS for my project

I guess many of my questions have been asked/answered individually on the forum, but I would like to have a general idea about how can PlayFab solve all my backend/server requirements for our project.

I have used "custom" back-ends in the past and used Web-services for comunication, and I wonder how similar is PlayFab in that sense.

We will be using Unity + Photon (it's 100% multiplayer game).

I'm going to use Clash Royale as an example for the features we are looking for, since it's a well known game:

I will use the work OK on things I already know PlayFab supports perfectly.

1- User guest & Facebook/GameCenter login. (ok)

2- Virtual currency, both soft and hard currency. (ok)

3- DataBase: Does PlayFab provide a DataBase to store all the "items" the users get? In this case the items will be cards that represent the units, and chests where you get the cards from. To which stent can I access that DataBase, create my own tables and so on?

Each unit would have several fields for the stats (level, damage, speed etc.) and those stats would change whenever the player upgrades the unit.

4- Timed rewards like Chests, were oppening a chest takes X time depending on the type of chest. To avoid time-hacking this should be handled server-side as much as possible. Tycoon games use this feature a lot for construction times.

5- Cards/units are divided in Normal, Epic and Legendary, and they have different drop rates. All that should also be configured in the server-side. Every time a user opens a chest, the server will tell the client which items are inside that chest. Also different chests can drop different Units.

6- Daily or weekly events: Clash Royale sells different cards for soft currency every X time in the store. Could I configure that with PlayFab?

7- Player ELO ranking and matchmaking. If there are not available players in, lets say 20 seconds, the game will create a game against a bot (ideally player won't know it's a bot).

I would like to have different bots for different rankings (easy, medium and hard). The match will affect both players like in any other match. Bots will rise/decrease ELO ranking depending on their performance, but we should be able to modify their ELO manually.

Is there any way to have bots like if they were players? They would have name, items (units) etc. basically everything a normal player has and the matchmaking system will use one of them if no real player is found.

8- Friends and Custom Games. Since we are using Photon for the multiplayer, not sure if closed matches between friends would be handled by us manually with Photon (creating a room for them), or if PlayFab already provides this feature.

9- Scalability: If the game is being played by thousands of players simultaneously, does PlayFab has a good scalability system?

So I'm pretty sure everything I have mentioned above can be done in one way or another, but I would like to know if PlayFab can do it out of the box, or if there'd be need to code custom server logic. If custom server logic is needed, does PlayFab also provide a server? Should we get our own from Amazon? And in which programming lang. is the custom server logic programmed?

data
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 answered

You mentioned that you're using Photon, and that your game is multiplayer, so I'm guessing you mean Photon Realtime, or possibly Photon Enterprise (to be able to use plugins that have custom game logic). However, your final question on servers and custom logic makes it sound like it may be the former.

For the questions where you're looking for more info:

3 DataBase: Based on your description, what you'll actually want to use is our catalog/inventory service. In it, you create a catalog of goods, each of which can have custom data that can be used as the title-wide configuration info for things like item power, etc. The instances of items granted to (or purchased by) players can also have distinct custom data, so that their instances can be unique.

https://api.playfab.com/docs/tutorials/landing-commerce/catalogs

https://api.playfab.com/docs/tutorials/landing-players/inventory

We do not provide direct table creation/query, as that's one of the most common ways online titles encounter issues - a single bad query can effectively cripple the game. We provide a set of functionality that is common to games, allowing titles to use those features without having to worry about the database specifics.

4. Timed rewards: Depending on the specifics, you would do this one of two ways: a) Use a regenerating currency to gate this. We have a specific example in our Cloud Script samples here: https://github.com/PlayFab/PlayFab-Samples/tree/master/Recipes/PrizeWheel. b) Use player (read only or internal) data to set a timestamp when a player starts doing something, so that you can check that in Cloud Script later (for games that start timers when the player starts an activity, like city builders).

5. Random loot drops: Yes, we have a random result table system you would use for this: https://api.playfab.com/docs/tutorials/landing-commerce/droptable.

6. Events: Right now, most titles using events are driving them through Title Data (to provide the start/stop times, and any additional info) and Scheduled Tasks (to update the Title Data for upcoming events, or make changes if you want to keep that data secret until the start of the event). We plan to add a built-in event system in a future update.

7. ELO, matchmaking, and bots: Since you're using Photon for multiplayer, you'll need to use their matchmaker: https://doc.photonengine.com/en/realtime/current/reference/matchmaking-and-lobby. If you switch to custom game servers, that would be the point where you would move to using our matchmaker (which does provide for matching based on a statistic you define).

This is the part where it's not clear what you're using - Photon Realtime or Enterprise. Having bots in your multiplayer games requires that you have server-side logic (unless you're letting the client be authoritative about the bots, which would then compromise your game's security, so I'm guessing you're not). If you're using Photon Enterprise, you can upload your logic to their servers, no problem. Otherwise, yes, you would need to use custom game servers (whether hosted by us or not, we can still manage matchmaking for you).

https://api.playfab.com/docs/tutorials/landing-tournaments/custom-game-servers

https://api.playfab.com/docs/tutorials/external-game-servers

Any bot logic is entirely up to your custom code, as it will be very game specific. For representing them as "players", I'd recommend setting up some Title Data definitions for your various bots.

8. Friend matches: Correct - if you're using Photon for your multiplayer, that's entirely managed in Photon. If you switch to custom game servers, we can show you how to manage closed matches with friends using game server instance state and custom data.

9. Scalability: Yes, we currently host hundreds of live titles and over 60 million MAU. Our service can scale to support any number of users.

Custom servers in general: You can write a custom server in any language you like. If you're hosting it in our service, it does need to be able to run on a Windows Server 2K12 R2 instance. Pricing for server hosting is as stated in the Game Manager - the actual EC2 cost plus 10% to cover our costs. If you want to have a look at the code for a basic server that manages all the player connections (redeeming matchmaker tickets, etc.), we provide a basic Unity server project here: https://github.com/PlayFab/PlayFabGameServer. I'd also highly recommend reviewing the two tutorials above, on hosted game servers (hosting in PlayFab and externally).

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

Engin Yılmaz avatar image Engin Yılmaz commented ·

Hello Brendan, Can you explain the details of 4B? Or Are there any tutorials for this?

0 Likes 0 ·
brendan avatar image brendan Engin Yılmaz commented ·

There's no specific tutorial, but it's quite straightforward: Using the "builder" style of game as the example, you would write the timestamp (in UTC, for simplicity) to Player Internal Data when the player starts their build, via Cloud Script. At any time after that, you can check how much time has elapsed by comparing that to the current time. And when the client thinks the build is done, you can check it in that data store (which the client can't access) using Cloud Script, and either confirm that the build is complete or return an error with the correct time the client should be using as the start time (so that they can't just hack that).

And if you sell shortcuts that reduce the time, you could just write that to the data, as well.

0 Likes 0 ·
Engin Yılmaz avatar image Engin Yılmaz brendan commented ·

How can i check how much time elapsed without a user input? Dont i need a user input to trigger a cloud script? So if the time passed i cant catch it without user input.

With this method you tell, client app force user to not to change his or her system time, if he or she wants to play the game honestly, right? So i mean if he or she wants to play the game normally, they shouldnt change their system time for cheating.

0 Likes 0 ·
Show more comments
martidore avatar image
martidore answered

Hello Brendan, let me first thank you for your time both reading and aswering my question. I was not expecting to get an answer on the same day, which speaks really well about your product & service.

I'm using Photon Unity Network Plus (100$ asset in https://www.assetstore.unity3d.com/en/#!/content/12080 ) which uses Photon Cloud and gives 100 CCU Photon Realtime for free.

My multiplayer is quite simple, 1 vs 1 in a Clash Royale style game. The way I sync the game is pretty simple too. I'm not using pure real-time sync (I'm not syncing units position/rotation in every Update). I only sync important events, in this case, the spawn of a new unit. The other client gets the event, and spawns that unit too. The behaviour of that unit is suposed to be the "same" in both clients.

It's a bit risky and the longer the match takes, the more inconsistencies clients can have, but since I don't have physics in my game (which are not deterministic in Unity), this is a pretty "safe", cheap and easy way to implement my multiplayer.

3- About your catalog/inventory system:

I could have the ItemID Battle_Tank_M (M for Master) with the stats; Level, Current_Progress, Max_Progress Health and Power.

Every time a user gets an item Battle_Tank_C (C for Card), it's Battle_Tank_M progress would increase by 1. When Current_Progress reaches Max_Progress ( 50/50), the Level of Battle_Tank_M increases by one, it's stats also change and the progress resets to 0 again. Repeat this process until Battle_Tank_M reaches it's Max level.

Basically you have a "Master" object/unit that you unlock once and you have it forever. Then you get X numbers of Cards that represent that Master unit progress.

Reading your answer "catalog of goods, each of which can have custom data" I'm almost sure you system supports it, but I wanted to give a real example because this is a critical part for my development.

4- Time Stamp sounds good. Once the player taps on "Open Chest", the timer starts to count, like a tycoon builder. Can I have some kind of scheduled task that starts when the player starts the timer in order to notify him with a push notificaion "Hey, your chest is ready to open!".

7- For this project, and although it's not secure at all as you well said, we won't use an authoritative server. One player will create the Photon Room (the master) and the other client will join the game.

That means that the bot will run totally in client-side when a "fake multiplayer" game starts because no real player was found. Depending on its ELO, the player will face one bot or another. In fact, the bots are the same (there is only one AI), the only thing that changes are the Units the bots play with.

That's why I wanted to have "fake users". Users created manually with their name, units etc. so when a fake multiplayer game starts I can request to the server "Hey, give me a user-bot whose ELO is between 500-700", the server will give me that user Data, and I will init the Rival-client whith that data, and make de AI to controll the Rival-client. As I said the AI will be common, but the units will be better or worse.

The result of the match should ideally affect the ELO of the bot, like a real player.

That's why I need to be able to create by hand my own bot-users. Is it possile with PlayFab to create/edit users? and of course request their data when I want to.

8- Ok, so even if I have to handle the private matches between friends manually with Photon, does PlayFab supports a "friendlist system"? If it is the case, implementing it would be pretty easy if I have access to friends. It's just create a room with a unique_ID sared between those friends.

And my last question:

Users can have many different Units (a total of 35 if you unlock them all) but you can only bring 5 to the battle. That means you have to create your "battle deck".

For me that would be a Table in the DB named "PlayerDecks" where you store the 5 units ID's you want to battle with for each user. Since I don't have acces to a DB, how should I approach this if I was to use PlayFab? Store/Modify the 5 units each player has in his battledeck.

Again, thanks a lot for your support and quick response. I really like what I have seen about PlayFab so far and your great support definitely makes the difference among other options.

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 ·

Got it. For Photon, there aren't any issues with using your own account - it's just separate from our offering. That said, I can get you the info on setting up your account to use the webhook integration, if needed.

3: Yes, our catalog/inventory system can support that, no problem. You can use Cloud Script as part of that logic, since you don't need a level of security that would push you towards using a custom game server.

4: Scheduled tasks aren't per-player, but you could have one that runs periodically, looking for players with items that are ready to be opened, potentially. For Android devices, you could just send it as a scheduled Push when they first start the timer.

7: You could create faux user accounts, but I'd rather help you avoid that, since making calls on their behalf to update data would likely mean adding them to your MAU total. Instead, why not use real player data as the "seed" for your fake players? Maybe with a random naming table?

8: Yes, we have a friend system, which is also integrated with Steam and Facebook friends.

Decks: We have a number of card games that do similar things - they use UserReadOnlyData, with Cloud Script used to set up the decks securely.

0 Likes 0 ·
martidore avatar image martidore brendan commented ·

Thanks again Brendan!

Your idea of seeding the bots with real player data in that same ELO range changing only the name is also a good one although bots won't increase/decrease ELO like a normal player. Anyway it should work, at the end is all about not having players waiting for more than 10 seconds and also not giving them the feeling that the game is empty (although it might be at the begining haha).

So, I have decided to stick with PlayFab, and I'll let you know that one of the main reasons is your great support!

Hopefully I won't often get stuck trying to implement all my back-end with your BaaS, but if I ever do I will came back begging for some help.

See you arround!

P.S: Is there a live chat (like mIRC) or similar where PlayFab users get together to discuss best practives and help each other for small doubts instead of opening a ticket/thread? If not, it would be a great idea for your comunity manager to create/promote one

0 Likes 0 ·
brendan avatar image brendan martidore commented ·

Yes, making sure the player experience doesn't suffer during periods of low concurrent users - whether it's at game launch or even just due to the player not being in the same region as the majority of your players (and so, not being on the same schedule) - is a common issue for online games. Being able to have an AI opponent experience is definitely one of the best ways to prevent the "empty game" experience that can cause.

And yes, we do have a community Slack - I'll send you an invite. We don't do support there directly, since there's no tracking or history, but it's a very active space where users of the service help each other out quite a bit.

0 Likes 0 ·
moaz0005 avatar image
moaz0005 answered

@Brendan Hey, Can I join the playfab community slack as well. As It is my first game with playfab as backend. So, It would really be a great help.

5 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 ·

You can join our Slack channel at any time via the Help page in the PlayFab Game Manager. Let us know if that route doesn't work for you, for some reason.

1 Like 1 ·
moaz0005 avatar image moaz0005 brendan commented ·

No, I didn't receive the link on my email adress.

0 Likes 0 ·
moaz0005 avatar image moaz0005 commented ·

@Brendan hey

0 Likes 0 ·
brendan avatar image brendan moaz0005 commented ·

Sorry, for some reason I didn't get an email notification from your last post. I just tried to send you an invite via Slack manually, and Slack says that email address is already in playfabcommunity.slack.com. Can you try just loading the Slack page?

0 Likes 0 ·
moaz0005 avatar image moaz0005 brendan commented ·

Thanks, It worked.

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.