Making New .Lp Files:

Now this part can get tricky. Somewhere in the testing phase your computer might hang [although I have only had game crashes since I use Windy] so please, make sure you have no important tasks running on your computer when testing your .lp files.

Calculating The Number Of Records:

There are a number of tools available when you want to work with existing tracks and existing .lp files and we will use those along the way. But when making them from scratch things get a little harder. When it comes to AI behaviour the game cuts up the track in small parts and assigns a portion of every .lp file to that part of the track to determine AI behavioour. These chunks in the .lp files are called records. A long track needs more records and a short one needs less. But how do you know how many you need for your particular track ? In the end this proved to be reasonably easy. Nowadays I take my track's length in Papy units [also called tinies or 500ths] and divide it by 65500. This way I get the right amount most of the time. Sometimes I have to make .lp's with one or two less or more records to make it work but for medium sized tracks it is usually spot on.

Now how do you get the track length in Papy units ? We have used the same method when making camera files but if you forgot here is how to get that number :

First, run trk23d.exe with the -info parameter on your <track>.trk like this:
trk23d -info <track>.trk
Then
trk23d.exe will start putting out a lot of info on the screen about the .trk. When it is done, the last line will be the total length of the track [in 500ths].

Now take that number and divide by 65500. Round off to the nearest whole number and that is the amount of records needed for this track. Like I said before, sometimes I have to make .lp's with one or two less or more records to make it work but for medium sized tracks it is usually spot on. But you will only know that when you have made and tested the actual .lp files so let's go make those now.

Making The Replay Files:

Because I mostly make roadcourses and because Mistycreek has written a good tutorial on making these files for an oval track I am going to explain this proces on the assumption that we are making .lp files for a roadcourse here. In fact while writing this I have just made AI for Brainerd so I have that track in mind right now. Also, whenever I say DLAT I mean the lateral distance from the track center line.

Start up ICR2 and load your track in Preseason Testing. That is because other cars on the track will confuse the .rpy to .lp converter program as well as just get in the way really.

We are going to drive laps and save their respective replays, later on we will use them for making the .lp files with. Let me tell you first which laps to make and how to make them.
   
1. Race.rpy. A replay file of the cleanest single fast lap you can drive. This is the most exciting .rpy file that you're gonna make probably, so you might also like to save it to last :)

2. Pass1.rpy. A replay file of the cleanest fast lap while mostly driving on the lefthand side of the track (especially in corners). The more you stay on the lefthand side of the track, the better the AI cars will be able to pass each other, and you.

3. Pass2.rpy. A replay file of the cleanest fast lap while mostly driving on the righthand side of the track [especially in corners]. The more you stay on the righthand side of the track, the better the AI cars will be able to pass each other, and you.

4. Pace.rpy. Drive a lap mostly in the middle of the track at a reasonable speed. I take it up to about 100 mph on the longer straights and slow it down to 40 to 60 in the corners. This will be, as name suggests, the path the pacecar takes during yellows and before the start.

5. Pit.rpy. Drive a pretty fast lap (comparable to your race.rpy lap) but this time drive through the pits as if you were having a drive-through penalty. Stay close to the pitwall. This will be used for the laps when the AI get in and out of the pits. I have no idea when control gets handed back to the regular .lp files.

6. Maxrace.rpy. Drive one lap on the righthand side of the track, as close to the edge as you can get but stay on the track. This I think determines to which point the cars can race. Make the speed only slightly slower than the normal racing speed. Basically, the best you can do while driving on the edge of the track. Do not drive through the pits.

7. Minrace.rpy. Drive one lap on the righthand side of the track, as close to the edge as you can get but stay on the track. This I think determines to which point the cars can race. Make the speed only slightly slower than the normal racing speed. Basically, the best you can do while driving on the edge of the track. Do not drive through the pits.

8. Maxpanic.rpy. Drive one lap slowly [40 to 80 mph] on the left of your track. I always make a lap while actually driving on the grass but staying as close as I can to the track. If your pitlane is on the inside part of the track, go through it this time, keeping about the same line as you did in the Pit.lp.

9. Minpanic.rpy. Drive one lap slowly [40 to 80 mph] on the right of your track. I always make a lap while actually driving on the grass but staying as close as I can to the track. If your pitlane is on the inside part of the track, go through it this time, keeping about the same line as you did in the Pit.lp.

Always make sure that:

A: You save the replays from just before the start of the lap and a little after it ends. So, leave a little room before and after the S/F line.
B: You don't save multiple laps to a replay, only save the best one, the one that you will want to use to make a .lp from.
C: Make sure the lap ends about where it began [in terms of lateral distance from the track center line] because they are supposed to become closed loops.
D: The maximum DLAT lines you drive the Pace / Race / Pit  and both Pass files with should at no point be more then the DLAT of the Maxrace and Minrace files.
E: The maximum DLAT in the Maxrace and Minrace files should at no point on the track be more than the DLAT of the Maxpanic and Minpanic files.

I want to explain a bit more about points D and E. In the case of Brainerd I drove the maxpanic and minpanic files first. I drove both laps on the grass while trying to line up my wheel [the one closest to the track ] with the white line. Then I drove the Minrace and Maxrace on the track but with my other wheel as close as possible to the white line. That way I made sure that they at no point in the lap overlapped eachother. Then I drove the other laps and made sure that I never got too close to the white line.

Building The .Lp Files:

We need to make some empty .lp files to work with first. Start up Lpedit and choose your track. It will tell you that it has not found any .lp files and if you want to make them now ? Press Y and enter the number of records for the .lp file [the number we calculated at the beginning of this tutorial]. You will be prompted for all 9 .lp files so you need to repeat this step another 8 times. Then when the program loads press Escape and choose the option that will create the .lp files for you.

Start up Trafo in your Lpedit folder. I have had a problem where Trafo doesn't see the .rpy files that are in the track folder. To work around this try to rename the track to have the name of one of the original tracks. The name can be any of the names that you can access with a hot key on the Trafo [and Lpedit for that matter] intro screen. For example, the hotkey H is Michigan. Then the program should have no trouble seeing your .rpy files.

Type the name [with .rpy extension] of the first file and press Enter. The program will dump a file called Trafo1.txt in the lpedit folder of your track. Rename Trafo1.txt to whatever the name of the replay was that you just converted. So Race.rpy becomes Race.txt. Work down the list until there is a .txt file in the lpedit folder of your track for every .rpy that was in your track folder.

When you're done start Lpedit again. Now you will be asked to load data from laps or txts. Choose the option to load from .txt's by pressing T. Press Escape and then press Enter. Your .lp files will be saved and the program will exit.

That's it. You now have new .lp files. So go ahead and test them ! But make sure to save any unsaved work first because if you have made mistake then the game will likely crash and if you use DOS your whole computer might start rebooting. I usually test the new files by starting a new race and jumping right in. So what if it does not work ? Well:

1. When your cars move violently across the track for a very small moment before the game crashes it is most likely a record related problem. Then you can add or take out a record to see if that will work. You can do that with LPedit but that is very time consuming. It is better at this point to install Fastwalkers Lp2Txt and Txt2Lp tools in a folder on your harddrive and put your new .lp files in that folder as well. Then just run the .bat file to convert .lp to .txt, make the edit and run the .bat file that converts the .txt's back to .lp. Make sure that you delete the old .lp files first because the tool is not able to overwrite existing .lp files.

2. If the cars do get underway and don't crash the game but don't behave the way you think you have told them to with the .lp files then perhaps some files were swapped. As you will have seen there are a couple of files that are left-right dependant, so you can begin to try and swap those.

Good luck !

Thanks go out to Mistycreek, BB&B, Nigel Pattinson and Robert Szikszo for their research and .lp editing software and tutorials. Also, Sander Maas for reminding me I should test first and only THEN start bragging :)