question

afroninjamx avatar image
afroninjamx asked

Logistics of creating a "mail" system

I'd like to create a mail system for my game, and I came across this discussion:
https://community.playfab.com/questions/10155/in-game-mail-system.html

It sounds like it might still be in the works, but I'll plan to build my own in the meantime.

The main concern raised was the usage of key value pairs, as we have a limit. Would it be feasible to pack all mail messages into one key value pair? Then just use a custom delimiter to split them apart? Mail would only come from myself or the server, so I don't need to worry about users abusing the delimiter.

The game will periodically check the server for mail- but once the mail is received it will be parsed and serialized into the user's actual "game file," so storage in the KVP will always be temporary.

(side note: can I upload a user's entire compressed game file into a single KVP? As long as I don't exceed 10kb?)


Could this all work in conjunction with a prize table? I'd like to award game items and deliver them in a mail format. So when the prize table resets it can execute a cloud script that updates the user's "mail" KVP with a message containing the new item. We're allowed to call a custom cloudscript function, right? Not just the default ones from the drop-down list?

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

You can store any string value in the player KVP data. So if the messages will all fit, there's no reason you couldn't put them all in a JSON object in the value. The limits are on the total volume of data, and the frequency of update, since those are the key drivers of cost. So as long as you're updating it infrequently and not risking collisions from multiple users writing to the same KVP, you should be fine.

In terms of Cloud Scripts called from PlayStream Action triggers, the drop-down actually contains every handler defined in your live Cloud Script revision. You can choose any of them, but please be aware of the limit on runtime for Cloud Script - it's shorter for triggered calls, since they can occur more frequently.

6 comments
10 |1200

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

afroninjamx avatar image afroninjamx commented ·

Got it, just wanted to make sure there wasn't a size limit on an individual KVP. It's hard to imagine the triggered calls hitting any limits- should be pretty straightforward to construct a new "message" and graft it onto the existing mail in the KVP.

0 Likes 0 ·
brendan avatar image brendan afroninjamx commented ·

Well, there's a limit on everything - no feature can provide infinite resources. But if you mean, do we limit the player data in ways other than the total length of the key and value, and the update rate, then no, we don't.

0 Likes 0 ·
afroninjamx avatar image afroninjamx brendan commented ·

Ah, yeah, I just meant within the existing 10mb limit for player data. As in, I could set one KVP to 10mb worth of text if wanted (wasting my other KVPs in the process)

0 Likes 0 ·
Show more comments
afroninjamx avatar image afroninjamx commented ·

Sorry, that was a typo. I meant 10kb, not 10mb. 10k is my current "player data value size".
So could I write a single 10kb string if I needed?

0 Likes 0 ·
brendan avatar image brendan afroninjamx commented ·

Oh! Sure, 10KB would fit in a single KVP, no problem. :)

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.