question

unsymmetricalstudios avatar image
unsymmetricalstudios asked

Best Practices for in-game missions/contracts

I'm relatively new to Playfab, but I was hoping to get an idea of how to implement the following.

So in my game, the player can accept "missions"/contracts. The contracts have a list of prerequisites (e.g. minimum XP) before the player can accept them, and they have a list of requirements for completion (e.g. completing a task). After completion, the player is awarded with XP and free-tier currency.

Ideally, the player may only accept a limited number of contracts at any one time and only a subset of available contracts are displayed. (e.g. 20 contracts available, only 5 contracts shown)

I would also like to be able to have a set of randomly generated recurring missions,(possibly scaled by XP), a set of storyline missions, and a set of special event missions.

The mission aren't connected to particular "levels" or anything. It's just the prerequisites to accept, the requirements for completion, and the reward. They probably also have some metadata like the mission giver name, the description, etc.

What would be the best practice here?

Would a catalog be a good way to implement the mission? This would allow the dynamic updates but I'm not sure how I would randomly generate them (bundles linked to a table?).

Could I possibly use one catalog for the missions, the missions being containers, which are only opened upon mission completion?

Thanks in advance for any help!

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

I'm not clear on what, if any, elements of the Economy system you'd be leveraging. If it were me, I would implement this like so:

1. Store all the meta-data about missions is Title Data. Whether it's a set of missions or the data used to randomly generate them, that'll work fine.

2. Track current missions in user real-only data, with a timestamp for when the mission was started.

3. Allow players to start new missions via a server authoritative call - either Cloud Script or a custom game server - so that you can check that the player is actually allowed to start a new mission, and so that the mission data is set accurately.

2 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.

unsymmetricalstudios avatar image unsymmetricalstudios commented ·

That seems like an elegant solution, in theory. I'll need to experiment a bit with it.

I guess I was figuring the mission catalog would be like a store, and the missions would be item, at least programmatically. In game they would present as expected. I suppose that's overcomplicating things.

How will the title data limits affect this? Does the 50 key/pair limit at free tier consider nested tables as the same table or a separate table? Just trying to understand the limitations.

0 Likes 0 ·
brendan avatar image brendan unsymmetricalstudios commented ·

The size of an individual KVP in Title Data is 20,000 bytes (much higher in the paid tiers), even in the free tier, so you should be fine. In general - and this applies to user data and title data, but not our newer Entity data model - small KVPs are inefficient, so it's better to aggregate info into fewer, larger values. In the Entity model, we have it split into two parts - Entity Objects, which are designed for small JSON blobs of data, and Entity Files, which are for larger arbitrary data.

1 Like 1 ·

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.