Usage Limits

Overview

The page shows four usage counters and two reset schedules (daily and weekly). Counters 1 to 3 follow the same daily schedule but are counted separately, while Counter 4 follows the weekly one. The maximum is supplied by the press rather than stored on the counter, so Counter 1 carries two ceilings at once: three free uses, and up to five with an ad view.

How to try it

  1. Reset schedules shows the daily schedule, Resets every day at 00:00 UTC, and the weekly one, Resets every Monday at 00:00 UTC. Each counter’s Next reset in counts down to its next reset.
  2. Press Use free under Counter 1 (daily reset) three times; Usage reads 3 used. Free uses stop at 3, ad-backed uses at 5., and Watch an ad to use replaces Use free.
  3. Press Watch an ad to use; an Advertisement panel opens (no real ad plays). Wait 5 seconds and press I finished watching: a view point is granted and then spent on one use. At five uses Nothing left appears and no more uses are possible.
  4. Pressing Use free under Counter 2 (daily reset) leaves Counter 1’s count unchanged. Counter 2 closes at 4 uses, Counter 3 at 6, and the weekly Counter 4 (weekly reset) at 1; once closed, No free uses left appears.
  5. Press Reset every allowance under Counter 1 (daily reset) to put all four counters back to 0, instead of waiting for midnight UTC (or Monday, for Counter 4).

Counts are kept on the account shared by all showroom demos. If a counter is already closed, Reset every allowance lets you start over at any time.

GS2 services used

  • GS2-Limit: GS2-Limit models define the daily (00:00 UTC) and weekly (Monday 00:00 UTC) reset schedules and count four counters per player. The maximum is passed with each count-up request.
  • GS2-Exchange: GS2-Exchange rates define the transactions for a free use, an ad-backed use that also spends a view point, and resetting every counter, executed server-side atomically.
  • GS2-AdReward: Watch an ad to use spends one GS2-AdReward view point per ad-backed use. The point is granted when the view is confirmed, the same way as in the ads demo.

Use it in GS2 Studio

In GS2 Studio’s Simple mode, open Add features and press Add on Usage Limits to bring this feature into your own project. To point at the package directly, choose Add from GitHub and enter the package below.

https://github.com/gs2io/gs2-studio-package/tree/main/foundation-economy-limit/packages/foundation-economy-limit
  • Owner: gs2io
  • Repository: gs2-studio-package
  • Subdirectory: foundation-economy-limit/packages/foundation-economy-limit

Source code