racer home

Building a new track


Home Building your own track gives the best results probably.

Dolphinity Organiser - free planning, project management and organizing software for all your action lists

Creating a new track

Racer is designed to allow you to create new tracks relatively easy. Still, a track is not too trivial to make. Normally, I'd use 3D Studio Max to generate the objects and convert the lot to Racer's DOF format using the ASE export format. Tracked (the tool to batch convert model files, add grid position etc) is mostly targeted around a 3D Studio Max workflow.

As for generic development of any content, a special page is dedicated to help you fix bugs faster and easier. It helps to read that first, so that you know which tools are available in helping you find problems.

Utilities to use


Which 3D modeler to use

For tracks, I'd recommend using 3D Studio Max and export using ASE. Racer is geared for Max's workflow where you use multisub materials in combination with lofts to create full-track ASE's that get split with TrackEd. For an export-split-import cycle you then need a couple of minutes after the initial work is done (setting up a track directory, grid/pit positions etc). A detailed talk about 3D modeling packages for Racer is here.

The basics of track creation is certainly lofting. To help you loft, here's some links that explain lofting for 3D Studio Max:

If you (want to) use Blender, there were export filters in the past by Stephen Doughty, but I haven't seen those since April 2006.

Modeling 3D tracks

When doing 3D tracks, it is important to learn relatively low-poly modeling for performance. Some tips:

Adding splines

Adding splines is necessary to create a smooth road surface, as well as creating a datastructure for the AI and other subsystems to work with. Actually creating and using splines is documented here. Without splines, the road will feel bumpy as you drive from polygon to polygon (unless you create/synthesize/have Lidar/laserscan data, see this page for more information on that). Also, the splined surface is used for things like the minimap, lap distance calculation and AI lines.

Even though the spline is important for a number of things, you can choose to drive on polygons nevertheless. When tesselating to a maximum triangle size of around 0.5m, it seems reasonably ok to drive on the mesh directly instead of the (very smooth) spline. This may be useful; to use that, in spline.ini set lines.use_mesh_hits to 1. Note that when using Lidar data, the height from that data always determines the height, regardless of the rendered mesh and the spline.

Adding timelines

The timelines are used to track the driver's laptime at specific points. The most important timeline is that at the start (which is often also the finish line). For technical reasons the first timeline is always defined as the first spline line (!). This ensures that distance calculation for example starts at the exact same spot as the start timeline.

To create timelines in TrackEd, just draw a line, from the left side of the road (as seen from the car while driving in the right direction) to the right side of the road; then click 'Declare timeline'. Note that Racer supports named timelines; you must edit those directly in the track's special.ini file. Set timeline.line<n>.name to the desired name (for example 'Senna curve'). This name will then be used instead of a more generic name like 'Start/finish' or 'Intermediate 2'.

Timelines in special.ini also have a special property; timeline.point_to_point. If set to 1, the track is a so-called AB track, which means that the start and finish lines are not the same. This is useful for rally tracks for example, where you drive from one point to another, and never return to the start.

Adding surface types

Differences between grass, road, kerbs etc. The surfaces are defined in the track's special.ini file. Detailed information can be found here.

Adding an environment map

Each track can have its own default environment map, which is reflected on the cars using a shader's special $trackenvmap. This map can be updated live (quite costly on the GPU) by setting racer.ini's envmap.live_track to 1. If set to 0, the 6 files data/tracks/<yourtrack>/track_<dir>.tga are loaded, where <dir> = lt, rt, up, dn, fw, bw.

It might be easiest to create a default environment map (which renders much faster than using live maps, although graphically it's not as interesting) by driving to a nice spot, and entering the 'trackmap save' command in the console. It will display a message stating it is going to save. Only after rendering the next frame (or really the next environment map update) will the maps be saved and a message indicating this happened will be printed. After the save, copy the track_*.tga files in data/dump to your track directory. Make sure also that there are shaders using the special $trackenvmap map, otherwise you won't be able to see it.

Adding 3D start light objects

Racer v0.5.8+ supports upto 3 light objects in 3D, to enhance the start sequence of the race. You add the light models in geometry.ini as usual, and Racer will selectively turn them on or off. In special.ini, you indicate the 3 objects by their name in gfx.lights. I.e. 'lights=start_lights_top start_lights_middle start_lights_bottom'. Then start Racer (with race.quickstart=0 in racer.ini) and test it. The sequence is: all off, object1 on, object1+2 on, object1+2+3 on, all off again (5 steps).

Adding AI and default AI driving lines

AI files are used to make cars drive on their own. The files live in the track's 'ai' directory. Normally it is good to have specific AI files for specific cars, but a default AI file can also be created, which will be used for cars that don't have specific AI files created for them (yet). The default AI file is data/tracks/<trackname>/ai/default.ini.

Note that AI requires a spline being present. If no spline is defined, the AI car will stand still.

The AI works by recording the car's velocity and lateral position at every spline line. When a car's AI is enabled, the car will try to match that velocity by accelerating, braking and turning. An AI car will always use an automatic gearbox, so make sure you car supports that.

To define an AI line: select a car and track for which you want to make an AI line. Start a race and press Ctrl-F6. Drive a good lap (actually the start/finish speed and lateral location is the hardest part to match up nicely, so it's good to start quite far in front of start/finish so you have the right speed at start/finish, or just drive a lap first and before crossing the start/finish line press Ctrl-F6). You'll see progress being reported in the console (if not enabled, try pressing Ctrl-~ and Enter to get it enabled) as you drive along the track. After you cross start/finish again (hopefully with about the same speed and lateral position as you started, to make a smooth connection between AI laps), press Ctrl-F7 to save the AI line in the track's ai/ directory.

The saved AI line will be in the ai directory of the track. Optionally rename or copy it to 'default.ini' and it will be used for cars that don't have a specific AI file.

Racer v0.8.33 adds self-training for AI lines. The AI can driver its own lap and improve its time! This makes it possible to use one nice default.ini line and then train AI cars specifically for this racing line. The workflow then becomes:

Test the AI by turning AI on using Shift-A (which toggles AI for the current car, or use the console commands 'ai on' and 'ai off'). If the car spins off, you might need to tweak things a bit:

To explain how Racer uses the default AI line: if no car-specific AI line is found, the ai/default.ini file is loaded. After that, all velocities are normalized so the top speed becomes 1.0 (0.0 will still be velocity=0). Then, the car has an ai.max_velocity setting in its car.ini file, which is used to scale the AI velocities to match the capabilities of the car. So if ai.max_velocity=50 and the maximum velocity in the default.ini is 75, the car will scale all velocities in the ai/default.ini file so that it's maximum velocity is 50 again (all values are multiplied by 50/75).

Adding pacenotes

You might want to add rally-style pacenotes. You will need splines for pacenotes to work. Here's how:

While editing, you can also use the following:

Adding a pits

Pitstops are not really supported yet. However, you can define pit locations, and an entry to the pits (upon which the car doesn't really do anything). Racer requires at least 1 pit location to be defined. If not, Racer will refuse to load the track.

Debugging the track

While developing, regularly check the QLOG file (see the documentation on fixing warnings) to see if there are any warnings related to your track. Try to remove all warnings before you release the track to the public.

Adding rain

Rain can be added statically to a track. See the specific page on adding rain to tracks.

Adding snow

Snow can be added statically to a track. See the specific page on adding snow to tracks.

Adding waving flags

Often, tracks have flags on some parts of the track. v0.8.3+ has support for waving flags; see the waving flag tutorial.

Modifying the sun

The sun can be controlled through these parameters in the track's special.ini:

Parameter Description
gfx.sun.year Used for defining the sun path. Default is 2008.
gfx.sun.month The month, used in defining the sun path. Default is 7.
gfx.sun.day The day, used in defining the sun path. Default is 1.
gfx.sun.latitude The latitude on Earth, used in defining the sun path. Default is 52.
gfx.sun.longitude The longitude on Earth, used in defining the sun path. Default is 5.
gfx.sun.timezone The timezone. Default is 1.
gfx.sun.azimuth_offset An angle that rotates the sun, to rotate up the North direction of the sun's path. Use the console command 'sun azimuth <x>' to change it live while in-game. The values is specified in degrees, so valid values are between 0 and 360.


Modifying TOD (time of day)

Check out time of day editing in the TOD tutorial.

Adding a sky

Skies are much more involved since v0.7.2. Previously you used skydomes that were textured regularly, but these days you can use Cg shaders to make a much nicer sky.. See the specific page on atmospherical scattering.

Making an endless track

An endless track is a track which never ends. They are often used in tire manufacturer testing, for example a never-ending highway. Full details are explained on this page.

Verification list

Before releasing, it is good to check some things which are perhaps harder to notice. Here is a small checklist.

Distributing your track

Once you have your track working satisfactorally, you probably want to distribute your track on the internet. Normally you just have to zip up your entire track directory, but run by this checklist before distribution:

Dolphinity Organiser - free planning, project management and organizing software for all your action lists

(last updated February 27, 2013 )