question

11708045665895369350 avatar image
11708045665895369350 asked

How do I store Solitaire Game Random Seed ?

Hi,

I have a Solitaire Game, and I want to collect seeds (10 characters of a string ) from players. These seeds could create  solvable games for other players. Now I need a place to store these seeds. I have seen the https://playfab.com/limits/ . The Title/Publisher Data does not have enough space to store many seeds.

Now I have a new plan to deal with the vast stores of seeds,

First, I create a player named "seedManager", which store:

       1. SeedWarehouseIds - store a list of playfabIds. I plane to create 100 players and store their ID at here.

     2. CurrentIndex - a int number. It marks the current which a warehouse to store seeds. When a warehouse is full, the CurrentIndex += 1.

Second, I create 100 players named "SeedWarehouse1","SeedWarehouse2" ... "SeedWarehouse100". And store theirs IDs in SeedWarehouseIds of "seedManager".  These player are used to store seeds. I call them "SeedWarehouse". In it, I will store:

      1.Every "SeedWarehouse" would have 1000 houses( "house1" to "house1000") and every house could store 1000 seeds. So one SeedWarehouse could store 1,000,000 seeds. If I have 100 SeedWarehouses, I could store 1 billion seeds. it is enough for me.

      2.CurrentIndex- a int number. It marks the current which a house to store seeds. When a house is full, the CurrentIndex += 1.

 

When a player finishes a game, the client would post the seed to playfab by execute cloud script function "saveSeed". This function would get "seedManager"`s data and find out the current  warehouse. Open the warehouse, and store the seed in the current house.

 

Do you have a better suggestion?

Finally, when are you going to support mongoDB?

 

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

Technically, we support MongoDB (via mLabs), DynamoDB, Azure Table Storage, and any other database which has a Web API, as you can call any external web service via Cloud Script using the http API. The MongoDB integration we're working on will allow you to have a greatly simplified way of using MongoDB data tables from Cloud Script, to make this easier, but you could actually use any of those data services today.

Now, on your "seed warehouse", I'm afraid that's not a viable solution. The issue is that you're attempting to use a non-distributed data store in a way that requires distribution. To explain: 

We've designed out core services to take almost all of the work of managing data off your back, so that you can focus on making gameplay features. Our data systems are designed to be massively scalable in the ways that are most effective for two key data types:

1. Data which is highly distributed, and so can be queried by all players. This is what things like Title and Publisher Data are for. They're replicated across multiple shards, allowing you to have millions of players hitting them, without delays. Since you want to store millions of seeds, I would actually recommend considering using our Content system if you'd rather not use an external data table, since that would give you a way to store batches of seeds in files there, and download any of those to the clients as you need them.

2. Data which is not distributed, as it is frequently updated by a player and needs to be always up-to-date. This lets millions of players all have their own custom data spaces, and allows each of them to update their data simultaneously, also without delays. User data and shared group data all fall in this category. While they can be shared by sets of players, a single one isn't meant to be hit by every player in the game, as it's not spread across shards. So, if a thousand players ask for it, their requests are going to stack up - and the physics of this would mean delays. So while the proposed "seed warehouse" isn't really the way to go with this.

What we do for systems where all players are interacting with a data store in a way that requires fast updates plus access by all players is build custom systems that serve that purpose, like leaderboards and matchmaking. But those are purpose-built, so that we can optimize the functionality.

So, I would recommend using the Content service for your "seed warehouse", as that would be the best general-purpose solution. Alternately, if you want to use an external data table system, that option is available, though I would encourage you to do significant scale testing against that, to ensure that you have good solutions for the issues that will occur with large number of players.

Finally though, I wanted to make sure to ask - you are using a code-based pseudo-random number generator, and not relying on the random number generation of the client, correct? I just need to call this out as even with a seed, random number generation isn't guaranteed to be the same across different hardware devices, let alone different platforms.

10 |1200

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

11708045665895369350 avatar image
11708045665895369350 answered

Thanks for your reply

Yes, I have tested that the same seed generate the same game on different platforms (iOS, android, PC). I strongly need a place to write and read my seeds. 

After reading your answer, I know that my "seed warehouse" is not a viable solution. Appears to use an external data table is a very good solution, but I don't have enough time and ability to maintain it.  I `d like to find an available solution on Playfab, even if it is a paid service.  On the page https://playfab.com/limits/ ,  it shows that the Title/Publisher Data only support "100 Keys of up to 10 KB each". It is not enough for me to store seeds at here. 

You said that "Since you want to store millions of seeds, I would actually recommend considering using our Content system if you'd rather not use an external data table, since that would give you a way to store batches of seeds in files there, and download any of those to the clients as you need them.".  What is the "Content System"? I can`t search to any information about "content system" on your website. Can you give me more guidance? If it refers to the Title/Publisher Data,can I have a way to expand its space? I am willing to pay for such services. I just need a place to store millions of seeds, and Client & cloud scripts can easily use these seeds.

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

Yes, our Content service is our CDN - it's built on AWS CloudFront, so similar to our custom game server hosting, the price is the AWS pricing + 10% to cover our costs. You can find information on it in the Content API calls:

https://api.playfab.com/Documentation/Client#Content

https://api.playfab.com/Documentation/Server#Content

If you'd rather use Title Data to store a database of seeds that you create, we can certainly work with you on a custom contract for the additional data usage. If you'd like to go that route, please let us know the specifics in as much detail as you can - the total number of Keys you would need, total memory per Value, approximate frequency with which they'll be read by the client, and the total amount (keys and data size) the client will read at a time.

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.