Documentation & Tutorials
  • Pivec Labs Documentation & Tutorials
  • Assets for Game Creator 1
    • Action Pack 1
      • Action List
        • Misc Actions
        • Object Actions
        • TMP Actions
      • Examples
        • Example 1 TMP
        • Example 2 Objects
        • Example 3 Actions
    • Action Pack 2
      • Action List
        • Camera Actions
        • Graphics Actions
        • Audio Actions
        • Video Actions
      • Triggers
      • Components
      • Examples
        • Example 1 - Camera
        • Example 2 - Camera FPS
        • Example 3 - Graphics
        • Example 4 - Sounds
        • Example 5 - Audio Player
        • Example 6 - Video Player
    • Action Pack 3
      • Action List
        • Day/Night Cycle
        • Light Control
      • Components
      • Examples
        • Example 1 - Day Night Cycle
        • Example 2 - Light Control
    • Accessibility Module
      • Components
      • Setup
      • Auditory Aids
        • Closed Captions for Sounds
        • Volume Control with Tags
        • Multiple Volume Controls
      • Motoric Aids
        • Configurable Tank Camera
        • On-Screen Multi-Function Joystick
        • Dynamic Touchstick
        • Multi-Function Touchstick
      • Cognitive Aids
        • Parental Controls with Password
        • Dyslexia Font Options
        • Motion Sickness Prevention
        • Gameplay Speed and Sensitivity
      • Visual Aids
        • Colour Picker
        • Variable Text Size
        • Object Outlining
        • Colour Switching
        • Colour Correction
    • Mobile Components
      • Actions
        • Haptics
        • Camera
        • TouchSticks
        • Gyroscope
        • Utilities
      • Triggers
        • Touch Gestures
      • Conditions
      • Components
      • Prefabs
      • Examples
        • Example 1 Haptics
        • Example 2 Cameras
        • Example 3 Gestures
        • Example 4 Controls
        • Example 5 Steering Wheel/Pedals
        • Example 6 Gyroscope Controls
        • Example 7 Gyroscope Camera
        • Example 8 Utilities
        • Example 9 AutoRun
      • Extras
    • UI Components
      • Canvas Components
        • Canvas Animations
        • 3D Models on a Canvas
        • Video on a Canvas
      • Animating UI Elements
        • Cross Fade Elements
        • Slide Elements
        • Shake UI Element
        • Tooltips
      • Text Mesh Pro & uGUI Text
      • Colour Picker Component
      • Mini Map Component
        • MiniMap QuickStart
        • Fullscreen Map
        • Adding Markers
        • Adding Labels
      • System Info Panel
        • SysInfo Quickstart
        • Using SysInfo Toggle
      • Main Menu Templates
        • Customising the Prefabs
        • Load/Save System
        • Comic Strip Example
    • Developer Tools
      • Time Manager
        • Actions & Conditions
      • Waypoint System
      • Click to Spawn Objects
      • In-Game Console
      • In-Game Screen Capture
    • Turn Based Module
    • VR Module GC1
  • Assets for Unity
    • Developer Tools for Unity
      • Click to Spawn
      • In-Game Screen Capture
      • In-Game Console
    • Mini Map System
      • MiniMap Quickstart
      • Map Parameters
      • Adding Makers
  • Tutorials
    • Tutorials for Game Creator 1
      • Installing and Updating Modules
      • Adding Actions to the Button Bar
      • Changing the Graphics for TouchStick
      • Adding Passwords to Player Actions
      • Using the Colour Picker with Variables
      • Creating a 3D Inspection Panel for Game Objects
      • Customising the UI MiniMap
      • Creating a toggle for the SysInfo Panel
      • Simple Player Run on Left Shift Down
      • Pan Follow Camera with Keyboard
    • Tutorials for Unity
  • ANNEX
    • Roadmap
    • FAQ
Powered by GitBook
On this page

Was this helpful?

  1. Assets for Game Creator 1
  2. Developer Tools

Time Manager

PreviousDeveloper ToolsNextActions & Conditions

Last updated 4 years ago

Was this helpful?

The Time Manager Component allows you to synchronise your game with real world time. You can retrive the time from a Network Time Protocol (NTP) server, store it in your variables, and encrypt it to prevent hacking.

The system currently consists of a Time Manager Component, a series of Actions to control encryption and Variable store/receive, and Conditions to verify synchronised times.

To use the Time Manager, create an empty gameobject in your hierarchy and add the time mamanger component to it.

Next, create four Global Variabes to enabled all the features of the Time Manager.

  1. Initial Time (the time the game was started or first started)

  2. Current Time (the current time from the Network)

  3. Local Time (to store the current time of the Players platform)

  4. Last Update time (stores the array of times that each recurring Action was last executed)

These should all be String Variables and the save check box should be checked.

Add these Variables to the approriate slots in the Time Manager Component. The Local Time Variable is used by the Condition and Action to verify local time and is not referenced by the Time Manager.

Select an NTP server, for most cases the pool.ntp.org is the best choice.

Also decide if you wish to encrypt your variables to protect them from Hacking. You can leave this unchecked while developing and check it later when building. The Key you choose must be a combination of 32 characters and numbers, abnd must be the same for all of your variables.

If you require te NTP server to be queried repeatedly, set the repeating ping check box and interval. Do not set this tio continually ping, or your game will be blocked. Every 10 seconds or even once per hour is a good option. You can also use the Action to check NTP now, if you want to prevent hacking or cheating (see example for how this is set up).

Lastly, add your Actions to the Recurring Action listand selecyt the interval that you required. This seting is to execute this Action every x (number) y (time), where x is a count like 13, and y is either minutes, hours, days, weeks or months. Therefore if you set this to every 30 minutes, the Action will execute every half hour or 48 times per day. Likewise, every 12 months will be once per year, as would e very 52 weeks.

The wait after start parameter is to allow for areas with slow network times. You should allow the NTP server to obtain and store the time prior to checking if the Actions are due to execute.

NOTE: If the start variable is empty, the Time Manager will presume that this is a new game and store the initial time in this variable. If there is a time already there, as would be from a loaded saved game, the variable will not be updated. This allows you to know when a new game was started, and when this game is reloaded (load saved game), all Recurring Actions will be checked to calculate if they should have been executed during the time the game was not active.

The Time manager works as follows:

New Game: If the Initial Variable is empty, store current time in milliseconds.

Set Actions: Calculate the interval in Milliseconds (example, every 3 minutes is 60000 x 3) and store as ActionTime.

Read Last Update: Calculate how many times the Action should be executed to bring it current.

(If ((last time updated + action interval) <= current time), then execute)

Execute Actions: Loop through the Action Array until ALL actions are brought up to date.

Store Last Update: Each Action that was just executed has current time stored in the array.

The Time Manager is executed every 60 seconds. More than this is not needed as the smallest Action time is 1 minute.