[size=150]Custom Tracks[/size]
Hey guys,
today I want to explain to you how to make custom tracks for the Automation Test Track Simulation. Basically you don’t need a lot of programming skills, it’s just fiddling around with numbers. First I want to give a quick overview over the format of the track files and then talk about the different parts more in-depth. So let’s get started!
Track File Format
Custom Track folders are placed in Documents\Automation\Tracks (Standalone version) or Documents\My Games\Automation\Tracks (Steam version). The folder contains two files: a .lua-file with the definition of the track and a shiny background image (.png). You can name the folder how you want, but the files in the folder have to be named “track.lua” and “track.png”. The .lua-file can be openend with Notepad or with for example Notepad++ (recommended, Freeware). .png-files can be created with almost every common picture editing software.
This is how the definition of the example custom track (attached at the bottom of this post) looks like:
[code]–Example Track
–You Can use 0, 1, -1 instead.
local STRAIGHT = 0
local LEFT = 1
local RIGHT = -1
Track =
{
Name = “Example Track”,
–Track Image Info
–Track Image must be 1280 x 720
–Start Position on the Image x,y from Top Left
Start = { 530, 530 },
--How many pixels per meter ( Pixels / Length )
--Measure a long straight and then manipulate from there
Scale = 20 / 10,
Layout = { STRAIGHT, STRAIGHT, LEFT, STRAIGHT, LEFT, STRAIGHT, STRAIGHT, STRAIGHT, LEFT, STRAIGHT, LEFT, STRAIGHT}, -- Straight 0 , Corner Left 1, Corner Right -1
LayoutInfo = { 100, 100, 90, 100, 90.5, 100, 100, 100, 90, 140, 90.5, 100}, -- Straight Length [m] or Corner Angle °]
CornerRadius = { 0, 0, 40, 0, 40, 0, 0, 0, 20, 0, 20, 0}, -- Corner Radius [m], 0 for Straight
Slope = { -3, -1.5, 0, 0, 0, 3, 1.5, 0, 5, 0, -5, 0}, -- %] (-: descending, +: climbing)
Sportiness = { 1, 1, 2, 1, 2, 2, 3, 3, 4, 3, 5, 2}, -- 0: no problems, 5: problems with untame car
Camber = { 0, 0, 5, 0, 10, 0, 0, 0, 0, 0, 0, 0}, -- °] (positive values: banking to left /, negative: banking to right \)
Split1 = 312.8,
Split2 = 725.6,
}
[/code]
Don’t change anything up to line 10 (except for comments, after “–”), that’s the header of the file. In line 11, you can set the in-game name of the track (how it will appear in the custom tracks list). Lines 15 and 19 are important for how the animated car will move around the track. Lines 22 to 29 contain the track definition.
Animation Settings
These settings have to be adjusted to make the car move around exactly on the background image (1280x720 pixels) of your track. You can set the scale (in pixels/meter) and where the car starts (in pixels). Both values can be measured and calculated from the background image (and maybe have to be tweaked slightly afterwards). So the most important thing for this is an accurate background image. If you start with the background image and build your track on top of that or if you first build the track and draw it afterwards is up to you. The second way might be the easier one for generic tracks, the first one the way to go for recreating real world tracks.
Track Definition
Here you can build the driving line of the car around the track and some other track characteristics. The track definition doesn’t have to result in a closed loop, so you can build rallye stages if you want.
[ul]]You make the driving line out of segments which can be left or right corners and straights. Put them in words or in numbers (1=LEFT, -1=RIGHT, 0=STRAIGHT) one after another into the first line of the track definition. Make sure you start and end with a straight. More than one straight or more corners may be put after one another./:m]
]In the second line you define the length of the straights (in meters) and the angles of the corners (in degrees). This defines only the 2D-projection of the track, so you don’t have to bother with how long a sloped track segment really is when driving over it. Just define the track out of the bird-view./:m]
]The third line contains the corner radii (in meters). Put in a 0 for straights (although the corner radius of a straight is ∞ in reality). After that, the 2D-projection of the track is complete./:m]
]In the fourth line you define the slopes of the segments (in percent). The simulation automatically will calculate the actual, 3D length of the track segments. Don’t make slopes too steep or low-powered cars won’t be able to make it around the track resulting in errors./:m]
]The fifth line is for defining how difficult to drive the segments are. Put in values from 0 to 5 (0: easy, 5: hard). You can imagine that this is the bumpiness of the track. The simulation looks at these values and punishes cars with a high sportiness/tameness ratio. So on some tracks, insane cars with 2 MW might be slower than actually controllable cars./:m]
]The sixth line defines the camber or banking of the track (in degrees). This is for the oval lovers. Negative numbers make it banked to the left (/) and positive numbers banked to the right () when you are facing in driving direction. Values up to 45 degrees should be fine, use everything above at your own risk./:m]
]The last two lines contain the location of the sector time measurement. Put in the distance from the start line (in meters) for the two locations. Note that you need the distance in 3D (not the 2D-projection) here. But these values can be tweaked easily after you have the complete driving line definition running in the game. Just make sure that the values are smaller than the overall track length./:m][/ul]
The driving line is calculated in steps of 0.2 meters. This means that there can be some minor deviations in the driving line compared to your design on paper. For example, if you want to build a 90 degrees corner the simulation can step out of the corner at 90.1 degrees. You might have to tweak some values (especially after adding slopes) to reduce those small differences.
That’s basically it! If something remains unclear feel free to ask! I just have one last note for programmers in the community:
It is extremely helpful if you can build the tracks in an external program before you import them into Automation. This saves a lot of time you would spend on watching if the car does what you want. If anyone wants to program a tool for that, you can contact me via PM for some help. I already have a working track plotting MATLAB script which could be converted pretty easily into C++ (but not by me). I also have a (pretty bad) random track generator in MATLAB code. If anyone wants to do something similar and wants to take a look at my approach, ask me!
example_track.zip (123 KB)