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

Initialize

  • Is Initialized - Check if the Clock object has been initialized.​

  • On Initialize - Trigger fires upon initialization.​​



Reward

  • On Reward - Trigger fires when a reward is completed.

    • Name - The name of the reward.


  • On Any Reward - Trigger fires when any reward is completed.

  • Is Reward Running - Check if a reward is currently running.

    • Name - The name of the reward.


Daily Reward

  • On Daily Reward - Trigger fires when a daily reward is completed.

    • Name - The name of the daily reward.


  • On Any Daily Reward - Trigger fires when any daily reward is completed.

  • Is Daily Reward Running - Check if a daily reward is currently running.

    • Name - The name of the daily reward.


Timer

  • On Timer - Trigger fires when a clock timer has elapsed.

    • Tag - Enter the name of the clock timer.


  • Is Timer Running - True if a clock timer with the given tag is currently running.

    • Tag - Enter the name of the clock timer.


  • Is Timer Waiting - Check if a delayed clock timer with the given tag is currently awaiting its fire time to start.

    • Tag - Enter the name of the clock timer.


Reward Lookup

  • For Each Reward - Loops through all the rewards.

  • For Each Daily Reward - Loops through all the daily rewards.

  • Is Reward Claimable - Check if a reward or daily reward is claimable.

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

    • Type - Choose the type of reward.


Last Active

  • Is Last Active - Check if a previous active session state was found.


Expiration

  • On Expire - Trigger fires upon expiration of a specified reward or daily reward.

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

    • Type - Check the type of reward.

    • Penalty - Check the expiration penalty.


  • On Any Expire - Trigger fires upon expiration.

Expressions

The following expression groups:

  • Reward

  • Daily Reward

  • General

  • Timer

  • Reward Lookup

  • Last Active

  • Get

  • Convert

  • Expiration

Reward

  • RewardName - The name of the reward.

  • RewardStart - The timestamp when the reward started.

    • Name - The name of the reward.


  • RewardEnd - The timestamp when the reward is completed.

    • Name - The name of the reward.


  • RewardElapsedTime - The elapsed time since the reward started, in milliseconds.

    • Name - The name of the reward.


  • RewardTimeLeft - The time left until you can claim the reward, in milliseconds.

    • Name - The name of the reward.


  • RewardDuration - The specified duration until the reward is ready to be claimed, in milliseconds.

    • Name - The name of the reward.


  • RewardCycleCount - The specified number of times the reward can reset, before it is removed.

    • Name - The name of the reward.


  • RewardCurrentCycle - The number of times the reward has been claimed.

    • Name - The name of the reward.


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

    • Name - The name of the reward.


  • RewardPenalty - Either Reset or Stop. The specified penalty of the reward.

    • Name - The name of the reward.



Daily Reward

  • DailyName - The name of the daily reward.

  • DailyStart - The timestamp when the daily reward started.

    • Name - The name of the daily reward.


  • DaysPassed - The number of days claimed from the daily reward. If Clamp is checked, it will limit to the specified Days Count.

    • Name - The name of the daily reward.


  • WeeksPassed - The number of weeks claimed from the daily reward. If Clamp is checked, it will limit the number of weeks to the specified Days Count.

    • Name - The name of the daily reward.


  • DayStart - The timestamp when the current day started.

    • Name - The name of the daily reward.


  • DayEnd - The timestamp when the current day is completed.

    • Name - The name of the daily reward.


  • DayElapsedTime - The elapsed time since the day started, in milliseconds.

    • Name - The name of the daily reward.


  • DayTimeLeft - The time left until you can claim the daily reward, in milliseconds.

    • Name - The name of the daily reward.


  • DaysCount - The specified number of days for the daily reward to run.

    • Name - The name of the daily reward.


  • DailyCycle - Either Linear or Repeat. The specified cycle of the daily reward.

    • Name - The name of the daily reward.


  • DailyClamp - Either True or False. The specified clamp property of the daily reward.

    • Name - The name of the daily reward.


  • DailyPenalty - Either Reset or Stop. The specified penalty of the daily reward.

    • Name - The name of the daily reward.


General

  • RewardData - The save state data of a reward, in JSON string.

    • Name - The name of the reward.


  • DailyRewardData - The save state data of a daily reward, in JSON string.

    • Name - The name of the daily reward.


  • MasterData - The save state data of all rewards and daily rewards, in JSON string.


Timer

  • StartTime - The timestamp when the clock timer first started.

    • Tag - Enter a name to identify this timer.


  • CurrentTime - Seconds since the start, or the last 'On Timer' event.

    • Tag - Enter a name to identify this timer.


  • TotalTime - Seconds since the clock timer was started.

    • Tag - Enter a name to identify this timer.


  • Duration - The duration in seconds until the next 'On Timer".

    • Tag - Enter a name to identify this timer.


Reward Lookup

  • CurReward - The current reward name from the 'For Each Reward' loop.

  • CurDailyReward - The current daily reward name from the 'For Each Daily Reward' loop.

  • RewardsCount - Retrieve the current number of rewards.

  • DailyRewardsCount - Retrieve the current number of daily rewards.


Last Active

  • LastActiveTime - The last recorded timestamp from the previous application session.

  • LastActiveElapsedTime - The elapsed time since the previous application session, to the start of the current, in seconds.

  • CurrentActiveTime - The latest recorded timestamp, of this current application session.

  • RecordInterval - The interval in which the current session's active timestamp is updated for recording, specified in the plugin properties.


Get

  • Now - Get a timestamp for the current time.

  • Time - Get the current clock time, with respect to the timestamp upon initialization and its delay.


Convert

  • Parse - Convert a date string to a timestamp.

    • DateString - The date string to parse.


  • ToUTCString - Convert a timestamp to a string using the UTC time zone.

    • Timestamp - The timestamp to convert.


Expiration

  • ExpiredName - The name of the expired reward or daily reward.

  • ExpiredType - The type of expired reward, either Reward or Daily Reward.

  • ExpiredPenalty - The penalty of the expired reward, either Reset or Stop.


Object   Properties

Plugin Properties

The following property groups:

  • Configuration

  • Clock

  • Danger Zone

Configuration - The plugin configuration section.

  • Debug - Check to log debugging information in the console.


Clock - The features configuration section.

  • Listen Interval - The interval (ticks) to run the clock processes, greater is more efficient, lower is more accurate. The min is 0, while max is 15.

  • Last Active - Check to continuously record the last active timestamp, to be able to get the last active time in the next application session.

  • Record Interval - The interval (sec) to record the last active timestamp. The minimum is 1.0, recommended is greater or equal 15.0.

  • Expiration Listener - Check to enable the reward and daily reward expiration listener.


Danger Zone - The dangerous configuration section, only change when necessary.

  • Safe Mode - Check to clear the offline data, which is used for the last active feature.

Properties
Showcase

Showcase

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.


Here are some previews of the demo projects in using some of the features.









Game Projects

Game Projects 

Instructions Kit

Specifications

  • Instructions - The game project contains instructions and steps on how to use the addon and its features.

  • Action, Conditions and Expressions - It covers the implementation of each action, condition and expression.

  • Tips and Tricks - It provides some tips and tricks on the recommended ways of using the addon.

Supporters

Only

bottom of page