Track Preparation

There are a few hot keys in the AIW Editor, which help the creation process.

Important Notes

Entering the AIW Editor

Launch the game in DevMode, load the track, enter the track and enter the AIW Editor by clicking menu item.

The AIW Editor main menu appears

Recording Paths

Make sure that you followed the above guidelines and prepared the track for AIW creation. Drive a few laps around the track and test that it works correctly and all parts of the track are driveable.

Main Path

The main path is the path which follows the track centre line. This is the first thing we lay down.

Drive out on the track facing in the racing direction. Orient the car so it is in the middle of the width of the track. Switch to Swingman camera (PageUp).

Click “record a path” button in the menu and move mouse cursor out from menu area.

This starts recording process. Drive slowly around the track, being careful to keep the car in the middle of the track as best as possible.

You can see red plus signs placed behind you on the path you are recording.

Eventually, as you are nearing a complete lap, you will see very first waypoint icon placed at your start position. Aim for it as you drive up to it. When you cross over it, the menu will change.

You will be asked what path it was that you just drove.

Select “add new path as main”.

Then save waypoints.

You now have a new AIW file which contains the main path. Next, we need a pit path.

Pit Path

Now that the main path is placed, you should add a path that defines the pitlane.

Drive the car to the location, around 100 or 200m before where the car would exit the racing line and turn to enter pitlane.

Important

Please start comfortably BEFORE the AI leaves the fast path, and finished comfortable AFTER the AI should rejoin the main path. This way the AI will not violently swerve off the racing line.


Click “record a path” and drive through the pitlane to the location where car would enter the racing line again.

Make sure that you keep the car on fast lane when driving through pitlane.

When you reach the point around 100 or 200m after where you are entering the racing line again, stop the car and click “press to stop” button.

Then assign this new path as a pit path by clicking “add new path and mark as 1st pit”.

Save waypoints.

Exit the track (ESC), leave the track (leave track – button) and reload it again. Enter the track and AIW Editor.

Connecting the pit path to the main path

Next, we need to connect the pit path to the main path. This is done by making a branch on both ends of the pit path to the main path.

Drive to beginning of the pit path. Box-select with mouse the first waypoint of the pit path (drawing box around it). It turns to red and a new menu appears.

Next select a suitable waypoint from the main path.

On the menu, click “join as a branch”.

Then click “unselect all” in top of the menu.

Main menu appears. Save waypoints.

Next drive to the end of pit path. Select the last pit path waypoint and a suitable waypoint on main path. Click “join the branch”, “unselect all” and save the waypoint again.

Exit the track (ESC), leave the track (leave track – button) and reload it again. Enter the track and AIW Editor.

Pit Path Extension

Most oval tracks (and some North American road courses) have garages in the track’s infield area. This differs from typical European style race tracks where the pit building and garages are located right next to the pitlane.

In ovals, the physical distance between garages and pitlane is so big that the AI cannot find their way from the garages to the pitlane without the help of an additional path.

This path is called a “Pit Path Extension”.

The pit path extension is a path which goes in front of the garages and merges to the pit path. The AI will follow this path to the pit path, and eventually finds its way to the race track. The pit path extension is NOT mandatory. Record it only if the garages are physically far away from the pit path.

There are a few limitations for the pit path extension.

The pit path extension is a one-way path, so the AI can drive on it only in one direction. Because of this, the pit path extension must be designed in such a way that it passes all the garage spots, but goes only in one direction.

It is possible to have multiple pit path extensions and for them to connect to each other.

Recording pit path extension

Drive the car to the location where the pit path extension starts, facing in the driving direction.

Click “record a path

Start driving (slowly) along the designed extension path. You can see red plus signs placed behind you on the path you are recording. Stop at the location close to the pit path, but do not cross it.

Click “press to stop

Click “add new path and mark as extension of 1st pitlane

Save waypoints.

Next, box-select (with mouse) the last waypoint of the extension path and a suitable waypoint from the pit path (like we did with the pit path branches).

Click “join as a branch

Click “unselect all

Next, drive close to the first waypoint of the pit path extension.

Box-select (with mouse) the first waypoint.

Click ”cap end of path segment

Click “unselect all

Save waypoints.

Exit the track (ESC), leave the track (leave track – button) and reload it again. Enter the track and AIW Editor.

Corridors

Next, we are going to define corridors. There are a few types of corridors as described below:

Finding corridors is an automated process and usually takes only a few seconds.

Click “find corridors” in main menu.

Save the AIW.

Exit the track (ESC), leave the track (leave track – button) and reload it again. Enter the track and AIW Editor.

In general it is recommended to go around and optimize the corridors as soon as possible, to ensure that they have not given support roads etc as legal. You can find further information about this here: Track AI Tutorial (AIW)#Corridoradjustments

Cut Track / Track Limits Corridors

It is very important to make a pass and verify that that the “Cut Track” corridors are correctly configured. This should be done after you are happy with the main corridors which control how the AI races.

These can be controlled separately with their own functions.

As a rule, track limits should be set appropriately as follows:

Pit Locations

Next, we are going to define a pit stall for each team. A pit stall is the location where the car stops for service in pitstops.

Garages per Pit Location

Pit stalls are linked to garage spaces. The garage space is the location, usually inside garage building, where the car is parked when it is not on the track. A single pit stall can be shared between a maximum of 3 garage spaces.

We recommend that there are as many pit spots as possible on a track, reducing the number of garages per pit spot. This makes pit group ordering much easier with online races.

Click “unsupported/test options” in main menu.

Change the “# of Garage spaces per pit” value to the maximum required.

Go back to main menu and save the AIW.

Recording Pit Locations

Now we are ready to record pit spots.

It is recommended that we record all spots in one pass, so all auto-generated connections and lines will be generated at once. However if you must, you may just record a few temporary locations.

We want to make the recorded pit locations visible in game, so we can actually see that the location is recorded in the correct place.

Drive the car to the location, where you want your first pit stall to be recorded.

In the main menu, click “set grid/pit/garage locations

Click “add pit location

Click “record pit loc 1 (empty)

In game, a blue box appears around the recorded location.

Repeat the “drive to the location and click record pit location x”, until all pit stalls are recorded.

You can also use the hot keys (CTRL+ Shift+Arrow keys) to move car around on the pitlane.

Remember always move the mouse cursor out of the menu area when moving the car around with hot keys during recording any spots!

When you have finished recording all the pit spots, scroll down the pit locations menu and click “back”.

When you click “back”, you might see empty main menu. It is actually not empty, but scrolled down so all menu items are hidden on top.

Scroll/drag the menu up using the scroll button.

Save the AIW. When saving the file, the game complains about missing garage spots. Don’t worry, we are going to record them next.

When editing pit, garage or start locations after initial creation, you will need to "Delete Special Waypoints" from the test options menu, save the AIW, reload the track and save the AIW again to regenerate the connections.

Garage Locations

Garage locations are the spots, usually inside garage building or tent, where the car is parked when it is not on the track.

As we setup one garage location per pit spot earlier in pit stall recording stage, we need to record same amount of garage locations as we recorded pit spots.

The recording process for the garage locations is exactly the same as the pit locations.

To make the recorded garage spots visible in game, go to show/hide menu and click “show garage spots” and then “back”.

In main menu, click “set grid/pit/garage locations

Click “add garage location

Drive the car (or use hot keys to slide the car) to the location (facing out), where garage spot should be recorded.


Click "record garage location 1 (empty)"

The game will show a garage spot number (rather than a box).

Repeat the “drive to the location and click record garage location x”, until all garage locations are recorded.


When you have finished recording all the garage spots, scroll down the pit locations menu and click “back”.

Again, when you click “back”, you might see empty main menu. It is actually not empty, but scrolled down so all menu items are hidden on top.

Scroll/drag the menu up using the scroll button and save the file.

Driving Lines

The driving lines are used as a base guide to help the AI navigate around the track. There are 4 types of driving lines which we will record.

There are tools for improving all driving lines in the AIW Editor. Those tools are intended for use after we have complete and fully functional AIW file, not at this stage of AIW creation process.

More information can be found in the section "Track AI Tutorial (AIW)#Improving driving lines".

Recording fastest path

The best way to create the “fastest” path is to drive it as if you were actually racing the track. The key here is to be smooth, but fast. Do not over-drive the car, slide it around considerably or lock the brakes.

To begin, just start driving the track to warm up the tires and get the feel for it.

Once the track is reloaded, the next thing we need to do is smooth out the fast path on the start-finish line. Often the 'start' and 'end' points of the path don’t line up linearly, and so will cause a kink in the racing line. This kink makes the AI hit the brakes at the start-finish line, ruining their lap times and smooth racing.

To fix that:

Recording left path

The left path is recorded in exactly the same way as the fast path. The left (or right) path does not have to be driven at full speed, but in same way as the main path. Concentrate more on car location at left side of the track.

Left and right paths are also used by the AI on formation laps. Make sure that there is enough room between the paths, so AI do not collide with each other during the formation lap(s).

Recording right path

Right path is recorded exactly same way than left path.

Recording block path

The block path’s nature is similar to the fast path. But this time drive the lap around like someone is trying to overtake you. Drive a defensive line, but as fast as possible. Don’t expect the lap time to be as quick as when you are driving normal racing line.

The block path is also used when the AI drives against other AI (not only against the player). That’s why it is good practice to put the same effort to create the block path as you did on the fast path, to get the best possible racing experience against the AI.

There are a few rules of thumb for a good block path which gives a good driving experience against the AI.

The block path is not mandatory for a fully functional AIW file, but we recommend that it is added. It will improve the AI racing and the player racing experience against AI a lot.

By default, block path is not available in the editor. So, let's add it first.

At this point it is a good time to smooth out pit in- and pit out branches to the fast path. If the branches are not smooth and “seamless” to the fast path, the AI cars will brake heavily and might do weird steering movements before entering the fast path.

As you can see, the pit path does not match to the fast path seamlessly.

Box-select the first few waypoints of the pit path with the mouse. Move the mouse cursor out from the AIW editor menu area!

Start adjusting (using SHIFT+Arrow keys) the selected waypoints' location so that they meet the fast path. You might want to adjust swingman camera angle more to top view, to help see better when adjusting.

Match the first pit path waypoint exactly on top of the fast path. Then continue adjusting other pit path waypoints so that the transition is smooth to the pitlane.

Try using the path smoothing tools to get the line smoother, any imperfections will result in AI braking too much on pit entry.

When unselecting waypoints, it might be a good idea to use waypoint menu “unselect all” function, to avoid accidentally moving other (accidentally selected) waypoints.

When you have finished adjustments, the end result should look something like this:

Recording Special Slowdown Spot

Next, we need to define “Special Slowdown” waypoint. Special Slowdown is typically the waypoint just before the pitlane officially begins. In track art, this is the point where pitlane speed limit starts and usually it is marked with white or yellow line and speed limit sign. When the AI sees this waypoint, they know they HAVE to brake and get their speed down to the pitlane speed limit.

Recording Teleport spot

The next waypoint to select and mark will determine the “Teleport Spot”.

This is the location all the cars will jump to if you skip the formation lap. This should be a good distance away from the start-finish line, and if possible not in the middle of a corner. You want the cars to be about 5 seconds after spawning here to be reasonably close to the S/F grid, but not to have crossed the Start Finish line yet. 

The rolling start will only work if the lap distance is beyond 75% and they have not crossed the S/F yet.

Recording Aux locations

Aux locations are safety car locations. We will need two of them. One location where safety car is parked in the pitlane during the race, and the other where the safety car is located at the beginning of the formation lap(s).

Recording grid locations

We have two grid types in rF2 - the main grid and alternative grid. The main grid is used for standing starts and the starting location for formation lap(s). The alternative grid is used for starting point of formation lap(s) and rolling starts, like in NASCAR or Endurance type racing. From this grid cars start formation lap(s) behind the pace car, and finally do rolling starts of the race. 

The main grid is always located on the race track, typically on the main straight. The main grid is mandatory for a fully functional AIW file. The alternative grid can be located on either the pitlane or race track. The alternative grid is not mandatory, but it is good to have it in so that the track supports all kinds of race start choreographies. The use of the alternative grid can be configured in the GDB file.

Before we start recording the main grid, it is a good idea to make the grid locations visible in game. To do that:

Now to record the positions:

Recording alternative grid locations

Recording alternative grid locations is done in exactly the same way as the main grid locations. 

Make alt grid locations visible in game:

Now recorded alt grid locations are visible in game.

Automatically Generating Grid Positions from Front Row

Usually, all grid locations are recorded manually based on track art. However in the AIW Editor, there is an automated option to generate grid and alternative grid locations too.

Let’s have a look at the automated process.

Next,

Alternative grid generation works exactly same way.

Note with NASCAR type ovals, you can choose “Auto altgrid follows pit” – option in “unsupported/test options” menu, before recording first two alt grid locations. Then the grid follows pit path instead of main path.

When done, save the waypoints, exit the track (ESC), leave the track (leave track – button) and reload it again. Enter the track and AIW Editor.

Simulate fuel usage

Next, we need to simulate the AI cars' fuel usage. We must use Skip Barber car for this. Otherwise calculations won't be correct.

When the track is loaded and you have entered the AIW editor, save waypoints one more time. This ensures that all auto-generated elements have been handled properly. Now you have a fully functional AIW file ready for testing.

Troubleshooting

While testing it, you might find that the AI behaviour needs adjustments.  The following sections give information on how to do this.

Corridor adjustments

With corridor adjustments, we can prevent the AI using certain parts of the track (eg cutting corners too aggressively) and guide them to use preferred driving lines. 

First, we need to make the corridors visible in game.

Now the corridors are visible in the game.

Corridors are colour-coded.

Adjusting the corridors can be done by selecting waypoint(s) and using the following hot keys:

Here is an example of adjusted left-side and right-side corridors.

Please notice the red lines (=illegal driving surface) are adjusted on the track side. Only a narrow “gate” on the track remains as a legal racing surface.

This means the AI always tries to drive through that narrow “gate”, and does not use the full track width.

Prevent AI from driving on Curbs

In this case, the AI tries to cut the curb too aggressively. The AI car hits the sausage curb too hard and loses control at chicane exit.

To prevent that happening, let’s adjust the corridors in such a way that the AI does not hit the sausage curb.

Please notice, that the right-side corridors have been now adjusted inwards. Red lines (=illegal racing surface) are partially over the curb, which prevents the AI car hitting the yellow sausage curb again. Now, when the AI drives through this chicane, the car stays under control all the time without spinning at the exit.

ALWAYS remember to click “unselect all” after adjusting. Waypoints never unselect themselves. If you have made some adjustments at some part of the track and move on to next, the previous waypoints are still selected, when you select new waypoints. If you do any adjustments then the previous waypoints will get adjustments as well.

Oval Aprons

On ovals, it is generally good idea to make the apron an illegal racing surface otherwise the AI tends to use the apron for overtaking. If the front AI car keeps the inside line, the challenging AI car behind tries to overtake through the apron. This can lead to unnecessary crashes, because the AI might lose control when moving from a high-banked racing surface to a low-banked apron.

The apron is an illegal racesurface anyway, but the Editor’s “find corridors” – function cannot see any difference between the apron and the racesurface. Just like it cannot see any difference between asphalted run-off areas at road courses. (Unless they use different materials with illegal setup in the TDF file.)

Please notice, that the pit path has its own corridors. So, you can adjust main path corridors safely all around the oval without affecting pitstops and paths to the pitlane.

Reducing Side by Side action

Another AI issue which can be fixed with corridor adjustments is when the AI try to squeeze themselves two- or even three-wide into a narrow place on the track causing major crashes. These kind of places can be narrow chicanes, very tight and narrow hairpins and so on. For example, Formula E tracks or Monaco – type street tracks are overall pretty narrow with tight corners. Like here in Monaco chicane, there is no way that AI survives through the chicane without crashing, if we do not prevent them going two- or three-wide in the corner.

On the left-side, corridors are adjusted inwards (red lines). This “strangles” legal racing surface just enough so that there is room for two AI cars, which will get through the chicane without crashing.

The three-wide situation never happens, because the legal racing surface is not wide enough for three cars.

When adjusting corridors to make the AI behave in the situations mentioned above, we might cause false track cuts in legal areas if the player drives there. Recent improvements to the AI editor allow you to edit the cut corridors and AI corridors separately with more confidence, however it is still necessary to check the cut corridors after making changes.

Driving lines for different type of racecars

Although most cars with similar characteristics can use the default racing line you created, sometimes other cars may have issues with it and not drive to their full potential.

A good example is Spa Eau Rouge. If you make the fast path with a quick open-wheel car, lower downforce GT cars probably cannot survive that corner without crashing.

In this case you can create a unique racing line for certain car types. This line is referenced in the talent file for each car, and those cars will use that line.

To create a unique path follow the procedure outlined above when you created the BLOCK line. This time though, give the line a name you can recognize for that car. In the case of the Skip Barber you might use something like, “Skippy_RacingLine”.

Select the line as the “visible/actionable” line, click “record new best path”, and race the track using the car in question. When you’re happy, stop recording and “save waypoints”.

Now, from the main waypoint menu click “Edit Driver Stats”. You’ll want to select “default” as the driver at the top of the Driver Edit menu.

Now, for “current path”, select the path you recorded, and then save waypoints. The AI will now use this alternate racing line when they are driving the car in question.

Improving driving lines

Sometimes the recorded fast path is not as smooth as it could be on corners and this affects the AI's performance on track. We can debug and fix these issues (to a certain point) in the AIW Editor to improve AI behaviour as long as the path is reasonably good.  (These tools cannot fix a fast path which is fundamentally bad.)

Drive the car to the corner which you want to debug.

In this specific case and corner, once the radius is over 200m on all waypoints, we are good. Small differences don't matter once the corner radius opens up generally do not matter.

Finally, let the AI cars drive around the track and observe they have no issues with the corner, although make sure to test with both actual AI drivers and multiple car types.. 

This same method can be used for improving all driving lines, not just the fast path.

Often AI issues in races occur when there are problems on the Block Path, so make sure to check this too, by forcing the AI to drive it in the unsupported options menu.

Copying Lines from one Path to Another

Some times you make a small mistake on a path and just wish to redo a single corner, via driving rather than manual manipulation. This can be achieved by recording a new path and copying to it. 

(You have your fast path, with perhaps one corner that you aren't satisfied with)

  1. You then select "name new path", call the new path whatever you like, for example "t10fix".

  2. You then record and drive the lap, but this time the only thing that matters is nailing that one corner.

  3. Finish the lap and save the file.

  4. Now you go into the path sub menu, select your original fast path as "path (w)" and the new patch path as "path 2 (g)". You will now see the two paths overlaid together, w being white and g being green.

  5. Next, go to the problem corner and select all the main waypoints covering that corner. It's a good idea to start and finish marking waypoints from a point where the two paths are right on top of each other, or on a straight section which is easy to smooth.

  6. With all those WPs selected you should now see the "selected waypoint menu" (rF2 switches to this menu as soon as you have one or more waypoints selected).

  7. Open the "manipulations" sub menu and click "copy path 2 (g) onto path 1 (w)". You will now see the change where the paths have merged together!

  8. Now "deselect" all waypoints!

  9. The last thing to do is to look for any kinks at the beginning and the end parts of the path. These areas are pretty much guaranteed to need some smoothing, but the built in tools should work fine on straight sections of road.

Race Start

Rolling Start does not work, it says stay behind the Safety Car after it has pitted.

There are a couple of things to check for this. 

Pit Lane

After finishing a pit stop the AI tries to drive onto a support path

We have seen this happen a few times where the AI after finishing a pit stop tries to drive onto the support path which is behind the pit wall. To resolve this move your main pit lane waypoints closer to the pit spots, and readjust your driving paths and corridors of the pit lane. This should stop the AI from thinking the way point behind the pit wall is better for them.

Track Cutting

Detecting Pit Exit Cuts

In order for pit exit cuts to be tracked ensure that the AIW is configured correctly via Cut Corridors and Path Connections.

Firstly make sure that the cut track corridors are correct for both pitlane and main race surface, and in general ensure that the pit lane does not cover more area than the main race track unless it should - or this may result in false assignments to the pit path when it should not.

Note that sometimes the road can overlap the pit lane. Make sure this is appropriate. 

  Secondly check that there are no connections from the Pit Path to the Main Path where you do not want allow cars to join. In the image beneath they need removing. To view these show connections in the AI Editor.

These can be removed by deleting the branch from the pit path waypoint, but needs to be done one by one. The branches going through the cones in the image beneath should be removed.

In order for these connections to not be made automatically, ensure that your corridors and cut track boundaries are correctly configured. The game will not add them if the pitlane cut corridors do not go close enough to the opposite side of the race track. It does attempt to regenerate them each time you load an AI file in the AI editor though.

These are the correct branch connections: