question

Engin Yılmaz avatar image
Engin Yılmaz asked

How Can I Change a Specification About Offline Players?

Hello,

For example, in my game there is a player who is running a market in the game and there are virtual customers who buy stuff from that market 24 hours and virtual customers sometimes buying less stuff and sometimes more. Players' game money increment rate changing over time because of virtual customers changing their buying volume randomly. How can i code this 'situation change' when the player is offline with cloud script? or Can cloud script help me with this situation? or Do I have to use a multiplayer server?

Thank you for your answers.

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

I do not completely understand your need, if there is anything missed, please do not hesitate to ask.

I assume your need is that all players are able to open stores to sell things, the system(bots) will keep purchasing random items from their stores. It is feasible to implement this action without any help from 3rd tools.

  1. A Segmentation: you need to create a segment in [Game Manager] -> [Players], which will categorize players who open a store.
  2. A Cloud Script function: that will read a player’ store items list and make the random purchase. You may need do plenty of work here, modifying VC, generating the random number, changing user’s inventory…
  3. A Schedule Task: You need apply the task on each player in the Segment:

And that's it.

PlayFab does not strictly detect if the client is online(of course you still can check client focus via Unity SDK). the work flow of this action is after the player open the store, he will join the segment. Each member inside the segment will run a purchase function via Cloud Script every once a specific while. It doesn't matter if the player is online or offline and every time user actively checks the store list, there will be a sync that helps refresh the list.


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.

Engin Yılmaz avatar image Engin Yılmaz commented ·

Thank you for your answer SethDu. Do you believe that 1 second of processing time is enough for this kind of cloudscript to work?

0 Likes 0 ·
Andy avatar image Andy ♦♦ Engin Yılmaz commented ·

Depending on the complexity of your solution, you could very-well run into issues with the amount of time or number of API calls it takes to complete for each player. If that's the case, you could set up your own internal service that periodically performed the same operations. If you'd prefer to stick to a cloud-hosted solution, you could also look into Azure Function with Triggers. That would allow you to kick off a job on a timer without having to worry about any of the infrastructure: https://docs.microsoft.com/en-us/learn/modules/execute-azure-function-with-triggers/.

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.