rainerlonau avatar image
rainerlonau asked

Soccer Manager - Handling of soccer players / data


I'm setting up my economy and data handling. I stumbled upon "the 10 character limit" here and got some good feedback from @Andy. That also raised more questions...

(brief game concept):

  • 1 on 1 soccer management game (Using Unity, Playfab and Photon)
  • Each user has up to 25 soccer player (items) in his team
  • A game is about 1 1/2 to 2 minutes long
  • Best 11 soccer player feature (see items from other players)
  • Trading and/or auction of soccer players


  1. I would go with the "each soccer-player is an item" approach. Andy mentioned that the soccer player data could be in user data. But depending on the different properties/skills/values a soccer player my have in the game, I think it makes more sense to manage that data in the item concept.
  2. On login the user loads his data. After a match (about 2 minutes) the data of soccer players will be updated. I think that time window is fine with PlayFab. However, I intend to "update" (give some skill points) to the player depending on the result of the match (win/lose). After the game, the player calls a CloudScript where the soccer player get some "points".
  3. Andy mentioned the problem of getting lots of item (data), causing lots of data (requests) from PlayFab. How would I implement something like the currently "best team", meaning the top rated 11 soccer players? I was thinking about some title data entry where the IDs of the items (soccer players) are saved. Whenever my soccer player (item) gets some skill points (e.g. won match), he would check if he's better than the "best team" soccer player. If he's better, his ID would replace the one in the best 11. It seems it's not possible to get Items by IDs directly? I would need to also save the users PlayFabID with the item ID and get the data via in the CloudScript. Any other way?
  4. Is it possible with PlayFab to have some kind of marketplace for the soccer players? So a user can choose to put some of his soccer players (items) up for sale. In the marketplace the items for sale are listed and possible searchable for skills/properties etc. How would you implement it? How to have items and their custom data from lots of different players in a list? How to settle a purchase/transfer of an item if only one player is "online"? [Update: Found this feature request. Seems to be not possible at the moment]
  5. Trading one on one seems to work fine: Maybe this can help for my question #4?
  6. Can you think about other topics/pitfalls and solutions for a game like this?


Player DataIn-Game EconomydataTradingCharacter 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.

1 Answer

brendan avatar image
brendan answered

Given your requirements, it sounds like you should indeed use the Economy system for the players in the team (so, each player is an inventory item in the player's account).

For your specific questions:

1. If the data is compact, storing it on the item would make more sense, yes.

2. If you intend to update the data on many team members at a time (UpdateUserInventoryItemCustomData), then you will need to use User Data instead, as updating all the item instance custom data would require too many API calls.

3. No, Title Data cannot be updated as a result of a player action - it is only intended to be updated periodically, and only by an action made by the developer/publisher. Trying to update it via player actions would result in too many calls, and you'd be losing data constantly. Title Data is a sharded and cached resource - that's what allows us to have millions of players reading it at once. So there's always going to be a delay from when it is updated to when that update is available on all shards. It sounds like what you're describing is a leaderboard. Why not just use statistics to store the best team member for each player (for clarity, I'm using "player" to mean the real-world person playing your game, and "team member" for the soccer team members which are inventory items on the player account).

4. Currently, no. We do plan to provide a marketplace that would allow for that in a future update, but we don't have a date for that just yet.

5. Trading of non-stacked inventory items does work fine player-to-player, and it can be used for gifting, as well. There is no "discovery" mechanism however, so no, as-is that system cannot be used for a "marketplace", unless you're storing all the information about available trades in an external data table.

6. There's an almost unending list of potential pitfalls for any non-trivial game. Based on what you've described, one key challenge is going to be making sure that you keep your call rate down to a reasonable level. But also, how are you planning on managing the multiplayer sessions? Hosted game servers? Photon? Something else? How are you planning on managing security for the game sessions?

10 |1200

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

rainerlonau avatar image rainerlonau commented ·

Hi @Brendan,

first of all thanks for the detailed reply!

Answers 1 and 2 are good to know and I'll do it that way. Also the clarification about Title Data (3). I guess 3, 4 and 5 are possible with external database as you mentioned. These features are more advanced and I need to get the basic game working first. But I wanted to ask about implementation anyway to give you a better understanding about my concept and answers for me and others planning to do similar logics.

I've read about keeping API calls to a minimum (6). Btw. it's not possible to UpdateUserInventoryItemCustomData for multiple items with one call?

For 6: I'm going for Photon cloud for the moment (I saw you're working on making server(s) easier/better), but as mentioned above I'm working on the core gameplay right now. I saw lots of posts about security (like flagging cheaters, having an internal "cheat-score") and security checks (in CloudScript) in different posts. I'll collect them and see what I can implement. Not sure if you've got an official recipe for best practice. This could be nice, otherwise everyone has to search for the good advice in the threads about multiplayer/photon.

Thanks again!

0 Likes 0 ·
brendan avatar image brendan rainerlonau commented ·

Correct - at the moment, you'd need external data tables to support those three. The main idea to bear in mind is that a data system that requires read/write of arbitrary across all players really needs to be purpose-built for it to be affordable, so we'll be providing features that accomplish some of the things you describe (like a trading marketplace) in future updates, as we're specifically designing for those features.

But no, UpdateUserInventoryItemCustomData takes a single Item Instance ID and the data you want to post to it, so it's only for use with one item.

As to 6, my concern is that your game design sounds like it's a real-time action (sports) game. In that case, if you're not using a custom game server, you are inevitably trusting the client for the majority of the gameplay logic (occasional checks in Cloud Script will work, but you couldn't manage the real-time game session logic there). So if cheat prevention is a concern, I'd recommend using custom game servers.

1 Like 1 ·
rainerlonau avatar image rainerlonau brendan commented ·

Hi again on this Sunday ;-)

Well the game concept isn't about real-time action like FIFA or PES. It's a management simulation where the users choose the line-up of the teams and can change some tactics and make substitutions during the game. Of course there'll real-time logics in the background calculating the outcome of the game. A 90 minute soccer game will be simulated in 90-120 seconds. So maybe every "ingame" minute (90 times a game) a logic defines if team a or team b has a chance and if they score a goal.

The idea is to sync the player stats (via Photon) and then the non-masterclient can also calculate the outcome of a ingame event. So this non-masterclient get double-check the game event outcome which is send by the masterclient. I've to do some more testing if this is a valid way.

Still setting up getting PlayFab data into Unity and loading/saving tactics and line-up of the team.

Btw. I'm still heavily looking into UnicornBattle to understand all the PlayFab features. This sample game is a little bit older but it's the latest (huge) example, right? Or do you have a newer game to learn from?

0 Likes 0 ·
Show more comments

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.