Docs · Engineering reference
Racing
docs/features/racing.mdEdit on GitHub
LF_RaceCourse — Feature/Racing/LF_RaceCourse.c (#1922, 2026-11-16)
- ⚠️ Rules only, no world yet: a course is data (checkpoint ids, laps, fee, minimum entrants, lobby seconds, payout split); checkpoints count only in order, a shortcut is refused and logged, laps count, finish order is by time. Tests:
racing/course(LOGIC).
LF_RaceRunner — Feature/Racing/LF_RaceRunner.c (#1923, 2026-11-16)
- ⚠️ No start sign placed yet:
LF_RaceEntryAction(sign attributes: courses file and course id) takes the entry fee from carried cash into the pot, in full or not at all; the first entrant opens the lobby, which closes after the course's lobby seconds. Too few entrants refunds everyone. The server checks each racer against the nextLF_RaceCheckpointComponent(registered inLF_Placesby id, radius on the component) every 250 ms; when every racer still in has finished (or 15 minutes pass) the pot is paid by the split and the winner also takes the rounding and unfilled places. A disconnect forfeits the fee. The pot is session state: a session end refunds everyone still in before the shutdown save; a crash loses the fees. PublishesLF_OnRaceFinished. Each racer keeps the player id it was last seen as, checked with one uid compare per tick; only a miss scans the players, and an offline racer at most once a second (#2404: 16 lookups a tick for 16 racers on 128 players, was about 1,100). Tests:racing/runner,racing/racer-index(WORLD),perf/life-128.
LF_RaceCourses — Feature/Racing/LF_RaceCourses.c (#2006, 2026-11-16)
- ⚠️ Loader only, no world yet: the core ships no course.
LF_RaceCourses.Get()layers each pack overlay ofLF_RaceCoursesConfigin load order, then the owner'sracing.coursessection, through the shared override model (add, replace, patch, remove by course id);Find(id)returns the record. Every course goes throughLF_RaceCourse.IsValid; a bad row is logged ([LFDebug:Racing]) and dropped, never kept. The flagship course is pack data (#1927). Tests:racing/courses(LOGIC).
dirt_loop pack course — LF_Everon1989/Configs/Racing/LF_RaceCourses_Everon1989.conf (#1927, 2026-11-16)
- ⚠️ Data only, no world yet: the flagship's dirt loop is a pack course (
LF_RaceCoursesConfig, #791): five checkpoint ids (dirt_cp_1..dirt_cp_5, placed by the town card #1935), 3 laps, entry fee 50, 2 entrants minimum, 60 s lobby, payout 60/30/10. Listed as an overlay in the flagship mission header, soLF_RaceCourses(#2006) loads it andLF_RaceCourse.IsValidchecks it at boot. Proof:tools/validation/pack-race-course-selftest.mjs(a core Enforce test cannot name a pack file, validate-addon-boundary) checks the values, validity and the header line.
LF_RaceHud — Feature/Racing/LF_RaceHud.c (#1924, 2026-11-16)
- ⚠️ During a race each racer sees a panel with lap, next checkpoint, place and time; the server sends it to the racer's own client only when lap, checkpoint or place change. Tests:
racing/race-hud(LOGIC); two-player look manual.
Test race track — Worlds/GridWorld/GridWorld_Layers/Grid_race_track.layer (#1926, 2026-11-16)
- ⚠️ Debug-grid cell
c0r6, not a village track: a start sign (Props/Racing/LF_RaceStartSign.et, "Enter the race" on coursetest_track), three checkpoint posts (LF_RaceCheckpoint.et, idsrace_track_cp_1..3, radius 1.4 m), a cone and a tyre pile from base-game props (the base-game rally-tape prefab does not spawn in GridWorld, so tape is a follow-up), and the record board (Props/Roleplay/Racing/RaceRecordBoard.et, #2098) at the start line, where the plate stand-in stood. The core course fileProps/Racing/LF_RaceCourses_TestTrack.conf(fee 10, one entrant minimum, 20 s lobby, winner takes the pot) is loaded by the sign directly. Look:tools\cli look grid:race-track.
LF_RaceRecords and the record board — Feature/Racing/LF_RaceRecords.c, LF_RaceBoard.c (#1925, 2026-11-16)
- ⚠️ The record board prop
Props/Roleplay/Racing/RaceRecordBoard.et(#2098) carriesLF_RaceBoardReadActionand prints the titlegrid:race-records; it stands at the grid track's start line, and reading it shows the best times, e.g. ontest_track. The town pass (#1935) moves it into town. Test:racing/board-prop(WORLD). Each character's best time per course is kept, saved across restarts (payloadracerecords, save version 38).LF_OnRaceFinishedcarries every finisher (uid and time, in finish order, #2160) beside the winner fields, and each one offers a time: a first time is kept, a faster time replaces the record, an equal or slower one does not; a racer who left is not a finisher. The save format is unchanged. The board kindracerecords(LF_RaceBoardProvider, read actionLF_RaceBoardReadAction) answers with the top five per course, fastest first, painted as a card (course heading, then1. Name m:ss.t). Logs[LFDebug:RaceRecords]. Tests:racing/race-records(PERSISTENCE),racing/every-finisher(WORLD); restart proofwt e2e.
Checkpoint path after a respawn (life review, 2026-11-17)
- ✅ A racer's checkpoint path never joins two bodies. The tick kept the last spot while the racer had no living body, so the first tick after a respawn tested the line from where they died to where they woke and passed any checkpoint on it.
LF_RaceEntrant.Stepjoins the path to the last spot only for the same body, andLosestarts a new path after a tick with no living body. Test:racing/path-start(LOGIC). Review:docs/reviews/2026-11-17-life.md.
Race settle, lobby leavers, tick and course limits (life review #2406, 2026-11-18)
- ✅ One AFK or dead racer no longer holds every prize for the 15 minute limit. Two per-course config values (
m_iAfkGraceSeconds, default 60, andm_iSettleSeconds, default 120;0turns each off; owner file keysafkGraceSeconds,settleSeconds): a racer with no living body for the AFK grace is dropped (toast#LF-Race_Dropped, the fee stays in the pot) and the race settles for whoever finished; once the first racer finishes, the others get#LF-Race_Closing("ends in N s") and the race pays out that long after the first finisher, racers still out forfeit their fee to the pot (#LF-Race_TimeUp).LF_RaceRunner.TickAt(nowMs)runs one tick as of a given time (Tickcalls it with the world time),LF_RaceEntrant.AbsentTooLongandLF_RaceInstance.SettleDuehold the clocks. - ✅ A racer who leaves while the race is still in its LOBBY gets the fee back at once, to their bank (never the leaving body, so the disconnect save carries no duplicate), and an emptied lobby closes at once. In a running race a leaver still forfeits the fee to the pot.
- ✅ The 250 ms tick runs only while a race is RACING:
Detachstops it when no race is RACING, not only when no race exists at all (LF_RaceRunner.IsTicking). - ✅
LF_RaceCourse.IsValidrefuses a course whosem_iMinEntrantsis aboveLF_RaceRunner.MAX_ENTRANTS(16): it would take fees and always cancel. The owner-file reader range forminEntrantsfollows the same limit, and a negative AFK grace or settle delay is refused. Logs[LFDebug:Racing]. Tests:racing/afk-settle,racing/lobby-leave(WORLD),racing/limits(LOGIC).