Apex Raceway: Race Tracks, Laps and AI Rivals Kit
README.md
api
The front door of racingKit. A scene's build calls it to draw a curve, lay a closed race track along it and stand a whole race up on that track (MatchFlow race flow, RaceDirector, RaceHud, karts with AI drivers, item boxes) in a few lines. It wraps the sibling modules (geometry, surfaces, gates, drivers, registry, progress) and adds the RaceTrack, Racer, RaceAI and RaceDirector components for you.
local Racing = require("racingKit.api")
local curve = Racing.curve("MyCurve", { {0,0,0}, {90,0,-10}, {110,0,-80}, {20,0,-95} })
local track = Racing.track(curve, { surface = "asphalt", gates = "arch", width = 12, laps = 3, checkpoints = 8 })
Racing.race(track, { karts = 4, ai = { "careful", "aggressive", "itemHappy", "rubberBand" }, itemBoxes = 3 })
Functions
curve(name, points, opts?): spawns an entity whose children are the curve's control points, as small markers you can move in the editor (hidden in play;opts.markers = falseskips them,opts.parentparents it). Returns the entity.pointsOf(curve): world points from a point list ({x,y,z} or vectors), a curve entity or its name, or a table withpoints.track(curve, opts?): builds a closed track along the curve and returns the track entity with its RaceTrack. Options:name,surface,gates,width,laps,checkpoints,showRacingLine,labels,barriers,reverse,gridSlots,synced,parent.trackOf(track?): the RaceTrack component of a track entity or name, or of the first track in the scene.setSurface(track, surface): switches a track's surface with one word (rebuilds on every peer).setGates(track, style): switches a track's gate style with one word.kart(track, opts?): a vehiclesKit kart on grid slotopts.slotwith a Racer, plus a RaceAI whenopts.ainames a personality. Options:slot,ai,name,paint,look,track,driverName. Returns the kart.itemBoxes(track, rows?, opts?): rows of 3-4 synced pickupsKit mystery boxes spaced round the lap. Returns the pickup entities.race(track, opts?): a whole race: MatchFlow entityMatch(format race, traffic-light countdown, podium results), a syncedRaceentity with RaceDirector and RaceHud,kartskarts on the grid (people take free karts, AI races the rest byaipersonalities in slot order) and item boxes. Options:karts,ai,laps,itemBoxes,finishTimeout,countdown,results,look,hud,lobbySeconds,autoSeat. Returns the race entity.director(): the RaceDirector on this machine, or nil.surfaces(),surface(name): the six surface names and one surface's definition (label, grip, barrier, ...).gateStyles(),gateStyle(name): the five gate style names and one style's label and blurb.personalities(),personality(name): the four AI personality names and one personality's label and blurb.geometry,progress,registry: the sibling modules, re-exported;VERSIONis the kit version.