question

Patrik Bertilsson avatar image
Patrik Bertilsson asked

Question regarding turnbased game and shared groups!

Hey Thank you!

I have a question regarding shared groups in a turn based game.

A user has a list of games stored on PlayerData (SharedGroupData names) and then the SharedGroupData contains the info/state for the game.

Problem is when the game starts it makes so many calls to playfab.

1. Login call

2. GetTitleData

3. GetPlayerProfile

4. GetUserData

This is where the problem starts:

5. GetSharedGroupData (depending on how many games this will be called 1 for every game)

So if I have 10 active games there will be 10 calls to get the data for each game and know which one is active.

On mobile these calls really makes the experience not that good.

Note* I cant do these calls simultaneous because of some problems with WWW and unity so they are done after each other to avoid issues.

My question:

Right now this is done on the client, will it work better to do a cloud script and have the cloud script get the data for all games then send it back as 1 call? Or is there another way to handle this better?

Cheers,

Patrik

Shared Group 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.

Xiao Zha avatar image
Xiao Zha answered

May I know why you have multiple games at the same time, generally only one game at a time. And I would also like to know what exactly you mean by “On mobile these calls really makes the experience not that good.

In addition, the performance of calling an API in CloudScript is not much different from calling an API on the client side. But your approach does work if you want to reduce the number of client API calls.

10 |1200

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

Patrik Bertilsson avatar image
Patrik Bertilsson answered

Hey,

May I know why you have multiple games at the same time, generally only one game at a time

It's a turn based board game like wordfeud, so you have multiple games against multiple players. So when you have taken your turn you should wait for the other player to take their turn and can then take a turn against other players

https://apps.apple.com/us/app/wordfeud/id428312806

On mobile these calls really makes the experience not that good.

I have noticed different callback times on different devices, I would like to say it's older devices but it's newer also. I have never experienced it on my phone but on other phones (booth with WIFI and 4G) where the callback takes longer then expected. Cant say why and the time logs says the execution time is short (0.1 sek) but the call on some devices can take up to 0.5-1 sek for 1 call.

That's why when calling GetSharedGroupData and there is 5 games it can load for ~5 sek

Never seen this problem before and I believe it's with specific models/internet/GSM/WIFI. Will try and look into it more but I need to fix this first.

In addition, the performance of calling an API in CloudScript is not much different from calling an API on the client side

Thanks for the info, I believe it will as on some devices(not all) the call take long and in this way it will be enhanced.

Cheers,

Patrik

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.