RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
ui/ambientSound - Ambient Sound Stream PlayerUI Apps ManagerUI AudioBindings LegendCamera Distance AppConsole (consoleNG)Credits MusicExternal App (WebSocket UI Server)Fade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsUI Navigation / MapVehicle Paint EditorVehicle Vicinity AppUI Visibility
Gameplay Selector - GeneralTile ClusteringGameplay Selector TilesTile Sorting

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE ExtensionsuigameplaySelector

Tile Clustering

Groups gameplay items into clusters by level, type, or automatic system-based rules, and creates summary tiles for the grid UI.

Groups gameplay items into clusters by level, type, or automatic system-based rules, and creates summary tiles for the grid UI.


Overview

tileClustering provides clustering logic for the gameplay selector. Items are grouped into clusters (by level, type, or automatic rules), and each cluster produces a summary tile showing preview, favourite status, and sub-element count.

Module path: lua/ge/extensions/ui/gameplaySelector/tileClustering.lua (loaded via require)


Exports (M)

FunctionSignatureDescription
setBackend(backend)Sets the backend reference for favourite/recent queries.
clusterItems(items, clusterMode)Groups items into clusters by the specified mode.
createTileFromClusteredItems(clusteredItems, group, clusterMode)Creates a summary tile for a cluster.
getClusterModeFunction(clusterMode)Returns the clustering key function.
getClusteredItemsFavouriteIconPercent(clusteredItems)Returns favourite/recent stats for a cluster.
getClusteredItemsStats(clusteredItems, sortMode)Returns preview image and representative item.
getSourceIcons(clusteredItems)Collects and sorts source icons from all items.

Internals

Cluster Modes

ModeBehavior
levelGroups by item.level
typeGroups by item.type
automaticSystem-aware: Freeroam/Scenarios→level, Challenges→type, Campaigns→no clustering
noneAll items in one "None" cluster

Automatic Mode Logic

['automatic'] = function(item)
  local system = item.system or "Other..."
  if system == "Campaigns (deprecated)" then return "None"
  elseif system == "Freeroam" then return item.level or "Other..."
  elseif system == "Scenarios (deprecated)" then return item.level or "Other..."
  elseif system == "Challenges" then return item.type or "Other..."
  elseif item.level then return item.level
  else return "Other..." end
end

Cluster Tile Creation

Each cluster tile includes:

  • key - unique identifier combining group and cluster key
  • name - cluster label (level name, type name, etc.)
  • preview - best preview image from contained items
  • subElementCount - number of items in the cluster
  • favouriteIdx / recentIdx - highest favourite / lowest recent across items
  • gotoPath - navigation path for drilling into the cluster
  • sourceIcons - merged and sorted icons from all items

Source Icon Ordering

Icons are sorted by a predefined priority: beamNG > camshaft > puzzleModule > cup > bug, then alphabetically for unknown icons.


How It Works

  1. clusterItems(items, "automatic") groups items by the automatic key function
  2. Each cluster is a table with itemsByKey, count, and list
  3. createTileFromClusteredItems picks the right tile creator for the cluster mode
  4. The tile creator computes preview, stats, and navigation path
  5. Grid UI renders cluster tiles; clicking one navigates to the detail view

Additional Exports

The following exports are available but not yet documented in detail:

  • M.clusterItems
  • M.createTileFromClusteredItems
  • M.getClusterModeFunction
  • M.getClusteredItemsFavouriteIconPercent
  • M.getClusteredItemsStats
  • M.getSourceIcons
  • M.setBackend

Gameplay Selector - General

Backend module for the gameplay grid selector - manages display options, filters, tiles, favourites, and navigation for scenarios, campaigns, challenges, and freeroam.

Gameplay Selector Tiles

Main tile processing module - handles path-based navigation, grouping, clustering, filtering, and sorting for the gameplay grid.

On this page

OverviewExports (M)InternalsCluster ModesAutomatic Mode LogicCluster Tile CreationSource Icon OrderingHow It WorksAdditional Exports