Global

The Global plugin is specifically designed to implement object based global variables with persistent data state through a dedicated local storage, for games built in Construct 3.


The Global plugin features as a manageable global variable repository which can be grouped through separate objects, thus making the event sheet more organized.


The Global plugin can also automatically store data in an allocated device space for the application, identifiably stored with the specified storage id.

The Global plugin also has additional automation tools to make getting and setting of object-based global variables easy.


The Global plugin implements object-based global variables with persistent features and tools for Construct 3 application projects.

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 Global plugin is specifically designed to implement object based global variables with persistent data state through a dedicated local storage, for games built in Construct 3.


The Global plugin features as a manageable global variable repository which can be grouped through separate objects, thus making the event sheet more organized.


The Global plugin can also automatically store data in an allocated device space for the application, identifiably stored with the specified storage id.

The Global plugin also has additional automation tools to make getting and setting of object-based global variables easy.


The Global plugin implements object-based global variables with persistent features and tools for Construct 3 application projects.


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

  • Global variables

  • Organized global variables into groups of objects.

  • Global variable management tools.

  • Automation

  • For each loop through all global variables.

  • Set variable by index

  • Export state as JSON string

  • Load state from JSON string

  • Reset global variables

  • Reset global variables by object groups.

  • Persistent data through the application's dedicated device storage allocation.

  • Optionally persist and save the global variables' state, even after the application session.

  • Sync with the application's device storage allocation.

  • Global variables' persistent state are automatically loaded on every application startup.

  • Easy to use with the Construct 3 editor and event sheet.

  • 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

  • Cordova CLI

  • Android Studio

  • Xcode

  • Volt Builder

  • Phonegap

  • 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

 
 

How to use?

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

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



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



3. Set the plugin's unique properties.


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


5. The Persist Data option allows the saving of the Global object's global variables into the application's device storage allocation. Which will then be automatically synced on the next application startup. If the Persist Data is disabled but enabled before, the data it contains will be cleared, assuming the Storage ID is still the same.


6. The ID is the storage identifier key for the group of global variables in the current Global object. This is the key to access and write an allocated device storage space of the application.


7. If the Persist Data is enabled, the ID will be the key used to access the written data in the application's device storage allocation. Thus, if a global object swapped with another global object's id, then their global variable data will also be swapped.


This is assuming that both global variables have the same variable count and variable type, in order.


8. There can be multiple Global objects, with each holding a group of its own global variables.


9. The Global object can be in persist mode or non-persist mode, for more info


10. The Global object can be in persist mode or non-persist mode, please visit the bottom-most section of the documentation page for more information.


 
 

Documentation

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



Scripting Interface


The Global plugin has support for Construct 3's scripting feature. Click to learn more about the scripting feature.


  • Context - Returns the Global object's instance context. Example: const self = runtime.objects.Global.getFirstInstance().Context;

  • AsJSON - Get or set the variables, using a JSON string. Example: const json = runtime.objects.Global.getFirstInstance().AsJSON; runtime.objects.Global.getFirstInstance().AsJSON = JSON.stringify(json);

  • List - Get or set the global variables, using an array. Example: const array = runtime.objects.Global.getFirstInstance().List; runtime.objects.Global.getFirstInstance().List = array;

  • IsSynced - Retrieves a boolean that indicates if the Global addon is synced. Please see the event sheet condition counterpart for more information. Example: const isSynced = runtime.objects.Global.getFirstInstance().IsSynced;

  • Reset() - Reset the global variables to its default value. Example: runtime.objects.Global.getFirstInstance().Reset();

  • Save() - Updates the persistent storage with the current value of the global variables. Example: runtime.objects.Global.getFirstInstance().Save();

 

Actions, Conditions & Expressions

Actions

press to zoom

press to zoom

press to zoom
1/2

The following action groups:

  • Tools

  • Storage

  • Automate

Tools

  • Reset - Reset the global variables of the global object to their default values.

  • Load - Load variables from a JSON string, which can be retrieved from the 'Global.AsJSON' expression.

  • JSON - Input the JSON string which contains the state for the global object.



Storage

  • Save - Updates the persistent storage with the current value of the global variables.


Automate

  • Set Variable By Index - Sets the value of a global variable using the index for reference.

  • Index - The index reference for the global variable. Starts with '0'.

  • Value - The value to set the global variable. Remember to maintain the data type. If a boolean, '0' = false ; '1' = true.

Conditions

The following condition groups:

  • Storage

  • Automate

press to zoom

press to zoom

press to zoom
1/2

Storage

  • Is Synced - If 'persist data' is enabled, this will indicate if the global object is finished syncing with the stored data. Otherwise, it will instantly be true.

  • On Save - The trigger fires when the global object's persistent storage was updated successfully with the latest state.

  • On Save Failed - The trigger fires when the global object's persistent storage attempt to update with the latest state, has failed.



Automate

  • For Each Variable - Loops through all the global variables in the global object.

Expressions

press to zoom

press to zoom
1/1

The following expression groups:

  • Tools

  • Automate

Tools

  • AsJSON - Returns the JSON string of the global object which contains the global variables and their values.



Automate

  • CurVariableIndex - Returns the current global variable index from the 'For each variable" loop condition.

  • CurVariable - Returns the current global variable value from the 'For each variable" loop condition.

  • VariableCount - Returns the number of global variables in the global object.

  • VariableAt - Returns the value of the specified global variable by the index. Returns 0 if the global variable of that index position doesn't exist.

  • 0 - The global variable's positional index, starts from 0.


Object   Properties

Plugin Properties

press to zoom

press to zoom
1/1

The following property groups:

  • Configuration

  • Storage

Configuration - The configuration section of the global object.

  • Debug Mode - If toggled enabled, it will log the processes and errors on the Developer Tools : Console.​


Storage - The storage configuration section of the global object.

  • Persist Data - Toggle enable to persist data to the application's storage.


  • ID - The identification for the allocated space in the application's storage.​

 
 

Showcase

The Global is a plugin that extends the game engine to implement object-based global variables with persistent data and global variable management tools into an application. The plugin comes with two (2) different demo projects.


One is the persistent-data mode, which keeps the data synced in the application's storage, which should load on every application startup.


Another is the non-persistent data mode, which shows the default features of the Global plugin as a global variable grouping object, without the application sync feature.



Persistent Global Variables


Non-Persistent Global Variables


 

Game Projects 

Instructions Kit

Construct 3 Project
Construct 3 Project

press to zoom
Construct 2 Project
Construct 2 Project

press to zoom
Construct 3 Project
Construct 3 Project

press to zoom
1/2

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