How to build Custom Tracks

[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! :slight_smile:
example_track.zip (123 KB)

4 Likes

Will yaw, body roll and weight transfer play a part in cornering and bump handeling? Or just max G?

Body roll and weight transfer are considered in the max. G calculations and in acceleration and braking. I don’t know what exactly you mean with yaw, the car does steer, yes. Still, it is not a 100% correct simulation because the transition between the track segments is not totally correct. But eliminating that error would take a lot more time. I’d say the simulation times are within 5% of the real world if car and track are recreated properly.

Well like with high speed chicanes, will a rolly car with a high center of gravity or soft springs have a harder time with quick transitions , and will a stiffly sprung car have more trouble on bumpy sections if its trying to slow down or steer.

That cannot be calculated directly, but this is basically part of the sportiness/tameness ratio. A car with hard springs will be not very tame but sporty and will be penalised on bumpy track sections. I hope you get the idea. :slight_smile:

I will more than likely work on a track over the weekend. It won’t be a real track, but I think it’ll be pretty good on its own. I will say this is a lot simpler than Rigs of Rods was.

Okay cool I wasn’t sure if it was going to be factored in at all. Thanks for the help :slight_smile: I look foward to editing dome torture test tracks.

Rigs of Rods was a nice game, i still have it installed on my PC. But we gotta admit it was very difficult to create things for it…

Is there a way to set an initial direction of the track? Simply put, does the track have to always start going to the right, or is there some way of setting the track to a certain angle that the car should be headed? Otherwise, guess that’s just a limitation of the test track… and I’ll have to adjust with that over my creation of Road Atlanta.

Would some one be willing to help me mod a drag strip, somewhat similar to bandimere speedway in Colorado?

Yeah, it always starts to the right. It wouldn’t be a big problem to include a starting direction in the track definition though, we’ll see if the devs decide to do so in the future.

Not sure if his is a rare problem or just the way my windows is configured or whatnot, but I found a little bug. When editing or creating a .lua file with default windows notepad sometimes it wont work. I think it’s because the way notepad saves the file through UTF-8 with BOM. I think theres some invisible characters/data that screws with the way automation views files, i’m not sure but I just wanted to throw that out there.

Works perfectly fine with notepad++ though!

I’d be willing to bet somewhere you accidentally didn’t type something correctly, but since Notepad won’t show code error (while Notepad++ obviously will), you’ll have some issues. Even with N++, I had errors due to silly mistakes.

That’s actually more likely… I take it back it probably has nothing to do with encoding with BOM, you just have to be very precise and actually end your lines with brackets :laughing:

There’s a problem when using distance in the lua. I made a 1/4 mile track using 60’ (18.2m), 660’ (201.2m), and 1320’ (402.3m). While these are not as precise as they could be, the time my car does on this track is 12.75s. The game lists the 1/4 mile time as 12.30s.

Even shortening the lengths of the segments and overall altered the time to 12.71s. Am I doing something wrong?

[code]Track =
{
Name = “Quarter Mile”,
–Track Image Info
–Track Image must be 1280 x 720
–Start Position on the Image x,y from Top Left
Start = { 486, 411 },

--How many pixels per meter ( Pixels / Length )
--Measure a long straight and then manipulate from there
Scale = 15 / 10,


Layout = {			STRAIGHT},	-- Straight 0 , Corner Left 1, Corner Right -1
LayoutInfo = {    	400},		-- Straight Length [m] or Corner Angle °]
CornerRadius = {    0},			-- Corner Radius [m], 0 for Straight
Slope = {    		0},			-- %] (-: descending, +: climbing)
Sportiness = {    	2},			-- 0: no problems, 5: problems with untame car
Camber = {			0},			-- °] (positive values: banking to left /, negative: banking to right \)
Split1 = 15,					--60' trap
Split2 = 195,				--1/8 mile trap

}[/code]

Heyya! The problem is that you are running on imperfect bumpy asphalt: “Sportiness = {2},” should be “Sportiness = {0},”

Yep! That was the problem! Thank you. :slight_smile:

Next question. Is there a way to make the car start and run a straight on an angle? I made the track with about a 30 degree angle (it is part of a motor speedway), but changed it to 0 degrees because I couldn’t figure out how to set a starting angle.

[quote=“07CobaltGirl”]

Next question. Is there a way to make the car start and run a straight on an angle? I made the track with about a 30 degree angle (it is part of a motor speedway), but changed it to 0 degrees because I couldn’t figure out how to set a starting angle.[/quote]

It’s not yet possible.

[quote=“Passwrd”]

That’s actually more likely… I take it back it probably has nothing to do with encoding with BOM, you just have to be very precise and actually end your lines with brackets :laughing:[/quote]

it looks like there is indeed a problem with the stock windows editor, i got the same error when i created my first track with it.

i then just copy and pasted the track into n++ and the error was gone.

Can I use the values of Bobs Track Builder?