Demo Race Scenario

In this tutorial, you will learn how to create a simple race scenario.

Step 1: Prerequisites

For this example you need to download demo_race.zip from here Download and extract the files to: C:\Users\<USERNAME>\Documents\BeamNG.drive\levels\GridMap\scenarios. In this Tutorial we are using the GridMap level but you can use whatever level you like.

1.1. Open ‘C:\Users\<USERNAME>\Documents\BeamNG.drive\levels\GridMap\scenarios\demo_race\template.json’ with a text editor of your choice. In this file you can change the following properties:

  • name: The name of the scenario.
  • description: The description of the scenario.
  • authors: The authors of the scenario.
  • difficulty: The difficulty of the scenario (0 to 100 where 0 is simple and 100 is hard).
  • date: The creation date of the scenario (unix timestamp).

1.2. (Optional): If you want a custom display image, you can replace ‘C:\Users\<USERNAME>\Documents\BeamNG.drive\levels\GridMap\scenarios\demo_race\template.jpg’ by any image you want.

1.3. Launch BeamNG.drive, in the main menu click on ‘Scenarios’ and start the scenario you have just created.

1.4. Open the world editor by pressing F10. In the menu bar click on ‘Tools’ and then on ‘Race/Path Editor’ to open the Race Tool.

1.5. In the Race Tool click on ‘File -> Load…’ and open ‘\levels\GridMap\scenarios\demo_race\template.race.json’. After that click on ‘File -> Clear’ to remove the predefined Race.

Step 2: Creating the Race

2.1. Find a nice place for your race and add waypoints by pressing Shift + Left Mouse Button and moving the mouse. Each waypoint is automatically connected to the previous waypoint.

2.1.1. (Optional) If you want a continous racetrack with multiple laps you can add a segment by clicking on ‘Segments’ and then on ‘Create’. Now change ‘From’ to the last Pathnode and ‘To’ to the first Pathnode.

2.2. Now click on the ‘Start Position’ tab in the Race Tool and add a start postion by by pressing Shift + Left Mouse Button and moving the mouse.

2.3. Click on ‘File -> Save’ and save the race in ‘\levels\GridMap\scenarios\demo_race\template.race.json’.

Step 3: Scenario properties

Click on ‘File -> Open’ in the flowgraph editor and open ‘\levels\GridMap\scenarios\demo_race\template.flow.json’.

Step 3.1: Start- and End Screen

To change the title and description of the of the start- or end screen search for the Start-/End Screen node and select the String node connected to the title or description field. The text can be changed in the properties tab on left.

../../../_images/title.png

Step 3.2: Player vehicle

Select the Vehicle Config Provider node and press ‘Load Models and Configs’ in the properties tab. Now you can change the model and the config of the player vehicle.

../../../_images/vehicle.png

Step 3.2: Number of laps

Search for the File Race node and select the Number node that is connected to the lapCount field.

../../../_images/laps.png

Step 3.3: Time to beat

You can specify what time the driver needs to beat to reach certain medals. For that click on one of the Compare nodes and change the value for B. If you dont want a time attack race, you can simply remove these nodes.

../../../_images/medals.png

Step 4: Save your work and run the Scenario

Click on ‘File -> Save’ in the flowgraph editor.