Presentation vs Simulation

The default Trigger.lua.txt file runs on the simulation layer.

If you create Presentation.lua.txt file in your Map/Mod's Assets\\Scripts\\ folder, this script will run on the presentation layer.

Presentation scripts can't modify simulation states directly. Instead, new APIs are added to send commands between presentation scripts and simulation scripts.

This is a WIP feature and many APIs don't work yet in presentation scripts. Eventually, we expect all APIs working with presentation concepts will be made presentation scripting only (e.g., all custom UI APIs, input control, camera control). More features will also be added to presentation scripting (e.g., construct/manipulate actors directly in scripts).

Requiring Presentation, Simulation, or Shared

Presentation.lua.txt and Trigger.lua.txt from a module are exported separately. When requiring a module in another project, the scripting layer to import should be specified, using “Shared” to access functions that are accessible in both layers:

local my_mod = require(”MyMod:Shared”) -- Use in either layer to access shared functions
local my_mod = require(”MyMod:Presentation”) -- Use in presentation layer to require the presentation functions from your mod
local my_mod = require(”MyMod:Simulation”)-- Use in simulation layer to require the simulation functions from your mod

Use Case

Using presentation scripting for all UI enables higher FPS for your UI elements, allowing for smoother more polished game UI.

Implementation

UI on the presentation layer should be implemented using the GMUI mod, which acts as an interface between Simulation and Presentation and enables you to build UI easily: https://wiki.funovus.com/master/Mods-GMUI-Overview

Related APIs