Log inGet started
Package

RaceAI.component

Newest version

README.md

RaceAI

An AI racer for a kart. It adds an aiDrivers AiDriver to the kart and races with it: the AiDriver steers and works the pedals of the very same vehiclesKit kart a person drives (through Vehicle:setIntent), while RaceAI decides when it may go (held on the grid until GO), which personality it races with, when it fires items, where it aims to grab item boxes, and how hard it pushes (rubber-banding). When a person takes the driver's seat the AI stands down, and it takes the kart back when they leave.

It goes on a vehiclesKit kart root alongside vehiclesKit.Vehicle and racingKit's Racer, and adds aiDrivers.AiDriver itself if the kart has none. It follows the RaceTrack's racing line and reads the race state from the RaceDirector; personalities come from the drivers module. Racing.kart(track, { ai = "aggressive" }) and Racing.race add it for you.

Fields

  • personality: careful, aggressive, itemHappy or rubberBand.
  • driverName: the name shown in the standings; empty picks one from the personality.
  • showLine: debug: draws this driver's own line.

Methods

  • name(): the name this AI races under.
  • describe(): the personality's label and blurb.
  • driver(): the AiDriver doing the driving (nil until it races).