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

Rally Loop Penalties

Calculates time control penalties for rally loop events. Determines if a driver arrived early, on-time, or late at a checkpoint and computes penalty amounts (+10 per minute deviation).

Calculates time control penalties for rally loop events. Determines if a driver arrived early, on-time, or late at a checkpoint and computes penalty amounts (+10 per minute deviation).


Public API

FunctionSignatureReturnsDescription
M.calculateEarlyPenalty(minutesEarly)numberReturns minutesEarly * 10 penalty
M.calculateLatePenalty(minutesLate)numberReturns minutesLate * 10 penalty
M.getTimingStatus(actualTime, scheduledTime)tableEvaluates timing and returns status with penalties

Constants

FieldValueDescription
M.resetPenaltySeconds120Time penalty for vehicle reset (2 minutes)
M.flipPenaltySeconds15Time penalty for vehicle flip

Internals

getTimingStatus Return Table

{
  status = "early"|"on-time"|"late",
  totalPenalty = number,      -- sum of all penalty amounts
  hasPenalty = boolean,
  penalties = {               -- array of structured penalty objects
    {
      type = "time_control_early"|"time_control_late",
      amount = number,
      data = {
        minutesEarly/minutesLate = number,
        actualMinute = number,
        scheduledMinute = number
      }
    }
  }
}

Timing Logic

  • Converts both times to integer minutes via math.floor(time / 60)
  • Early: actualMinute < scheduledMinute → penalty = |diff| × 10
  • On-time: actualMinute == scheduledMinute → no penalty
  • Late: actualMinute > scheduledMinute → penalty = diff × 10
  • If either time is nil, returns "on-time" with zero penalty

How It Works

  1. Both actual and scheduled times are epoch seconds
  2. Integer minute comparison determines early/on-time/late
  3. Penalty is 10 seconds per minute of deviation (both early and late)
  4. Structured penalty data includes i18n-friendly fields for UI display
  5. Constants provide fixed penalties for reset (2 min) and flip (15s) events

Usage Example

local Penalties = require('gameplay/rally/loop/penalties')

-- Check arrival timing
local result = Penalties.getTimingStatus(actualEpochSecs, scheduledEpochSecs)
if result.hasPenalty then
  log('W', '', 'Penalty: ' .. result.totalPenalty .. ' (' .. result.status .. ')')
end

-- Access penalty constants
local resetPenalty = Penalties.resetPenaltySeconds  -- 120
local flipPenalty = Penalties.flipPenaltySeconds     -- 15

See Also

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

Rally Driveline Utility

Utility constants for the rally driveline spline system. Provides default values for spline width, RDP simplification tolerance, and subdivision parameters.

Rally Attempts

Creates and saves mission attempt records for rally loop completions and DNFs. Integrates with the mission progress system to record timing data, vehicle info, and stage times.

On this page

Public APIConstantsInternalsgetTimingStatus Return TableTiming LogicHow It WorksUsage ExampleSee Also