top of page

Clock

The Clock plugin is specifically designed to implement date and clock features with reward systems, timer and last active session features, for games built in Construct 3.


The Clock plugin implements general clock features, easy rewards and daily rewards system, last active features to get the last active session datetime data of the application since it was last closed and global clock timer features.


The Clock plugin supports high precision time sync with the device local time, and optionally using server time, including an optional feature to use PlayFab's server to get the global time.


Extend your Construct 3 game applications with these clock features, with full support for Construct 3's built-in Date object.

PlayFab API v2.png

Introduction

Step 1.png

The Construct Master Collection has plugins that extends the editor and engine features of both Construct 3 and Construct 2.


Please click here to learn more about Game.

Features


The Clock plugin is specifically designed to implement date and clock features with reward systems, timer and last active session features, for games built in Construct 3.


The Clock plugin implements general clock features, easy rewards and daily rewards system, last active features to get the last active session datetime data of the application since it was last closed and global clock timer features.


The Clock plugin supports high precision time sync with the device local time, and optionally using server time, including an optional feature to use PlayFab's server to get the global time.


Extend your Construct 3 game applications with these clock features, with full support for Construct 3's built-in Date object.


Here are some of the game features of the game plugin:

  • Date and time features.

  • Local and server time features.

  • Reward systems

    • Daily reward system

    • Time reward system

    • Reward claim system

  • Reward expiration listeners

    • Control if rewards should expire.

    • Check if rewards are expired.

    • Set or toggle expiration listener.

  • Timer features

    • Timer using duration

      • Once

      • Regular

    • Timer using duration, with fuse duration.

      • One

      • Regular

    • Timer using date time or timestamp (ms).

      • Once

      • Regular

  • Time calibration features

    • Initialize with datetime or timestamp (ms).

      • Server time

        • PlayFab server global time

        • Custom server global time

      • Local device time

    • Update time, to recalibrate time.

      • Server time

        • PlayFab server global time

        • Custom server global time

      • Local device time

  • Import and extract reward system data.

    • Import reward systems data, to restore reward system state.

      • Preload Daily Reward

      • Preload Reward

      • Preload Master (All)

    • Extract reward systems data, to backup or keep reward system state, for next or future application session.

      • DailyRewardData

      • RewardData

      • MasterData (All)

  • Last active session

    • Smart recording of the elapsed time since the previous application session, to the start of the current application session, in seconds.

    • Smart duration interval in recording the last active session.

    • Smart records of the last recorded timestamp, of the current application session.

    • Smart records of the last recorded timestamp, of the previous application session.

  • Clock optimizations and control

    • Performance optimizations for the date and time features to efficiently do their work.

      • Time sync and calibration systems

      • Reward systems

      • Timer systems

      • Expiration listeners

      • Record interval

    • Smart controls for the clock to automatically set which features are running and not.

      • This automatically saves performance, with high efficiency results.

      • Features that do not require constant checking only utilizes call and response implementations, to not waste performance resources.

    • Smart controls in the editor to manually set which features are active and not.

      • Listen interval to control the clock interval in running date and time features.

        • Only for those features that require constant monitoring. For those that do not, are always inactive when not called.

        • This is included with optimization checks to run only when needed, even if during an active interval, to be as efficient as possible.

        • Freely choose the interval duration to run checks for the reward system, timer system, last active session system, expiration listener system, etc.

        • Even with high efficiency rating, the Clock plugin allows you to control the interval in which the clock runs checks.

      • Enable or disable the last active session feature, if you do not want to record and track the elapsed time since the last application session.

        • Enable for game applications that track time, including virtual game simulators with in-game timers.

        • Disable for game applications that do not track or utilize time for game features.

      • Record interval to control the clock interval in recording the last active session features. This only runs if the last active session property is checked.

      • Enable or disable the expiration listener feature.

        • If you want to monitor if rewards are expiring, check this property.

        • If you do not want to monitor if rewards have expired or not, uncheck this property.

  • Debugging features and tools

    • Safe mode - to clear the Clock plugin's offline data, which is used to store the records of the 'last active session' feature.

    • Debug - to log clock processes in the browser console, and other native debugging consoles.

      • Chrome

      • Firefox

      • Safari

      • Android Studio

      • Xcode

      • Universal Windows Platform

  • Construct 3's official Date object support.

    • Use the Date object to convert values generated by the Clock plugin.

  • Well maintained and fully tested for production release.

For more information about game project features, please click here to read the introductory lessons to Game.


Platform Integration


Here are some of the platforms that are natively supported:

  • All platforms supported by Construct 3.

  • Web

  • Mobile Web

  • Desktop

  • Android

  • iOS


Build Support


Here are some of the supported build options:

  • Web

  • Desktop

    • NW.js

    • Windows (WebView2)

    • macOS (WKWebView)

  • Mobile

  • Construct 3 Build Service

  • Facebook Instant Games

  • Playable Ad

  • Construct Arcade


Editor Features


Here are some of the features in the Construct editor:

  • Construct 3

Introduction
Features

How to use?

It is easy to use the Clock plugin, you will only need to follow the steps below.

1. The first step is to add the Clock object into the project.



2. The next step is to go to the Properties Bar while the Clock object is selected.



3. Set the plugin's unique properties.


4. The debug toggle enables info logs in the console.


5. Set the listen interval (ticks) to run the clock processes,

greater is more efficient, lower is more accurate. The min is 0,

while max is 15.


6. Set the last active to continuously record the last active

timestamp, to be able to get the last active time in the next

application session.


7. Set the record interval, in seconds, in which to record the last active

timestamp. The minimum is 1.0, recommended is greater or equal 15.0.


8. Check the expiration listener toggle to enable the reward and daily reward expiration listener.


9. The Danger Zone's safe mode, if checked, clears the last active features data on startup.

This is best used for debugging your application, but remember to turn this off for production release builds. Warning: This is dangerous if ran with your production releases, the players will not be able to get their last active session datetime data.

Instructions
Documentation

Documentation

There is currently nothing to show, we will add more in the future.

ACEs

Actions, Conditions & Expressions

Actions

The following action groups:

  • Initialize

  • Reward

  • Daily Reward

  • General

  • Timer

  • Expiration

Initialize

  • Preload Reward - Preload a reward from a previously saved state.

    • Name - The name of the reward.

    • Data - The saved state data, in JSON string.​


  • Preload Daily Reward - Preload a daily reward from a previously saved state.

    • Name - The name of the daily reward.

    • Data - The saved state data, in JSON string.


  • Preload Master - Preload all rewards and daily rewards, using a previously saved unified state.

    • Data - The saved state data, in JSON string.


  • Initialize - Initialize the Clock object, while also loading all the preloaded rewards and daily rewards.

    • Timestamp - The timestamp to base the time now, in milliseconds.



Reward

  • Create Reward - Create a reward, with a duration before it can be claimed.

    • Name - The name of the reward.

    • Duration - The duration before the reward can be claimed.

    • Duration Type - The unit of time of the duration.

    • Count - The number of times the reward is reset, before it is removed. 0 if indefinite.

    • Expiration - The number of days the reward expires, if unclaimed. 0 if indefinite.

    • Penalty - The penalty if the reward expired.


  • Stop Reward - Remove a reward.

    • Name - The name of the reward.


  • Reset Reward - Reset a reward's duration, this will subtract the remaining reset count.

    • Name - The name of the reward.


Daily Reward

  • Create Daily Reward - Create a daily reward, with each day is a claim of its own reward.

    • Name - The name of the daily reward.

    • Days Count - The number of days to run the daily reward system. Should be set to at least 1.

    • Cycle - Linear will run continuously, while Repeat will reset the cycle upon clearing all the days.

    • Clamp - If in Linear cycle, check this to limit the number of days to the specified Days Count.

    • Penalty - The penalty if the daily reward expired.


  • Stop Daily Reward - Remove a daily reward.

    • Name - The name of the daily reward.


  • Reset Daily Reward - Reset a daily reward to its first unclaimed day.

    • Name - The name of the daily reward.


General

  • Claim Reward - Claim a completed reward or daily reward.

    • Name - The name of the reward or daily reward.

    • Reward Type - Either Reward or Daily Reward.

  • Update Time - Update the current time now, with a specified timestamp. Useful for syncing with an online server time, like PlayFab's.

    • Timestamp - The timestamp to base the time now, in milliseconds.


Timer

  • Start Timer - Start a one-off or regular clock timer.

    • Duration - Enter the time in seconds after which to trigger On Timer.

    • Type - Whether to run this clock timer once, or regularly until cancelled.

    • Tag - Enter a name to identify this timer.


  • Start Timer On - Start a one-off or regular clock timer, on a specified timestamp.

    • Timestamp - Enter the timestamp of the date in which to start the timer.

    • Duration - Enter the time in seconds after which to trigger the On Timer.

    • Type - Whether to run this clock timer once, or regularly until cancelled.

    • Tag - Enter a name to identify this timer.


  • Start Timer In - Start a one-off or regular clock timer, with a specified fuse time before firing.

    • Fuse Time - Seconds until the timer starts.

    • Duration - Enter the time in seconds after which to trigger On Timer.

    • Type - Whether to run this clock timer once, or regularly until cancelled.

    • Tag - Enter a name to identify this timer.


  • Stop Timer - Stop a clock timer.

    • Tag - Enter the name of the clock timer to stop.


Expiration

  • Set Expiration Listen - Whether to enable or disable the reward and daily reward expiration listener.

    • State - Check to enable the expiration listener.


  • Check All Expiration - Scan all rewards and daily rewards if expired. Useful if expiration listener is disabled.


  • Check Expiration - Scan a reward or daily reward if expired. Useful if expiration listener is disabled.

    • Name - The name of the reward or daily reward.

    • Reward Type - Either Reward or Daily Reward.

Conditions

The following condition groups:

  • Initialize

  • Reward

  • Daily Reward

  • Timer

  • Reward Lookup

  • Last Active

  • Expiration