question

Thamas avatar image
Thamas asked

Is PlayFab the right choice?

Looking into building an app for my business but unsure if this backend will work for my needs.

-I need to be able to use this backend for 42 tablets.

-There are 16 parks each with 9 logins.

-1 for an assistant manager account and 8 crew accounts.

-2-3 tablets per 8 hour shift are used.

-Online Data Sending 1 time per day per shift.

-Data across all 9 account X16 Park need to update daily, be the same data and the right parks data.

-Before logging in, Park in Question is selected and a Register Number. This Reg# can only be used 1 tablet at a time and would need to be a server wide stored value. Then removed from the list of available.

-Depending on which park is selected, only the 9 accounts designated can login else it should fail.

-If the Assistant Manager Account is logged in, more features are available then a crew's login.

-If offline i try to connect every 5 seconds via locally stored variables

-There are 3 Modes in my App. OnlineMode, OnlineLocalMode, and OfflineMode. Online would check constantly what the data is on the server and set the local data to that. OnlineLocalMode and OfflineMode constantly stores the data locally to a get set.

-A switch Mode Button is Active in Online and Online Local but disabled in Offline. when in each mode the call switches to the other making Online and OnlineLocal Switch upon button click. I have it set my local data on initial login success.

-In the Update if OnlineMode it is constantly checking the current Data in the case of a change else where. In OnlineLocalMode a Sync Button is active which then updates the server with it's local data. in offline and OnlineLocal Modes it is constantly setting the local data.

To check if Online i use:

IsOnline = PlayFab.PlayFabClientAPI.IsClientLoggedIn();

If this ever becomes false (a connection loss) the system will then go into OfflineMode. In OfflineMode it's constantly looking for the re connection flag and Switch button is disabled.. if this happens were back in OnlineLocalMode.

Note: I am currently converting my data storage class to a Json string and saving this as a key/value pair. not sure this is the correct method but seems to be the shortest amount of code.

Content
10 |1200

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

Seth Du avatar image
Seth Du answered

PlayFab is a backend service designed for game and is based on RESTful API. It is stateless, It is not supported to check a player online state natively without a workaround. You may check the definition of IsClientLoggedIn() function, it is actually not a RESTful API. Unity SDK is encapsulated with this function to help client side quickly check the existence of session ticket.

Moreover, PlayFab doesn’t support modifying the login permission from a “administrative account”. All the login identities are managed by players themselves. What manager can do is to ban a player via BanUsers API.

Please feel free to tell us if you have further questions. My suggestions may not cover all your query.

10 |1200

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

Thamas avatar image
Thamas answered

Hello @SethDu Thank's for the reply. I've created my own state engine for controlling my code, windows and such, cuz i realized i couldn't do this with PlayFab.

IsClientLoggedIn() is only used on initial login success and then not used until a re-login is at end of shift. Code works in an offline mode and tries to reconnect until it succeeds. This controls my state engine. This all works fine.

Also, when i login I check to see what the credentials are before using PlayFabAuthService.cs. Authenticate(); function. if what has been entered isn't within the admin or non admin private string lists, login fails. if the entered email is in 1 or the other list a flag isAdmin is set all before logging in. I'm more interested in sharing data across multiple accounts really. Would i store my data in ServerAPI not ClientAPI and then retrieve again via ClientAPI?

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.

Seth Du avatar image Seth Du ♦ commented ·

It depends on what kind of data you want to store. There are many resources on PlayFab for data storage. For example.

  • Title Data. Client API can only read it. Only Server/Admin API has the permission to update. It is shared globally.
  • Player Data. There are 3 types of Player Data, which are Player Data, Player Read-Only Data, Player Internal Data. Client API will have the permission of read/write on Player Data. The other 2 will need Server/Admin API. All of them have a permission to set it public/private. Basically other players can get those public data as long as they keep a PlayFab ID
  • Objects. It belongs to the new Entity Data Model, the use scenario is similar to Player Data but controlled by the Entity Policy. The Read/Write permission can be modified.

It is not recommended containing any hard-coded secret key in the client, if you don't want players to modify those data, you may use Cloud Script/Azure function to call server API for updates. Meanwhile, in some scenario, Player Data(which can be modified by client API) should work fine, for example, the slogan in a player's profile can be modified at any time on their own.

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.