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 Event Log

Class-based event logger for rally loop gameplay. Records all events (timecards, penalties, recoveries, flips) and maintains aggregated totals. Events are grouped by `eventGroup` for per-stage queryin

Class-based event logger for rally loop gameplay. Records all events (timecards, penalties, recoveries, flips) and maintains aggregated totals. Events are grouped by eventGroup for per-stage querying.


Constructor

local RallyEventLog = require('gameplay/rally/loop/rallyEventLog')
local log = RallyEventLog()

Public API

MethodSignatureReturnsDescription
addItem(event, timestamp, type, data)nilLogs an event item; recalculates aggregates
getItemsByEventGroup(eventGroup)tableReturns items for a specific event group
getAllItems()tableReturns all logged items
getItemsByType(type)tableFilters items by type string
getStageTimes()tableReturns items that have stageTimeSecs in their data
getTotalPenalty()numberSum of all penalties (time_control + recovery + flip)
getTotalStageTime()numberSum of all stage times
getTotalTime()numberStage time + penalty total
getPenaltySummary()tableGrouped penalty breakdown by eventGroup and penaltyType
clear()nilRemoves all logged items

Internals

Item Structure

{
  timestamp = number,       -- rally epoch time
  eventId = string,         -- e.g., "TC1", "SS1_start"
  eventGroup = string,      -- e.g., "SS1", "TC1", "SERVICE"
  type = string,            -- "timecard", "penalty", "recovery", "flip"
  data = table              -- type-specific payload
}

Aggregation

On every addItem, the log recalculates:

  • totalPenalty: sums penalty.data.amount + recovery.data.penaltyAmount + flip.data.penaltyAmount
  • totalStageTime: sums data.stageTimeSecs from any item type
  • totalTime: stageTime + penalty

Penalty Summary

getPenaltySummary() returns a structured breakdown:

{
  totalPenalty = number,
  groups = {                -- ordered by first occurrence
    {
      eventGroup = "TC1",
      totalPenalty = number,
      penalties = {         -- sorted alphabetically by type
        { type = "time_control_late", count = 1, amount = 30 },
        { type = "recovery", count = 2, amount = 240 }
      }
    }
  }
}

How It Works

  1. Events are added via addItem(event, timestamp, type, data)
  2. Each item is stored in a flat array and indexed by eventGroup
  3. Aggregates are recalculated on every insert (denormalized for performance)
  4. Penalty types recognized: penalty (with amount), recovery (with penaltyAmount), flip (with penaltyAmount)
  5. Stage times come from any item with data.stageTimeSecs

Usage Example

local RallyEventLog = require('gameplay/rally/loop/rallyEventLog')
local eventLog = RallyEventLog()

-- Log a time control penalty
eventLog:addItem(event, epochTime, 'penalty', {
  penaltyType = 'time_control_late',
  amount = 30,
  checkpointLabel = 'TC2'
})

-- Query totals
local totalTime = eventLog:getTotalTime()
local summary = eventLog:getPenaltySummary()

See Also

  • Rally Loop Penalties - Related reference
  • Rally Attempts - Related reference
  • Rally Loop Manager - Related reference
  • Gameplay Systems Guide - Guide

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.

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

On this page

ConstructorPublic APIInternalsItem StructureAggregationPenalty SummaryHow It WorksUsage ExampleSee Also