question

max avatar image
max asked

Best way to create items with timers

We want to create items that have a timer attached like it's implemented in many freemium games. For example the player gets dropped a sword, but once he decides to equip it, the initial preparation takes 6 hours of real time. If the time is up, the player can use the sword.

We want to show the player a timer, se he knows how long it will take (and if it's worth for them to pay to immediately unlock the item). How would we ideally handle this?

Should we save the initial timestamp in the custom data of them item?

How would our client compare the time that is then save in the custom data with their local timezone?

Are the server times that we get via Cloud Script always in the same time zone? (If yes, which timezone?)

Maybe there's an even easier / better way then we'd imagine so far, so I'm looking forward to your ideas ;)

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

Yes, the simplest thing to do would be to put a timestamp on the item instance (and then check it) via Cloud Script when the timer should start, so that you have a consistent way to know server-side when the item should unlock. All our servers report time in UTC, so you can make the conversion to any time zone fairly easily, but I would be careful not to let the client be authoritative about when the item is available for use.

If you want to be even more secure, what you could do is store the info on the item to be unlocked and the timestamp in User Internal Data, and not actually add the item to the player inventory until the right amount of time has elapsed (or the player pays to finish it). Again, you'd use Cloud Script to update and check that data, but also then to grant the item when the player gets access.

10 |1200

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

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.