AI features

(AI lines and checkpoints)

Introduction

This tutorial will show you how to use the AI features of SnakeDitor (AI line and checkpoints).

To start it, you just have to load the 'tuto_ai_1.snr' file in SnakeDitor. This file is delivered with this documentation.
It is the file that was used in the hmap tutorial.

Track at the beginning of the tutorial, viewed in the layout tab

We will start this tutorial by setting the start position of the race.
Drag the 'start' flags to get the next display:

You can see that the start areas are rotated automatically, and how the width of the full area is adjusted.

AI lines

Now it is time to go the 'AI feature' tab.
You should obtain the next display:

We must initialize the main AI line and the pit AI line with our layout. So first of all, click on the button:

This button generates automatically the next 2 lines. It creates 1 point per corner, except if the corner is too small. You should obtain the next display:

To get more precision, you have to insert new points on the curve. You have to push the next button:
An easier method is just to press the SHIFT button: the previous button is pushed automatically.

While the button is pushed, you can click near the AI line, and a new point is added. The point is added on the selected AI line.
After addind several points, you should get the next display:

Now, we will adjust the control points of these bezier curves. You can drag the center of the control point, or the tangential control points.
Normally, the tangents are aligned, but it is possible, by pressing the ALT key, to move only one tangential point:

Non-aligned tangent with ALT key

Then, you have to adjust all the points to get the best trajectory.
You have to adjust the pit AI line too.

You should have notice the red point at the start of the track. It is the start of the AI line. It is pointed by the AI player at start time. This is displayed in Track Editor with a red segment:

You can drag it to choose the correct position.

After updating all these data, you should get something like that:

Checkpoints

Now, we will set the checkpoints.
To see them, you have to push the next button:

Like for the AI line, we can initialize automatically these checkpoints. You just have to click on the button:
You should obtain the next display:

Then, you can insert new checkpoints with the method already used for inserting control points in AI lines. Push the same button, or simply press the SHIFT key.

You can select a checkpoint by clicking on the red point, in the center of each checkpoint. When it is selected, you can move it by dragging the center. You can set a left width different from the right width. It is very useful for the checkpoint that must cover the main road and the pit lane.

The checkpoint that is at the start of the track can't be moved, because it position is set by the 'start' flag already seen in the 'layout' tab.

After that, you should obtain something like that

Evaluation

The track is now ready to be tested in GeneRally.

SnakeDitor was developped to allow user to swap to GeneRally very easily. You just have to check that your configuration is correct.

Open the configuration dialog box, with the next button:

and check that the path to GeneRally is correct:

  • The first field must contain the path to the executable of GeneRally,
  • the second field must contain the directory of GeneRally,
  • the third field is updated automatically

When the configuration is ok, you can launch the export with a button in the main toolbar, or just by pressing CTRL+E (E=Export).

Verify that the 'GeneRally' option is checked:

Then click on the 'Ok' button.
Windows will swap to 'GeneRally'. If no instance is already opened, a new instance will be launched.

In Generally, select your track, choose a single AI player, with the car you want. Select only 2 laps.

Now, press ENTER 1 time to load the track, and press ENTER again to start the race.

As you select only 1 player, and as it is an AI player, it starts alone the race. Wait for the end of the race. The second lap is much more interesting than the first lap to get a representative ghost.

At the end of the race, GeneRally shows you the time of each lap. Press ENTER to return back to 'Main Menu' of GeneRally (see previous screenshot).

Now, it is time to come back to SnakeDitor. Just press ALT+TAB 1 time.

Activate the "AI line" mode with the button:

In this mode, you will import the ghost lap of the AI driver, by clicking on the button 'ghost 1', or by pressing CTRL+G (G=Ghost):

The display should look like the next display:

The red line shows the ghost lap. Now, you can see where the ghost can be improved. So you can modify the AI line, and go again into geneRally to check it.

By using shortcuts, swapping from GeneRally and SnakeDitor can be done very quickly:

  • press CTRL+E: show the export dialog box
  • press ENTER: goto GeneRally
  • press ENTER: load the track
  • press ENTER: start the race
  • Wait until the end of the race
  • press ENTER: come back to the 'Main Menu' of GeneRally
  • press ALT+TAB: come back to SnakeDitor
  • press CTRL+G: import the new ghost

Then, you can do this again and again until you feel that you can't improve the AI line.

If you are a good driver, you could register your own ghost in GeneRally. Then you should import it in SnakeDitor by using the button:

Your ghost will appear in blue. Then you could try to modify the AI line to get AI ghost (red line) as closed as possible as your ghost (blue line).

Getting a very fine AI line is difficult and should be done after adding objects, especially kerbs, because AI players should be disturbed by them if they cut too much the corners.
The heigh map has a strong impact too on the trajectory.

Conclusion

I feel that you understand how to set the AI line and the checkpoints, and how easy it is to modify them.

Enjoy