RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Gameplay AchievementGameplay CityDiscoverForce FieldGarage ModeMarker InteractionParking SystemGameplay Playmode MarkersGameplay PoliceGameplay RallyGameplay Rally LoopGameplay Raw POIsGameplay Skidpad TestSpeed Trap LeaderboardsSpeed Traps and CamerasGameplay StatisticsTaxi Ride SystemTraffic SystemVehicle PerformanceWalking
Rally Audio ManagerRally Camera Path PlayerRally ClientRally Cut CaptureRally EnumsRally Extension HelperRally GeometryRally ManagerRecce ManagerRecce AppRecce SettingsRally Settings ManagerSnap-to-RoadTraffic Exclusion ZonesRally UtilityRally Vehicle CaptureRally Vehicle Tracker
Rally Loop PenaltiesRally AttemptsRally Event LogRally Loop ManagerRoad Section Penalty KeeperRally Schedule UtilitiesSpeeding DetectorStaged Countdown TestStaged Countdown Utilities

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 Extensionsgameplayrallyloop

Road Section Penalty Keeper

Class-based tracker for rally liaison route deviation penalties. Monitors route recalculation frequency and applies escalating time penalties when the driver deviates from the prescribed road section

Class-based tracker for rally liaison route deviation penalties. Monitors route recalculation frequency and applies escalating time penalties when the driver deviates from the prescribed road section route too often.


Constructor

local RoadSectionPenaltyKeeper = require('gameplay/rally/loop/roadSectionPenaltyKeeper')
local keeper = RoadSectionPenaltyKeeper(manager)

Public API

MethodSignatureReturnsDescription
init(manager)nilStores manager reference, initializes counters
reset()nilResets recalc and violation counters to zero
registerRecalc()nilIncrements recalculation counter
createPenaltyData()tableCreates structured penalty data for current violation
onUpdate()booleanPeriodic check: triggers penalty if threshold exceeded

Internals

Configuration Constants

ConstantValueDescription
RECALC_TIME_WINDOW10Seconds between periodic checks
RECALC_THRESHOLD5Max recalcs allowed per window before penalty
MAX_VIOLATIONS1Maximum violations before penalties stop escalating
PENALTIES{30, 60, 120, 180}Escalating penalty amounts in seconds

Penalty Escalation

Violation #Penalty
1st30 seconds
2nd60 seconds
3rd120 seconds
4th+180 seconds

Penalty Data Structure

{
  type = "liaison_deviation",
  amount = number,       -- escalating penalty amount
  data = {
    violationNumber = number,
    recalcCount = number
  }
}

How It Works

  1. External code calls registerRecalc() each time the route is recalculated (player went off-route)
  2. onUpdate() runs on a 10-second interval (using manager.clock)
  3. If recalc count exceeds threshold (5) and violations are under max (1), calls manager:recordRouteRecalcPenalty() with escalating penalty
  4. After creating a penalty, resets recalc counter to begin a new monitoring window

Usage Example

local RoadSectionPenaltyKeeper = require('gameplay/rally/loop/roadSectionPenaltyKeeper')
local keeper = RoadSectionPenaltyKeeper(loopManager)

-- When route recalculates (player deviated)
keeper:registerRecalc()

-- Called each frame by the loop manager
keeper:onUpdate()

-- Reset when entering a new road section
keeper:reset()

See Also

  • Rally Loop Penalties - Related reference
  • Rally Attempts - Related reference
  • Rally Event Log - Related reference
  • Gameplay Systems Guide - Guide

Rally Loop Manager

Core manager class for rally loop gameplay. Orchestrates the entire rally event: mission sequencing, schedule calculation, wall clock / epoch time management, time control penalties, timecard recordin

Rally Schedule Utilities

Pure utility functions for rally loop scheduling and time calculations. Provides minute-boundary rounding, slot size conversion, and time comparison helpers.

On this page

ConstructorPublic APIInternalsConfiguration ConstantsPenalty EscalationPenalty Data StructureHow It WorksUsage ExampleSee Also