Log inGet started
World

Apex Raceway: Race Tracks, Laps and AI Rivals Kit

Branchmain
Branchesmain
Commit068099240e

README.md

RaceDirector

Runs races on a track. The peer that owns its entity is in charge: it keeps MatchFlow's player list in step with who races which kart (a person in the driver's seat, otherwise the kart's AI driver), numbers each race, publishes live standings for every screen, and closes a race a while after the first finisher, placing everyone still running by how far they got. MatchFlow (format race) brings the traffic-light countdown, the shared race clock, the finish order and the results screen. On every peer it seats that peer's own player in a free kart between races and answers phase, standings and roster questions for the HUD, the racers and the AI.

It goes on a synced entity and needs a MatchFlow entity named Match (or the name in match) in the scene, a RaceTrack, and karts carrying Racer. Racing.race in the api module creates all of it, with a RaceHud on the same entity.

Fields

  • track: name of the RaceTrack entity; empty takes the first track.
  • match: name of the MatchFlow entity that runs the race flow (default Match).
  • laps: laps per race; 0 takes the track's own setting.
  • finishTimeout: seconds after the first finisher before the race closes.
  • autoSeat: between races, sits each player who is not in a kart in the first free one.
  • raceNumber: counts races, going up as each countdown starts (written by the machine in charge).
  • roster: who races which kart next, "slot|id|name|kind;..." (written by the machine in charge).
  • standings: live standings, best first, in the progress module's standings format (written by the machine in charge).

Methods

  • phase(): MatchFlow's phase: waiting, lobby, countdown, playing, results or intermission.
  • getMatch(): the MatchFlow component running the race flow.
  • isAuthority(): whether this machine is in charge of the race.
  • getLaps(): laps per race.
  • getRaceNumber(): the race number.
  • rosterFor(slot): who races grid slot slot this race, { slot, id, name, kind }.
  • getStandings(): live standings, best first.
  • placeOf(id): place (1-based) and field size for racer id.
  • reportFinish(id): reports that racer id crossed the finish line (the kart's owner calls it).
  • start(): starts the next race now (any machine; the one in charge applies it).