question

Romain Maurel avatar image
Romain Maurel asked

Players "base" with passive income to gather

Hello PlayFab team!

My game is advancing pretty well and I will soon implement matchmaking as the final technical step before preparing it for release.

I have a system I would like to implement, but not sure how to do it using PlayFab features, it is called the "Head Quarter".

So the Head Quarter mainly consists in 4 upgradable buildings that grant player passive Virtual Currency income with a maximum stock that requires the player to connect and "gather" it.

Players will have a "Rank" that will depend on their "Experience" they can increment when achieving Missions.

There are a number of rules listed below:

  1. Head Quarter buildings can only be upgraded once the player has reached a specific Rank, (e.g. Building A can be upgraded to level 2 ONLY when reaching Rank Lieutenant) and buildings reachable levels depending on Ranks are not the same for each building.
  2. Upgrading a building requires in-game common VC (Credits).
  3. Each building produces its own VC (e.g Building A produces Shadow Shards, building B produces Bricks...)
  4. The buildings production rates depends on their level (e.g. Building B produces 1 Brick / hour at level 1 and 2 / hour at level 2).
  5. One building will produce a very rare VC so its production will be less than 1 / hour and its production rate will in fact change the period, not the quantity (e.g. Building A level 1 produces 1 Shadow Shard per 12 hours, and 1 per 11 hours at level 2)
  6. Each building will have a maximum VC stock that will depends on its level that will stop its production when filled up. (e.g. Building B level 1 will produce 1 brick / hour up to 10, Building B level 2 will produce 2 bricks / hour up to 20).
  7. Players will have to manually "Gather" each building stock for the VC to be granted and the stock emptied.

If Players "Rank" can be broken down to a simple "Experience" statistics with manual thresholds, I do not have yet the overall Architecture of this feature using PlayFab.

I was thinking about:

- Playing with Player Segments and Shops to be opened to certain players (A shop for each building level that would allow the player to buy an item reprensenting the building)

- Using stackable items for the buildings that would grant VC depending on their stack, but how ? Automation rules and scheduled tasks ?

- Not sure how to implement this "max stock" feature however

Any hints on the best practice to implement such a feature, just enough to point me in the right direction will be very helpful,

Thanks in advance!

In-Game Economy
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

·
Seth Du avatar image
Seth Du answered
  • Head quarters.

There are few workarounds and all of them should involve Cloud Script/Azure Function (CSAF for short). Since buildings in Head Quarter only has limited number, it is fine to store them as KVPs in Player Read-Only Data, so that the upgrade process should be handled by CSAF. The function will verify the perquisitions and consume the required VC for it, and also add a start timestamp and end timestamp in the data field. So that local countdown can be refreshed based on the end timestamp from server.

The resources (VC) generated from the building can be also simply implemented by 3 attributes – last withdraw timestamp, produce rate and maximum stock. When the user trying to withdraw VC, the function will compare the current server time with last withdraw time, calculate the produced VC, then compare with maximum stock value. After the withdraw, simply refresh the timestamp with current server time. While the upgrade of building is to change the produce rate and maximum stock.

Inventory Items are also able to handle this feature. The attributes can be stored in Inventory Item Custom Data, which works like Player Read-Only Data.

  • Playing with Player Segments and Shops to be opened to certain players

This cannot be done by native features of PlayFab because shops are open to all players, the only thing the segment works is to override the price. Players will be able to see all items, but with segment overrides, they may see different price.

  • Using stackable items for the buildings that would grant VC depending on their stack

I am not sure if this demand, but if you want to check the number of stacked items, you may call GetUserInventory and the remainingUses attribute of an item shows the stacked number.

1 comment
10 |1200

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

Romain Maurel avatar image Romain Maurel commented ·

Your solution with CSAF and the process you have described is awesome and fits perfectly this expected behavior !

Many thanks to have taken the time to answer completely :)

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.