Changing Pages on the Augmentation

PLEASE NOTE: This page is currently under construction, and therefore is subject to change. Check back regularly for updates!

Overview

Changing pages is one of the keys to running the game smoothly and improving user experience.
Each type of screen displayed by the aug is referred to as a page.

In the demo project, your aug only displays a single page - the controller skin.
Examples of pagination on the aug can be found in the other Table Realms PlayCanvas demo projects.

In the demo projects, the first page seen on the aug is a start page. Once the players interact with the start button, the page changes to the game controller page.

When attempting to change pages, the following function needs to be called, no matter the platform or engine being used:

function(){ TR.model.setData(data.playerId + '.page', 'ControllerPage'); }

The differences appear when registering events to the event listeners which fire the function. An example of this would be as follows, in PlayCanvas:

Game.prototype.initialize = function() { 
        //This changes the pages on the TR App on the player device from Start Page to Controller Page
        TR.actions.registerAction(data.playerId + '.ClickedStart', function(){ TR.model.setData(data.playerId + '.page', 'ControllerPage'); });
}

The above block of code can be separated into three distinct elements:

  • The initialiser: Game.prototype.initialize = function() { }
  • Registering the event to the event listener when a button is pressed: TR.actions.registerAction(data.playerId + '.ClickedStart')
  • The callback function to set a new page on the Aug, for a specific player: function(){ TR.model.setData(data.playerId + '.page', 'ControllerPage'); }

In order for the event to be registered, the following script needs to be added to the “Start” button element in the TR IDE:

SendAction(model.id .. ".ClickedStart");

For Construct3 users, create the following event block on the primary event sheet

When creating an embedded/native game in C2/C3, there are some minor differences when compared to other game development engines. The biggest is catering for both changing the layout and the aug page.

To change layouts and aug screens within the game, the following event block is needed:

Object for Event Condition Parameters Object for Action Action Parameters
Table Realms Action executed named “start” Table Realms send command “gameStarted”=“”
Table Realms Command Received named “gameStarted” TableRealms Set String “page”=“Game”
System go to layout “How To Play”

The “Set String” action allows the data in the model to be changed, thereby setting the page on the device. The “Go to layout” action is built-in Construct functionality that allows game layouts and screens to be changed, catering for a game flow.