Skip to content

Globals (.xml)#

The globals.xml (located at ./data/globals.xml) stores a series of default game engine globals that are used for a variety of purposes. These behave like any other globals, and are present within any scenario unless explicitly overridden.

In the future, most globals will exist within a globals tag, however at this time, this has not been implemented.

Globals File Specification#

Root Node#

<globals>

The root node is named globals, and contains no attributes.

Globals#

<global type="boolean" id="render_target_clearing" info="toggles render target clearing on each frame" protected="false">true</global>
<global type="float" id="ui_scale_factor" info="controls the scaling of the engine ui" protected="false">1.0</global>
<global type="int" id="protected_gvar_test" info="This gvar has additional info!" protected="false">32</global>
<global type="short" id="short_gvar_test">32760</global>
<global type="long" id="long_gvar_test">2049395</global>
<global type="string" id="string_gvar_test">Just some regular ass text</global>
<global type="int" id="int_gvar_test">56263</global>
<global type="color" id="opengl_triangle_color">255,0,0,255</global>

Each global within the globals file contains the variable value within the node contents. Each node has several required and some optional attributes, listed below:

Attribute Name Description Expected Data
type The type of the global. Possible values include: boolean, float, int, short, long, color string
id The ID of the global. This is used when editing the variable from the console, scripts, or code string
info Optional. The description of the variable. Will be presented to the user under certain circumstances string
protected Optional. Whether or not the variable is protected. Protected globals cannot be modified once they have been loaded. If not provided, then the global is treated as unprotected. bool

Using Globals#

Currently, globals can be used only within C++ code and the console, however this will be expanded in the future as the game engine is developed.

Console#

Updating a global from the console is done by simply providing the name of the global, followed by its new value. Displaying the value of a global is done by simply typing the name of the global.

Usage#

Displaying a global:

halo( ui_scale_factor

Updating a global:

halo( ui_scale_factor 2.0

C++ Code#

Usage of globals is currently restricted to within the game engine itself. In the future, this will be exposed using the Blamite API.

No usage examples are currently available for using the globals within C++, as there are a number of refactorings that are planned to be completed first.