Discover
Reference for `gameplay_discover`, the main entry point for the "Discover" experience system. Loads curated gameplay experiences (freeroam scenarios and missions) from Lua modules, presents them as pa
Reference for gameplay_discover, the main entry point for the "Discover" experience system. Loads curated gameplay experiences (freeroam scenarios and missions) from Lua modules, presents them as paginated cards in the UI, and launches them.
Overview
The Discover system provides curated gameplay experiences accessible from the main menu. Each experience is either a freeroam scenario (spawns vehicles, sets up tasks) or a mission reference. Experiences are organized into versioned pages (e.g., "0.37 Highlights", "New Player Experience").
Exports
| Function | Signature | Description |
|---|---|---|
loadDiscovers | () | Scan and load all discover modules (lazy, runs once) |
startDiscover | (discoverId) | Launch a discover experience by ID |
getDiscoverPages | () | Get all discover pages with sections and cards |
onInit | () | Check CLI args for -discover flag |
basicControlsIntroPopup | () | Show device-appropriate basic controls popup |
introPopup | (id) | Show a one-time HTML popup tutorial |
clearTasksOnClientEndMission | () | Flag to clear tasklist when mission ends |
onClientEndMission | () | Clear tasklist if flagged |
onLoadingScreenFadeout | () | Clear the loading lock |
M.basicControlsIntroPopup | () | - |
M.clearTasksOnClientEndMission | () | - |
M.getDiscoverPages | () | - |
M.introPopup | (id) | - |
M.loadDiscovers | () | - |
M.onClientEndMission | () | - |
M.onInit | () | - |
M.onLoadingScreenFadeout | () | - |
M.startDiscover | (discoverId) | - |
Experience Structure
Each experience module (e.g., discover_037.lua) returns:
{
pageInfo = {
title = "0.37 Highlights",
sections = {
{ title = "Freeroam Experiences", type = "freeroam", discoverIds = {...} },
{ title = "Missions", type = "mission", discoverIds = {...} },
},
description = { title = "...", description = "...", image = "..." },
order = -1, -- Lower = shown first
},
experiences = {
{ type = "freeroam", id = "037_limousine", name = "...", trigger = function(M) ... end },
{ type = "mission", id = "037_villaVip", missionId = "italy/arrive/005-villaVip" },
}
}How It Works
loadDiscovers()scanslua/ge/extensions/gameplay/discover/*.luaand loads all modules- Each module registers its experiences in
discoversByIdand page info inpageInfosById getDiscoverPages()builds a sorted page list with formatted experience cardsstartDiscover(id)launches an experience - either starts a mission or calls the trigger function
Mission Experiences
Mission-type experiences resolve their name, description, and icon from the mission system:
{ type = "mission", id = "my_mission", missionId = "italy/arrive/005-villaVip" }Freeroam Experiences
Freeroam experiences have a trigger function that sets up the level, spawns vehicles, configures tasks:
{
type = "freeroam",
id = "my_experience",
trigger = function(M)
freeroam_freeroam.startFreeroamByName("italy", "spawn_town", nil, false, function()
-- spawn vehicles, set tasks, etc.
end)
return true
end
}Intro Popups
basicControlsIntroPopup() detects the player's input device (wheel, gamepad, keyboard) and shows a device-specific HTML popup from /gameplay/discover/popups/basicDriving_<device>/content.html. Each popup is shown only once per session.
CLI Support
The game can be launched with -discover <id> to automatically start a discover experience on boot.
Key Behaviors
setExtensionUnloadMode(M, "manual")- Extension stays loaded permanently- Discover modules are loaded lazily on first access
lastDiscoverprevents double-loading during level transitions- Pages are sorted by
orderfield (lower numbers first) - Default images are provided for experiences without custom thumbnails
See Also
- Gameplay Achievement - Related reference
- Gameplay City - Related reference
- Force Field - Related reference
- Gameplay Systems Guide - Guide
Gameplay City
Loads and queries city-level site data (zones, parking spots) with priority-based zone lookups. Used for level metadata like traffic rules, vehicle groups, and delivery routing.
Force Field
Applies a gravitational planet effect around the player vehicle, pushing or pulling other vehicles. Toggled via radial menu. Disabled automatically during career mode.