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 Sorting

Centralized sorting module for gameplay selector tiles - supports name, system, date, and automatic multi-criteria sorting.

Centralized sorting module for gameplay selector tiles - supports name, system, date, and automatic multi-criteria sorting.


Overview

tileSorting provides sort functions and utilities for ordering gameplay tiles within groups. It handles complex sorting rules including auxiliary/career item ordering, system priority, and UI-to-internal mode mapping.

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


Exports (M)

FunctionSignatureDescription
sortTiles(tiles, sortMode)Sorts a tile list in-place by the given mode.
sortTilesFromUIValue(tiles, uiSortValue)Sorts using a UI dropdown value (auto-converts).
getSortFunction(sortMode)Returns the comparator function for a mode.
isValidSortMode(sortMode)Returns true if the mode is recognized.
convertUIValueToSortMode(uiValue)Maps UI values to internal sort modes.
sortGroup(group, sortMode)Sorts group.tiles in-place.
sortByNameButOtherAlwaysLast(a, b)Alphabetical, "Other..." always last.
sortBySystem(a, b)By system order, then name.
sortByGameplayAutomatic(a, b)Multi-criteria gameplay sorting.
sortByDate(a, b)Newest first, no-date items last.

Constants

ConstantDescription
M.SYSTEM_ORDERPriority map: Freeroam=1, Challenges=2, Scenarios=3, Campaigns=4
M.UI_TO_SORT_MODEMaps UI values to internal: automatic→GameplayAutomatic, name→Name, date→Date

Data Fields

FieldDescription
M.VALID_SORT_MODESTable of valid sort mode identifiers.
M.SORT_MODE_TO_UIMap from sort mode identifiers to UI display strings.

Internals

GameplayAutomatic Sort Order

The multi-criteria sort applies in this priority:

  1. Clustered items first - tiles from clustering sort by name
  2. System order - Freeroam → Challenges → Scenarios → Campaigns → Other
  3. Non-auxiliary before auxiliary - debug content sorts last
  4. Challenges-specific: non-career before career, then by order property
  5. Fallback: by order property, then alphabetically
local function sortByGameplayAutomatic(a, b)
  local clusteredResult = compareClusteredStatus(a, b)
  if clusteredResult ~= nil then return clusteredResult end

  local aOrder = M.SYSTEM_ORDER[a.system] or 999
  local bOrder = M.SYSTEM_ORDER[b.system] or 999
  if aOrder ~= bOrder then return aOrder < bOrder end

  local auxResult = compareAuxiliaryStatus(a, b)
  if auxResult ~= nil then return auxResult end
  -- ...continues with career/order/name comparisons
end

Date Sorting

Sorts newest first. Items without dates sort to the end:

local function sortByDate(a, b)
  if a.date == b.date then return sortByNameButOtherAlwaysLast(a, b) end
  if not a.date then return false end
  if not b.date then return true end
  return a.date > b.date
end

How It Works

  1. The tiles module calls sortTilesFromUIValue(tiles, displayData.sorting)
  2. UI value "automatic" maps to internal "GameplayAutomatic"
  3. The multi-criteria sort applies system order, auxiliary status, and per-system rules
  4. table.sort is called with the selected comparator function
  5. Groups use sortGroup for convenient in-place sorting

Additional Exports

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

  • M.convertUIValueToSortMode
  • M.getSortFunction
  • M.isValidSortMode
  • M.sortByDate
  • M.sortByGameplayAutomatic
  • M.sortByNameButOtherAlwaysLast
  • M.sortBySystem
  • M.sortGroup
  • M.sortTiles
  • M.sortTilesFromUIValue

Gameplay Selector Tiles

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

Campaign Tiles Generator

Tile generator for legacy campaign entries in the gameplay selector grid.

On this page

OverviewExports (M)ConstantsData FieldsInternalsGameplayAutomatic Sort OrderDate SortingHow It WorksAdditional Exports