3 Best Ways to Race with AI in BeamNG.drive


Scenario / Missions
ScriptAIAI path
UILike Racing GameN/AN/A
FlexibilityPrepared Race OnlyGoodGood

1. Scenario / Missions (Official / Mod)

Just select race scenario from [Main Menu]->[Scenarios].

You can enjoy scenario like below.

derby asphalt (Official Scenario)

If you want to use mod, search “Scennarios” category.

This is easiest way of racing in BeamNG.drive but you can play prepared scenario only.

If you want to race in more flexible situation, you can use next two way.

From v0.25, AI racing missions are available accross East Coast USA, West Coast USA, Italy and Utah.
Check out the official release notes for futher details.

2. Script AI

Script AI is official contents of BeamNG.drive.
By using this, you can record your driving, and make AI imitate that route and speed.

* You can set detailed AI driving.

* This is a really really time-consuming task.
* AI will just imitate your driving, so it is really complex when using multiple vehicle.

How to use Script AI

  1. Open world editor
    (press F11)
  2. Open Script AI Manager
    [Window] -> [Gameplay] -> [Script AI Manager]
  3. Click ● button of vehicle what you want to set AI
  4. Drive by yourself for recording
  5. Click ■ to stop recording
  6. Click ▶︎, and AI will try to imitate the recorded route
[Window] -> [Gameplay] -> [Script AI Manager]で開く

3. AI path command

This is a kind of “console command”, and you can make set AI as driving in designated path.

More about “console command”

* Easy to apply multiple vehicle(AI), because this is command.
* You can set some action like “avoid cars” and “drive in lane”.

* If you are professional of script AI, behavior of AI commands looks a little cheap.
* Searching path (waypoint IDs) is a bother.

How to use AI path command

1. Search path (waypoint IDs)

This command needs waypoint IDs.

You can search these IDs in the world editor which enabled Navigraph debugging.

It’s really bothering task, but I already searched some path.
You can use these from bottom of this page.

  • Some ID is mutable and different for each game launching.
  • You don’t have to search all ID.
    For example, if you want AI drive following path, ID1->ID2->…->ID-10, you can designate just like ID1->ID10.
    However, if there are many path, you should designate IDs that AI can understand unique path, or AI will use path which has less waypoint.

2. Create command

Command format:

ai.driveUsingPath{<parameters(see below table)>}
parametersmeaning and example
wpTargetListRequired. Set waypoint IDs.
e.g. {‘ID1’, ‘ID2’, ‘ID3’}
wpSpeedsSet speed of passing ID. Unit: [Mile/second]。
e.g. {ID1 = 10, ID2 = 20, ID3 = 30}
noOfLapsSet number of laps.
This parameter only working when wpTagerList is closed path like {‘ID1’, ‘ID2’, ‘ID3’, ‘ID1’}
e.g. noOfLaps = 3
driveInLaneWhether drive in lane or not. [‘on’/’off’]
e.g. driveInLane = ‘on’
avoidCarsWhether avoid other car or not. [‘on’/’off’]
e.g. avoidCars = ‘on’
aggressionSet AI’s drivability.
You can use between 0.3 to 1.0.
0.3: daily driving style, 1.0: Full speed
e.g. aggression = 1.0

Example command when using all parameter:

ai.driveUsingPath{wpTargetList={'ID1', 'ID2', 'ID3', 'ID1'}, wpSpeeds={ID1=50, ID2=60, ID3=40}, noOfLaps = 3, driveInLane = 'off', avoidCars = 'on', aggression = 1.0}

3. Execute Command

Just execute command from system console of BeamNG.drive.

More about “console command”

Appendix: Command Cheet Sheet

  • Please replace XXX, because these values are mutable and are different for each game launching.
  • These commands are tested on BeamNG.drive v0.25.0.1.

Hirochi Raceway

Circuit Full Layout

Starting Grid: Home Straight

ai.driveUsingPath{wpTargetList={'hr_start', 'DecalRoadXXX_10', 'DecalRoadXXX_21', 'DecalRoadXXX_30', 'DecalRoadXXX_40', 'DecalRoadXXX_50', 'DecalRoadXXX_60', 'DecalRoadXXX_70', 'DecalRoadXXX_80', 'DecalRoadXXX_90', 'DecalRoadXXX_100', 'hr_bridge1', 'hr_bridge4', 'quickrace_wp4', 'quickrace_wp11', 'hr_start'}, noOfLaps = 3, driveInLane = 'off', avoidCars = 'on', aggression = 1.0}


Starting Grid: Straight to the Hirochi Raceway sign

ai.driveUsingPath{wpTargetList={'derby_wp4', 'derby_wp5', 'derby_wp6', 'derby_wp7', 'derby_wp8', 'derby_wp9', 'derby_wp10', 'derby_wp11', 'derby_wp12', 'derby_wp13', 'derby_wp14', 'derby_wp15', 'derby_wp16', 'derby_wp17', 'derby_wp18', 'derby_wp19', 'derby_wp20', 'derby_wp21', 'derby_wp22', 'derby_wp23', 'derby_wp24', 'derby_wp25', 'derby_wp26', 'derby_wp27', 'derby_wp1', 'derby_wp2', 'derby_wp3', 'derby_wp4'}, noOfLaps = 3, driveInLane = 'off', avoidCars = 'on', aggression = 1.0}

Industrial Site

Road Track

Starting Grid: Home straight (clockwise)

ai.driveUsingPath{wpTargetList={'DecalRoadXXXXX_30', 'DecalRoadXXXXX_35', 'DecalRoadXXXXX_5', 'DecalRoadXXXXX_10', 'DecalRoadXXXXX_15', 'DecalRoadXXXXX_20', 'DecalRoadXXXXX_25', 'DecalRoadXXXXX_30'}, noOfLaps = 3, driveInLane = 'off', avoidCars = 'on', aggression = 1.0}

West USA

Street racing example

Starting Grid: Default spawn point.

ai.driveUsingPath{wpTargetList={'wpTown_6', 'wpTown_19', 'wpTown_2', 'wp_town10', 'wp_town11', 'wpTown_6'}, noOfLaps = 3, driveInLane = 'off', avoidCars = 'on', aggression = 1.0}

Circuit Full Layout

Start Grid: Home straight

ai.driveUsingPath{wpTargetList={'DecalRoadXXXXX_1', 'DecalRoadXXXXX_10','DecalRoadXXXXX_20', 'DecalRoadXXXXX_30', 'DecalRoadXXXXX_40', 'DecalRoadXXXXX_51', 'DecalRoadXXXXX_60', 'DecalRoadXXXXX_70', 'drag_6',  'DecalRoadXXXXX_86', 'DecalRoadXXXXX_95', 'DecalRoadXXXXX_105', 'DecalRoadXXXXX_115', 'DecalRoadXXXXX_125','DecalRoadXXXXX_135', 'DecalRoadXXXXX_145', 'DecalRoadXXXXX_155', 'DecalRoadXXXXX_160', 'DecalRoadXXXXX_1'}, noOfLaps = 3, driveInLane = 'off', avoidCars = 'on', aggression = 1.0}

Oval Track

Start Gird: Straight of entrance side. (counter clockwise)

ai.driveUsingPath{wpTargetList={'DecalRoadXXXXX_9', 'DecalRoadXXXXX_16', 'DecalRoadXXXXX_20', 'DecalRoadXXXXX_1', 'DecalRoadXXXXX_6', 'DecalRoadXXXXX_9'},noOfLaps = 3, driveInLane = 'off', avoidCars = 'on', aggression = 1.0}


Oval Track

Starting Grid: Straight on the center side of the MAP (counter clockwise)

ai.driveUsingPath{wpTargetList={'DecalRoadXXXXX_53', 'DecalRoadXXXXX_2', 'DecalRoadYYYYY_54', 'DecalRoadYYYYY_2', 'DecalRoadXXXXX_53'}, noOfLaps = 3, driveInLane = 'off', avoidCars = 'on', aggression = 1.0}

Please replace both XXXXX and YYYYY. (maybe different number)

Automation Track

Circuit Full Layout (with BUGs)

Some waypoints has bug and AI can’t avoid tire barrier.

ai.driveUsingPath{wpTargetList={'DecalRoad67316_2', 'DecalRoad67316_20', 'DecalRoad67316_40', 'bridge_dam_a', 'bridge_dam_b', 'DecalRoad67102_2', 'DecalRoad67102_3', 'DecalRoad67102_20', 'DecalRoad67102_40', 'DecalRoad67102_60', 'DecalRoad67102_80', 'bridge_pit_a', 'bridge_pit_b', 'DecalRoad67316_2'}, noOfLaps = 1, aggression = 0.6}