Hi,
I'm struggling to find the answers to my questions for several days. Basically, I'm creating a game where players will get a "Redeemable Code" at the end of every game/level. He can play multiple times a day and have multiple "Redeemable Codes" per day. For example, let's say that my game has 10k players and each player gets 10 redeemable codes a day, which means we need a way to store 100,000 codes. The code must be stored in a secure way so that players can't read/write them. Let me write my requirements into points:
- I need to find a way to store those codes in "one place". Currently, I can grant the players the code and save it in their Player Data, because one player could store only 50 redeemable codes at any given time, so the string size in their Player Data will stay within limit. But we also need to store those 50 redeemable codes "of each player" into one place. In my example, if 2,000 players played my game and saved 50 redeemable codes in their data, the total 100,000 codes (2,000 * 50) should be stored in one place/folder.
- I need to be able to download those codes easily on a daily basis.
- I want to restrict players so that they can't read/write those codes, and instead, cloudscript handles everything.
For my requirements, I looked at the options of Player Data, but they won't work because those codes can't be stored in one place, and are not easily downloadable for us. I looked at the Entity Files but they are related to players. Again, I want to store codes in one place.
The CDN service looks like a solution. I am assuming that I can download the files and folders easily from the "File Management" tab of the Playfab Dashboard. I have the following questions regarding the CDN service:
- How is the usage calculated? Is it based on upload usage or download usage or both?
- Can I upload/write data to the CDN from Cloud Script? For example, at the end of every game, the player will send ExecuteCloudScript request from Unity and Cloud Script will generate the code, and store it in a CDN.
- For each code, a new file will be created. For example, for each code (0101CC), cloud script will save the file as "0101CC.txt", so the title of those files is the code. It means, 100,000 empty text files with only their names will be created, is it fine with the CDN?
- Can I download those files in one click if they are located in one folder? For example, a folder named "20feb2020" contain 100k or 1m files, can I download the folder in one click? Please note that the folder size will probably be a max of 50 to 100 MB, because those text files are empty and only contain the code as their title name.
- Can clients download the uploaded data in any way if I don't expose any information to them regarding the CDN? Will they be able to use GetContentUploadURL or GetContentDownloadURL APIs? I don't want to let them use these APIs. I read that those APIs are ADMIN related. Does it mean that they can only be executed on Cloud Script? I know that I've asked too many questions, but I'm hopeful that you will handle these questions beautifully and will be able to answer my questions asap.