
Build your track for TORCS in 20 minutes

This document explain how to make a track for torcs using trackeditor to create the track and then modify the xml file of the track (the physical description) with a text editor and then make the 3d description (ac file) using trackgen. Note that trackeditor and trackgen are provided with torcs.
Vicente Martí Centelles
Last modification :
Version
v1.01
1 About the tutorial.................................................................................3
2 Open source Programs needed and useful tutorials.............................4
3 Test track..............................................................................................5
3.1 The xml file of the original track................................................5
3.2 Test the track into torcs: trackgen. ............................................15
3.3 Hand edit the track: banking. ....................................................16
3.4 Hand edit the track: grade. ........................................................20
3.5 Graphic section..........................................................................22
3.6 Starting Grid section..................................................................23
3.7 Turn marks section.....................................................................23
3.8 Cams section..............................................................................24
3.9 Surface section...........................................................................26
3.10 Environment Mapping..............................................................28
3.11 Profil tangent............................................................................31
3.12 Profil steps................................................................................33
3.13 Elevation files of the terrain.....................................................34
3.14 Object Map: add objects to the track......................................39
4 Edit the ac file created with trackgen with blender............................52
5 Make a real track...............................................................................59
6 Create a video from TORCS..............................................................63
7 Create a adio file from TORCS.........................................................65
8 Mixing the adio file and the video file from TORCS........................66
9 How to create a Formula 1 car for TORCS......................................67
This tutorial should be a good reference to people that want to make their own tracks, cars... and modify some parts of torcs in order to develop the game and improve it.
I'm working on formula 1 tracks and cars for torcs with the help of Gonzalo Aranda,
Andrew Sumner, Berny, Eric Espie and some people that I could forgot (so sorry for that). If you want to get involved tell to me and I will give you some info about the project.
Please, you can sugest anything or see the project of the formula 1 tracks and cars tor torcs visit the forum:
http://www.s8.createphpbb.com/f1torcs
and the web of f1torcs
http://usuarios.lycos.es/f1torcs/
You can also found some info in my home page : http://www4.uji.es/~al063357
Don't forget to visit the official web page of TORCS http://www.torcs.org to read the latest news about this wonderful racing car simulator
![]()

Home page: http://www4.uji.es/~al063357
![]()


All programs used in this tutorial are open source. So you don't need to spend any money in a program license. One advantage of open source programs is that they are always improving and you can help to develop these software.
TORCS: The Open Racing Car Simulator
We are going to make tracks, cars... for this amazing game and we will try to develop it by making a good track, car... for it.
The GIMP
We will use this software to edit the images and textures.
Blender
We can edit the 3d description of the track or a track (ac file) in an easy way.
Trackeditor
This software is provided with torcs. We can make tracks with this.
Trackgen
This software is provided with torcs. We can make tracks from the xml file.
A text editor
You can use you favourite text editor to edit the xml files, for example Scintilla Text Editor.
Audacity
Used to record the sound from torcs.
VirtualDubMod
We will use this software to create a video from the generated images with the movie tool from torcs.
OpenOffice
I have used this software to create this tutorial.
I have created a test track with trackeditor and now we are going to hand edit it. (You can read the tutorial provided with torcs to learn how to use tarckeditor: Trackeditor Manual)

<?xml
version="1.0" encoding="UTF-8"?>
<!--
file
: test.xml
auto generated : by Track
Editor
version : v 0.6.0 24/4/2005
copyright
: (C) 2005 by Charalampos Alexopoulos
email :
-->
<!--
This
program is free software; you can redistribute it and/or modify
it
under the terms of the GNU General Public License as published
by
the Free Software Foundation; either version 2 of the License,
or
(at your option) any later version.
-->
<!DOCTYPE
params SYSTEM "../../../src/libs/tgf/params.dtd" [
<!-- general definitions for tracks -->
<!ENTITY default-surfaces SYSTEM "../../../data/tracks/surfaces.xml">
]>
<params name="test" type="param" mode="mw">
<section name="Surfaces">&default-surfaces;</section>
<section name="Header">
<attstr name="name" val="test" />
<attstr name="category" val="road" />
<attnum name="version" val="4" />
<attstr name="author" val="Vicente Marti" />
<attstr name="description" val="Test track" />
</section>
<section name="Graphic">
<attstr name="3d description" val="test.ac" />
<section name="Terrain Generation">
<attnum name="track step" unit="m" val="20" />
<attnum name="border margin" unit="m" val="50" />
<attnum name="border step" unit="m" val="30" />
<attnum name="border height" unit="m" val="15" />
<attstr name="orientation" val="clockwise" />
</section>
</section>
<section name="Main Track">
<attnum name="width" unit="m" val="14.0" />
<attnum name="profil steps length" unit="m" val="4.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of track-->
<section name="Left Side">
<attnum name="start width" unit="m" val="4.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="0.5" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="curb" />
</section>
<!--End of left part-->
<!--Right part of track-->
<section name="Right Side">
<attnum name="start width" unit="m" val="4.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="0.5" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="plan" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="curb" />
</section>
<!--End of right part-->
<section name="Pits">
<attstr name="side" val="right" />
<attstr name="entry" val="" />
<attstr name="start" val="" />
<attstr name="end" val="" />
<attstr name="exit" val="" />
<attnum name="length" unit="m" val="0.0" />
<attnum name="width" unit="m" val="0.0" />
</section>
<section name="Track Segments">
<!--******************************-->
<!-- Segment 1 -->
<!--******************************-->
<section name="recta1">
<attstr name="type" val="str" />
<attnum name="lg" unit="m" val="200.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="7.0" />
<attnum name="end width" unit="m" val="7.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier-turn" />
<attstr name="style" val="curb" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="4.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="plan" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier-turn" />
<attstr name="style" val="curb" />
</section>
<!--End of right part-->
</section>
<!--******************************-->
<!-- Segment 2 -->
<!--******************************-->
<section name="curve1">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="5.0" />
<attnum name="end width" unit="m" val="15.0" />
<attstr name="surface" val="sand3" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="2.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="grass5" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="tire-wall" />
<attstr name="style" val="wall" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="4.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="1.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="curb" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="curb" />
</section>
<!--End of right part-->
</section>
<!--******************************-->
<!-- Segment 3 -->
<!--******************************-->
<section name="curve2">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="15.0" />
<attnum name="end width" unit="m" val="15.0" />
<attstr name="surface" val="sand3" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="2.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="grass5" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="tire-wall" />
<attstr name="style" val="wall" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="4.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="1.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="curb" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="curb" />
</section>
<!--End of right part-->
</section>
<!--******************************-->
<!-- Segment 4 -->
<!--******************************-->
<section name="curve3">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="15.0" />
<attnum name="end width" unit="m" val="15.0" />
<attstr name="surface" val="sand3" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="2.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="grass5" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="tire-wall" />
<attstr name="style" val="wall" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="4.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="1.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="curb" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="curb" />
</section>
<!--End of right part-->
</section>
<!--******************************-->
<!-- Segment 5 -->
<!--******************************-->
<section name="recta2">
<attstr name="type" val="str" />
<attnum name="lg" unit="m" val="100.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="17.0" />
<attnum name="end width" unit="m" val="7.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="curb" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="5.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="plan" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="curb" />
</section>
<!--End of right part-->
</section>
<!--******************************-->
<!-- Segment 6 -->
<!--******************************-->
<section name="curve4">
<attstr name="type" val="lft" />
<attnum name="arc" unit="deg" val="90.0" />
<attnum name="radius" unit="m" val="50.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="6.0" />
<attnum name="end width" unit="m" val="10.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="1.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="curb" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="curb" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="4.0" />
<attnum name="end width" unit="m" val="11.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="curb" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="wall" />
<attstr name="style" val="wall" />
</section>
<!--End of right part-->
</section>
<!--******************************-->
<!-- Segment 7 -->
<!--******************************-->
<section name="curve5">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="90.0" />
<attnum name="radius" unit="m" val="50.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="11.0" />
<attnum name="end width" unit="m" val="8.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier-turn" />
<attstr name="style" val="curb" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="10.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="1.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="curb" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier" />
<attstr name="style" val="curb" />
</section>
<!--End of right part-->
</section>
<!--******************************-->
<!-- Segment 8 -->
<!--******************************-->
<section name="recta3">
<attstr name="type" val="str" />
<attnum name="lg" unit="m" val="200.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="8.0" />
<attnum name="end width" unit="m" val="8.0" />
<attstr name="surface" val="sand" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="3.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="grass3" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="wall" />
<attstr name="style" val="wall" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="5.0" />
<attnum name="end width" unit="m" val="10.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="plan" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="wall" />
<attstr name="style" val="wall" />
</section>
<!--End of right part-->
</section>
<!--******************************-->
<!-- Segment 9 -->
<!--******************************-->
<section name="curve6">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="180.0" />
<attnum name="radius" unit="m" val="90.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="5.0" />
<attnum name="end width" unit="m" val="10.0" />
<attstr name="surface" val="sand" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="3.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="grass3" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="5.0" />
<attstr name="surface" val="barrier-grille" />
<attstr name="style" val="curb" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="10.0" />
<attnum name="end width" unit="m" val="10.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="1.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="curb" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="5.0" />
<attstr name="surface" val="barrier-grille" />
<attstr name="style" val="plan" />
</section>
<!--End of right part-->
</section>
<!--******************************-->
<!-- Segment 10 -->
<!--******************************-->
<section name="straight 2">
<attstr name="type" val="str" />
<attnum name="lg" unit="m" val="200.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--Left part of segment-->
<section name="Left Side">
<attnum name="start width" unit="m" val="10.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="sand3" />
</section>
<section name="Left Border">
<attnum name="width" unit="m" val="3.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="grass3" />
<attstr name="style" val="plan" />
</section>
<section name="Left Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier-turn" />
<attstr name="style" val="curb" />
</section>
<!--End of left part-->
<!--Right part of segment-->
<section name="Right Side">
<attnum name="start width" unit="m" val="11.0" />
<attnum name="end width" unit="m" val="4.0" />
<attstr name="surface" val="grass" />
</section>
<section name="Right Border">
<attnum name="width" unit="m" val="0.0" />
<attnum name="height" unit="m" val="0.05" />
<attstr name="surface" val="curb-5cm-r" />
<attstr name="style" val="plan" />
</section>
<section name="Right Barrier">
<attnum name="width" unit="m" val="0.1" />
<attnum name="height" unit="m" val="1.0" />
<attstr name="surface" val="barrier-turn" />
<attstr name="style" val="curb" />
</section>
<!--End of right part-->
</section>
</section>
</section>
</params>
Now we are going to edit this track created with trackeditor.
We will use trackgen to create the track. I mean, trackgen creates the 3d file of the track from the xml file.
For testing the track use the command (this just creates the track,
not the terrain):
trackgen -c category -n name
For the final track use the command (creates the track and the
terrain):
trackgen -c category -n name -a
The trackgen help is:
Terrain generator for tracks $Revision: 1.5 $
Usage: trackgen -c category -n name [-a] [-m] [-s] [-S] [-E <n> [-H <nb>]]
-c category : track category (road, oval, dirt...)
-n name : track name
-b : draw bump track
-B : Don't use terrain border (relief supplied int clockwise,
ext CC)
-a : draw all (default is track only)
-z : Just calculate track parameters and exit
-s : split the track and the terrain
-S : split all
-E <n> : save elevation file n
0: all elevatation files
1: elevation file of terrain + track
2: elevation file of terrain with track white
3: track only
4: track elevations with height steps
-H <nb> : nb of height steps for 4th elevation file [30]
Now we are going to edit the first corner, we are going to add a banking.

We are going to see what is the banking:

No banking

Banking
The default description or the 1st corner is:
<!--******************************-->
<!-- Segment 2 -->
<!--******************************-->
<section name="curve1">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--******************************-->
<!-- Segment 3 -->
<!--******************************-->
<section name="curve2">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<!--******************************-->
<!-- Segment 4 -->
<!--******************************-->
<section name="curve3">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
We can add the banking in several ways:
Way 1: specify the banking start and end
We can add the following to lines to indicate the banking of the segment. The first one indicates the banking of the beginning of the segment and the last one the banking of the end.
<attnum name="banking start" unit="deg" val="15"/>
<attnum name="banking end" unit="deg" val="15"/>
The positive number is for right curves (unit="deg" val="15") and the positive number for left curves (unit="deg" val="-15"). (tested with torcs)
The curve consist in three segments so the banking must be in order to have a smooth curve:
curve1: banking start 0, banking end 15
curve2: banking start 15, banking end 15
curve3: banking start 15, banking end 0
<!--******************************-->
<!-- Segment 2 -->
<!--******************************-->
<section name="curve1">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="banking start" unit="deg" val="0"/>
<attnum name="banking end" unit="deg" val="15"/>
<!--******************************-->
<!-- Segment 3 -->
<!--******************************-->
<section name="curve2">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="banking start" unit="deg" val="15"/>
<attnum name="banking end" unit="deg" val="15"/>
<!--******************************-->
<!-- Segment 4 -->
<!--******************************-->
<section name="curve3">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="banking start" unit="deg" val="15"/>
<attnum name="banking end" unit="deg" val="0"/>
Way 2: specify the z left and right start and end
We can add the following to lines to indicate the z (height) of the segment.
<attnum name="z start left" unit="m" val="0"/>
<attnum name="z start right" unit="m" val="3"/>
<attnum name="z end left" unit="m" val="0"/>
<attnum name="z end right" unit="m" val="3"/>
The curve consist in three segments so the banking must be in order to have a smooth curve:
curve1: z start left: 0, z start ritght: 0, z end left: 3, z
start ritght: 0
curve2: z start left: 3, z start ritght: 0, z end left: 3, z
start ritght: 0
curve3: z start left: 3, z start ritght: 0, z end left: 0, z
start ritght: 0
Remember to delete the original z tag for each segment:
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
The result is:
<!--******************************-->
<!-- Segment 2 -->
<!--******************************-->
<section name="curve1">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="z start left" unit="m" val="0"/>
<attnum name="z start right" unit="m" val="0"/>
<attnum name="z end left" unit="m" val="3"/>
<attnum name="z end right" unit="m" val="0"/>
<!--******************************-->
<!-- Segment 3 -->
<!--******************************-->
<section name="curve2">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="z start left" unit="m" val="3"/>
<attnum name="z start right" unit="m" val="0"/>
<attnum name="z end left" unit="m" val="3"/>
<attnum name="z end right" unit="m" val="0"/>
<!--******************************-->
<!-- Segment 4 -->
<!--******************************-->
<section name="curve3">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="z start left" unit="m" val="3"/>
<attnum name="z start right" unit="m" val="0"/>
<attnum name="z end left" unit="m" val="0"/>
<attnum name="z end right" unit="m" val="0"/>
You can do the same but not using the z start specification, trackgen gets automaticaly the z start left and right from the previous segement:
<attnum name="z end left" unit="m" val="0"/>
<attnum name="z end right" unit="m" val="3"/>
It's to say:
curve1: z end left: 3, z start ritght: 0
curve2: z end left: 3, z start ritght: 0
curve3: z end left: 0, z start ritght: 0
Remember to delete the original z tag for each segment:
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
The final xml file is:
<!--******************************-->
<!-- Segment 2 -->
<!--******************************-->
<section name="curve1">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="z end left" unit="m" val="3"/>
<attnum name="z end right" unit="m" val="0"/>
<!--******************************-->
<!-- Segment 3 -->
<!--******************************-->
<section name="curve2">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="z end left" unit="m" val="3"/>
<attnum name="z end right" unit="m" val="0"/>
<!--******************************-->
<!-- Segment 4 -->
<!--******************************-->
<section name="curve3">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="z end left" unit="m" val="0"/>
<attnum name="z end right" unit="m" val="0"/>
We can add the grade (slope) of the track.
Track without grade:
Track with positive grade:
The tag that we must add to each segment of the xml file is:
<attnum name="grade" unit="%" val="10"/>
A positive value means go up a hill, and a negative value go down.
To get a smooth road we have to add the grade to all segments to get the correct grade.
Remember to delete the original z tag for each segment:
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
The following segments are from the test track with a smooth road:
Segment 1: z start: 0, z end: 0
Segment 2: z end left: 3, z end right: 0
Segment 3: z end left: 3, z end right: 0
Segment 4: z end left: 0, z end ritght: 0
Segment 5: grade = 10 %
Segment 6: grade = - 10 %
Segment 7: grade = - 2 %
Segment 8: no z specification
Segment 9: no z specification
Segment 10:z end 0

The segments are:
Segment 1: recta1
Segment 2: curve1
Segment 3: curve2
Segment 4: curve3
Segment 5: recta2
Segment 6: curve4
Segment 7: curve5
Segment 8: recta3
Segment 9: curve6
Segment 10: straight 2
Background image
Use a 2048x512 png image with all the view (360º) without repeating.
<section name="Graphic">
<attstr name="3d description" val="aalborg.acc"/>
<attstr name="background image" val="background.png"/>
<attnum name="background type" val="4"/>
An example that you can find on some tracks for torcs.

You can add some settings to the graphics section:
<attnum name="background color R" val="0.5"/>
<attnum name="background color G" val="0.5"/>
<attnum name="background color B" val="0.55"/>
<attnum name="ambient color R" val="0.2"/>
<attnum name="ambient color G" val="0.2"/>
<attnum name="ambient color B" val="0.2"/>
<attnum name="diffuse color R" val="1"/>
<attnum name="diffuse color G" val="1"/>
<attnum name="diffuse color B" val="1"/>
<attnum name="specular color R" val="0.1"/>
<attnum name="specular color G" val="0.1"/>
<attnum name="specular color B" val="0.1"/>
<attnum name="light position x" val="-10000"/>
<attnum name="light position y" val="10000"/>
<attnum name="light position z" val="7000"/>
The factor of view:
<attnum name="fov factor" val="0.9"/>
You can specify the starting grid of the track:
<section name="Starting Grid">
<attnum name="rows" val="2"/>
<attstr name="pole position side" val="left"/>
<attnum name="distance to start" unit="m" val="4.0"/>
<attnum name="distance between columns" unit="m" val="15.0"/>
<attnum name="offset within a column" unit="m" val="7.0"/>
<attnum name="initial height" unit="m" val="0.2"/>
</section>
This section defines the turn marks:
<section name="Turn Marks">
<attnum name="width" unit="m" val="1.0"/>
<attnum name="height" unit="m" val="1.0"/>
<attnum name="vertical space" unit="m" val="0.0"/>
<attnum name="horizontal space" unit="m" val="2.0"/>
</section>
You have to add the next tags in each curve you want a turn mark (the values are the distances to the curve in meters):
<attstr name="marks" val="50;100;150"/>
<attstr name="marks" val="50;100"/>
<attstr name="marks" val="50"/>
For example:
<!--******************************-->
<!-- Segment 2 -->
<!--******************************-->
<section name="curve1">
<attstr name="type" val="rgt" />
<attnum name="arc" unit="deg" val="59.99999999999999" />
<attnum name="radius" unit="m" val="40.0" />
<attstr name="surface" val="asphalt2-lines" />
<attnum name="z end left" unit="m" val="3"/>
<attnum name="z end right" unit="m" val="0"/>
<attstr name="marks" val="50;100"/>
<!--Left part of segment-->
You can use 50m, 100, 150, 200 and 300 (see the torcs\data\textures). You can edit these textures and copy them to your track folder.
You can set up the cameras of your track, and you can add the number of cameras that you want.
<section name="cam 3">
<!-- Camera's position relative to a segment -->
<attstr name="segment" val="t2-1"/>
<attnum name="to right" val="12.0"/>
<attnum name="to start" val="12.0"/>
<attnum name="height" val="1.5"/>
<!-- Camera field of view, indicates the first and last segment viewed -->
<attstr name="fov start" val="t1-12"/> <!-- included -->
<attstr name="fov end" val="t2-2"/> <!-- excluded -->
</section>
The "segment" indicates the segment in which is placed the cam.
"to right" indicates the distance to the corner of the segment (see the picture)
"to start" indicates the distance to the corner of the segment (see the picture)
"height" indicates the distance to the corner of the segment (see the picture)
to right
to start
The following segments are:
Segment 1: recta1
Segment 2: curve1
Segment 3: curve2
Segment 4: curve3
Segment 5: recta2
Segment 6: curve4
Segment 7: curve5
Segment 8: recta3
Segment 9: curve6
Segment 10: straight 2
You can see a good set of cameras for the test track:
<section name="Cameras">
<section name="cam 0">
<!-- Camera's position relative to a segment -->
<attstr name="segment" val="recta1"/>
<attnum name="to right" val="0"/>
<attnum name="to start" val="15"/>
<attnum name="height" val="4"/>
<!-- Camera field of view, indicates the first and last segment viewed -->
<attstr name="fov start" val="straight 2"/> <!-- included -->
<attstr name="fov end" val="curve1"/> <!-- excluded -->
</section>
<section name="cam 2">
<!-- Camera's position relative to a segment -->
<attstr name="segment" val="curve2"/>
<attnum name="to right" val="0"/>
<attnum name="to start" val="0"/>
<attnum name="height" val="2"/>
<!-- Camera field of view, indicates the first and last segment viewed -->
<attstr name="fov start" val="curve1"/> <!-- included -->
<attstr name="fov end" val="recta2"/> <!-- excluded -->
</section>
<section name="cam 3">
<!-- Camera's position relative to a segment -->
<attstr name="segment" val="curve4"/>
<attnum name="to right" val="0"/>
<attnum name="to start" val="0"/>
<attnum name="height" val="2"/>
<!-- Camera field of view, indicates the first and last segment viewed -->
<attstr name="fov start" val="recta2"/> <!-- included -->
<attstr name="fov end" val="recta3"/> <!-- excluded -->
</section>
<section name="cam 4">
<!-- Camera's position relative to a segment -->
<attstr name="segment" val="recta3"/>
<attnum name="to right" val="17"/>
<attnum name="to start" val="150"/>
<attnum name="height" val="2"/>
<!-- Camera field of view, indicates the first and last segment viewed -->
<attstr name="fov start" val="recta3"/> <!-- included -->
<attstr name="fov end" val="curve6"/> <!-- excluded -->
</section>
<section name="cam 5">
<!-- Camera's position relative to a segment -->
<attstr name="segment" val="curve6"/>
<attnum name="to right" val="65"/>
<attnum name="to start" val="90"/>
<attnum name="height" val="25"/>
<!-- Camera field of view, indicates the first and last segment viewed -->
<attstr name="fov start" val="curve6"/> <!-- included -->
<attstr name="fov end" val="straight 2"/> <!-- excluded -->
</section>
</section>
You can add some surfaces in this section but you have to use a different name for each surface. A good idea is name the surface as asphalt-trackname-1.
The default surfaces are located in:
<!ENTITY default-surfaces SYSTEM "../../../data/tracks/surfaces.xml">
All parameters are self explanatory, you can test them in torcs making some changes.
Here you can see some examples of surfaces.
<section name="Surfaces">
&default-surfaces;
<section name="asphalt-aa-bw1">
<attnum name="color R1" val="0.1"/>
<attnum name="color G1" val="0.1"/>
<attnum name="color B1" val="0.1"/>
<attnum name="color R2" val="0.2"/>
<attnum name="color G2" val="0.2"/>
<attnum name="color B2" val="0.2"/>
<attstr name="texture name" val="tr-asphalt-aa-bw1_n.rgb"/>
<!--attstr name="texture name" val="tr-asphalt-aa-nl-bw1_n.rgb"/-->
<attstr name="texture type" in="discrete, continuous" val="discrete"/>
<attnum name="texture size" val="15.0001" unit="m"/>
<attnum name="texture mipmap" val="0.0" unit="m"/>
<attstr name="bump name" val=""/>
<attnum name="bump size" val="2.0" unit="m"/
<attnum name="friction" val="1.2"/>
<attnum name="rolling resistance" val="0.001"/>
<attnum name="roughness" val="0"/>
<attnum name="roughness wavelength" val="1.0"/>
</section>
<section name="g-grass3-l">
<attnum name="color R1" val="0.1"/>
<attnum name="color G1" val="0.4"/>
<attnum name="color B1" val="0.1"/>
<attnum name="color R2" val="0.2"/>
<attnum name="color G2" val="0.5"/>
<attnum name="color B2" val="0.2"/>
<attstr name="texture name" val="asgrassr_n.rgb"/>
<attstr name="texture type" in="discrete, continuous" val="discrete"/>
<attnum name="texture size" val="15" unit="m"/>
<attnum name="texture mipmap" val="4.0"/>
<attnum name="friction" val="1.0"/>
<attnum name="rolling resistance" val="0.005"/>
<attstr name="bump name" val="grtiled.rgb"/>
<attnum name="bump size" val="2.0" unit="m"/>
<attnum name="roughness" val="0.01"/>
<attnum name="roughness wavelength" val="0.2"/>
</section>
For example I have created a surface for the asphalt called asphalt-vte:
<section name="Surfaces">
&default-surfaces;
<section name="asphalt-vte">
<attnum name="color R1" val="0.2"/>
<attnum name="color G1" val="0.2"/>
<attnum name="color B1" val="0.2"/>
<attnum name="color R2" val="0.3"/>
<attnum name="color G2" val="0.3"/>
<attnum name="color B2" val="0.3"/>
<attstr name="texture name" val="tr-asphalt-l_nmm.rgb"/>
<attstr name="texture type" in="discrete, continuous" val="discrete"/>
<attnum name="texture size" val="50.0" unit="m"/>
<attnum name="texture mipmap" val="0.0" unit="m"/>
<attstr name="bump name" val="bump-as.rgb"/>
<attnum name="bump size" val="2.0" unit="m"/>
<attnum name="friction" val="1.4"/>
<attnum name="rolling resistance" val="0.0012"/>
<attnum name="roughness" val="0.005"/>
<attnum name="roughness wavelength" val="0.5"/>
</section>
</section>
And now I have to put this name on the segments of the track (in every segment that you want to use this surface).
section name="Track Segments">
<!--******************************-->
<!-- Segment 1 -->
<!--******************************-->
<section name="recta1">
<attstr name="type" val="str" />
<attnum name="lg" unit="m" val="200.0" />
<attnum name="z start" unit="m" val="0.0" />
<attnum name="z end" unit="m" val="0.0" />
<attstr name="surface" val="asphalt-vte" />
<!--Left part of segment-->
The environment mapping is the texture that is reflected on the car, to get a good effect you have to make a soft image.
You have to copy this section into the graphic section.
<section name="Environment Mapping">
<section name="general">
<attstr name="env map image" val="env.png"/>
</section>
</section>

No environment mapping.


Exaggerated environment mapping.


Good environment mapping.
With this option we can make sharp edger on the track that makes the car jump.
We can use the following two tags to indicate the profil tangent the start and/or the end of the segment:
<attnum name="profil start tangent" unit="%" val="3"/>
<attnum name="profil end tangent" unit="%" val="3"/>

<attnum name="profil start tangent" unit="%" val="-15"/>

<attnum name="profil end tangent" unit="%" val="15"/>
If we use 0% the result is a soft edge with two segments of the track.

<attnum name="profil start tangent" unit="%" val="0"/>
We can indicate the number of steps for a segment of the track.
<attnum name="profil steps" val="4"/>
We can also set the profil as a spline.
<attstr name="profil" val="spline"/>
<attnum name="profil steps" val="48"/>
Or linear
<attstr name="profil" in="linear,spline" val="spline"/>
Whe can set the leng of each profile step
<section name="Main Track">
<attnum name="width" unit="m" val="20"/>
<attstr name="surface" in="asphalt,concrete,grass,sand,dirt" val="asphalt-lines"/>
<attnum name="rside width" val="4"/>
<attstr name="rside surface" val="grass"/>
<attstr name="rside type" in="level,tangent" val="level"/>
<attnum name="lside width" val="4"/>
<attstr name="lside surface" val="grass"/>
<attstr name="lside type" in="level,tangent" val="level"/>
<attnum name="profil steps length" val="5" unit="m"/>
It's possible to use a elevation file to create the terrain.
<section name="Terrain Generation">
<attnum name="track step" unit="m" val="20" />
<attnum name="border margin" unit="m" val="80" />
<attnum name="border step" unit="m" val="30" />
<attnum name="border height" unit="m" val="1" />
<attstr name="orientation" val="clockwise" />
<attstr name="elevation map" val="elevation-map.png"/>
<attnum name="maximum altitude" val="20"/>
<attnum name="minimum altitude" val="-20"/>
<attnum name="group size" val="150"/>
</section>
The file elevation-map.png must have an alpha channel and be black an white (have a look at the file provided here in for the test track).
First create the elevation file of the track:
C:\Archivos de programa\torcs>trackgen -c road -n test -a -E 1
GfParmReadFile: Openning "tools/trackgen/trackgen.xml" (0014CFCC)
loading windows module modules/track/track.dll
LoadLibrary from modules/track/track.dll
LoadLibrary return from modules/track/track.dll
calling modInfo from modules/track/track.dll
>>> modules/track/track.dll >>>
windows module modules/track/track.dll loaded
GfParmReadFile: Openning "tracks/road/test/test.xml" (00151094)
GfParmReadFile: Openning "tracks/road/test/test.xml" (001B056C)
Track step: 20.00 ++++++++++++ Track ++++++++++++
name = test
author = Vicente Marti
filename = tracks/road/test/test.xml
nseg = 302
version = 4
length = 1265.483521
width = 14.000000
pits = 0
XSize = 571.599976
YSize = 218.000031
ZSize = 21.047829
Delta X = -0.000092
Delta Y = 0.000397
Delta Z = 0.000000
Delta Ang = 0.000002 (0.000119)
=== Indices Array Size = 19160
=== Vertex Array Size = 57480
=== Tex Coord Array Size = 38320
(457.599976, 207.999985, 11.704998), (457.599976, 206.999985, 12.704998)
(407.599976, 207.999985, 11.494546), (407.599976, 206.999985, 12.494546)
(457.599792, 126.999985, 15.811872), (457.599793, 127.999985, 16.811872)
(507.599792, 126.999985, 10.575890), (507.599793, 127.999985, 11.575890)
=== Indices really used = 6522
Track step: 20.00 Border margin: 80.00 step: 30.00 height: 1.00GenerateMes
h: right, reverse order, interior
Relief: 0 vtx, 0 seg
Load Chains
Segments = 302
xmin = 35.599823 ymin = 30.000000
xmax = 535.568298 ymax = 186.999985
Chains = 1
4147 Nodes
Renum Nodes, Triangles, Sides
GenerateMesh: left, normal order, exterior
Relief: 0 vtx, 0 seg
Load Chains
Segments = 306
xmin = -80.000000 ymin = -80.000000
xmax = 651.599976 ymax = 298.000031
Chains = 2
1648 Nodes
Renum Nodes, Triangles, Sides
Generating Elevation Map tracks/road/test/test-elv.png (1024, 529)
100% |**************************************************************| row 529
The file created is:

Start the GIMP, and create a new file with transparent background and the same size (pixels) of test-elv.png.
Now open the test-elv.png with the gimp, select the image copy and paste the image on the new transparent document. Modify the image on the new document, for example I have painted some dark areas (the dark pixel is the lowest height and the whiter pixel is the higher).
The result is:

Now save the image as elevation-map.png save the alpha chanel have an alpha chanel and be black an withe.
Now create the track:
C:\Archivos de programa\torcs>trackgen -c road -n test -a
GfParmReadFile: Openning "tools/trackgen/trackgen.xml" (0014CFBC)
loading windows module modules/track/track.dll
LoadLibrary from modules/track/track.dll
LoadLibrary return from modules/track/track.dll
calling modInfo from modules/track/track.dll
>>> modules/track/track.dll >>>
windows module modules/track/track.dll loaded
GfParmReadFile: Openning "tracks/road/test/test.xml" (00151084)
GfParmReadFile: Openning "tracks/road/test/test.xml" (001B056C)
Track step: 20.00 ++++++++++++ Track ++++++++++++
name = test
author = Vicente Marti
filename = tracks/road/test/test.xml
nseg = 302
version = 4
length = 1265.483521
width = 14.000000
pits = 0
XSize = 571.599976
YSize = 218.000031
ZSize = 21.047829
Delta X = -0.000092
Delta Y = 0.000397
Delta Z = 0.000000
Delta Ang = 0.000002 (0.000119)
=== Indices Array Size = 19160
=== Vertex Array Size = 57480
=== Tex Coord Array Size = 38320
(457.599976, 207.999985, 11.704998), (457.599976, 206.999985, 12.704998)
(407.599976, 207.999985, 11.494546), (407.599976, 206.999985, 12.494546)
(457.599792, 126.999985, 15.811872), (457.599793, 127.999985, 16.811872)
(507.599792, 126.999985, 10.575890), (507.599793, 127.999985, 11.575890)
=== Indices really used = 6522
Track step: 20.00 Border margin: 80.00 step: 30.00 height: 1.00Loading Ele
vation Map tracks/road/test/elevation-map.png
GenerateMesh: right, reverse order, interior
Relief: 0 vtx, 0 seg
Load Chains
Segments = 302
xmin = 35.599823 ymin = 30.000000
xmax = 535.568298 ymax = 186.999985
Chains = 1
4147 Nodes
Renum Nodes, Triangles, Sides
GenerateMesh: left, normal order, exterior
Relief: 0 vtx, 0 seg
Load Chains
Segments = 306
xmin = -80.000000 ymin = -80.000000
xmax = 651.599976 ymax = 298.000031
Chains = 2
1648 Nodes
Renum Nodes, Triangles, Sides
The result in torcs is:

To get good results you have to make a smooth elevation-map.png.
If you don't save the png image correcty you will have problems and trackgen, the image won't be loaded and is reported by the trackgen output (/test/elevation-map.png bad byte count... 3072 instead of 4096).
C:\Archivos de programa\torcs>trackgen -c road -n test -a
GfParmReadFile: Openning "tools/trackgen/trackgen.xml" (0014CFBC)
loading windows module modules/track/track.dll
LoadLibrary from modules/track/track.dll
LoadLibrary return from modules/track/track.dll
calling modInfo from modules/track/track.dll
>>> modules/track/track.dll >>>
windows module modules/track/track.dll loaded
GfParmReadFile: Openning "tracks/road/test/test.xml" (00151084)
GfParmReadFile: Openning "tracks/road/test/test.xml" (001B056C)
Track step: 20.00 ++++++++++++ Track ++++++++++++
name = test
author = Vicente Marti
filename = tracks/road/test/test.xml
nseg = 302
version = 4
length = 1265.483521
width = 14.000000
pits = 0
XSize = 571.599976
YSize = 218.000031
ZSize = 21.047829
Delta X = -0.000092
Delta Y = 0.000397
Delta Z = 0.000000
Delta Ang = 0.000002 (0.000119)
=== Indices Array Size = 19160
=== Vertex Array Size = 57480
=== Tex Coord Array Size = 38320
(457.599976, 207.999985, 11.704998), (457.599976, 206.999985, 12.704998)
(407.599976, 207.999985, 11.494546), (407.599976, 206.999985, 12.494546)
(457.599792, 126.999985, 15.811872), (457.599793, 127.999985, 16.811872)
(507.599792, 126.999985, 10.575890), (507.599793, 127.999985, 11.575890)
=== Indices really used = 6522
Track step: 20.00 Border margin: 80.00 step: 30.00 height: 1.00tracks/road
/test/elevation-map.png bad byte count... 3072 instead of 4096
GenerateMesh: right, reverse order, interior
Relief: 0 vtx, 0 seg
Load Chains
Segments = 302
xmin = 35.599823 ymin = 30.000000
xmax = 535.568298 ymax = 186.999985
Chains = 1
4147 Nodes
Renum Nodes, Triangles, Sides
GenerateMesh: left, normal order, exterior
Relief: 0 vtx, 0 seg
Load Chains
Segments = 306
xmin = -80.000000 ymin = -80.000000
xmax = 651.599976 ymax = 298.000031
Chains = 2
1648 Nodes
Renum Nodes, Triangles, Sides
Terrain
elevation using the elevation-map.png
Its also explained how to create the terrain elevation using the elevation-map.png in the TORCS track HOWTO ( http://www.idiap.ch/~dimitrak/torcs/track-howto.html )
It's possible to use a png image to specify the objects on the track.
The default objects ore in:
<!ENTITY default-objects SYSTEM "../../../data/tracks/objects.xml">
To add the object map to the xml file of the track you must add at the beginning of the xml file
<!DOCTYPE params SYSTEM "../../../src/libs/tgf/params.dtd" [
<!-- general definitions for tracks -->
<!ENTITY default-surfaces SYSTEM "../../../data/tracks/surfaces.xml">
<!ENTITY default-objects SYSTEM "../../../data/tracks/objects.xml">
]>
and at the terrain generation section:
<section name="Terrain Generation">
<section name="Object Maps">
<section name="map 1">
<attstr name="object map" val="object-map.png"/>
</section>
</section>
and a new section for the objects:
<section name="Objects">
&default-objects;
<section name="tree-vte1">
<attstr name="object" val="tree-vte1.ac"/>
<attnum name="color" val="0x00FF01"/>
<attstr name="orientation type" val="random"/>
<attnum name="delta height" val="4.0"/>
<attnum name="delta vert" val="10.0"/>
</section>
<section name="stadn-vte">
<attstr name="object" val="stadium-vte1.ac"/>
<attnum name="color" val="0x1000FF"/>
<attstr name="orientation type" val="standard"/>
<attnum name="orientation" val="0" unit="deg"/>
</section>
</section>
You can use the default objects and you can add your own objects (for exaple hte tree-vte1 and stadn-vte). You must copy the files of your ac files of the objects in the test (or your trackname) folder.
The trees have a random orientation, and the stadium a orientation with regard tho the main track. The angle is: (the objects are orientated with regard to the x,y,z coordinates and the angle is with regard to the x axis.

The orientation of the stadium-vte1.ac is:

and the orientation of the track.

To create the object map, create a image of the track: trackgen -c road -n test -E 2.

Start the GIMP, and create a new file with transparent background and the same size (pixels) of test-elv.png (1024x529).
Fill the image with color black (0x000000). Open the test-elv2.png as a new layer, create a new layer and paint pixels of the color of the objects on this layer using the test-elev2.png as a template.

Finally hide the test-elv2.png layer and save the png file. The result is:

The result is:

The default objects are:
<section name="tree1">
<attstr name="object" val="tree1.ac"/>
<attnum name="color" val="0x00FF00"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree2">
<attstr name="object" val="tree2.ac"/>
<attnum name="color" val="0x00F000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree3">
<attstr name="object" val="tree3.ac"/>
<attnum name="color" val="0x00E000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree4">
<attstr name="object" val="tree4.ac"/>
<attnum name="color" val="0x00D000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree5">
<attstr name="object" val="tree5.ac"/>
<attnum name="color" val="0x00C000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree6">
<attstr name="object" val="tree6.ac"/>
<attnum name="color" val="0x00B000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree7">
<attstr name="object" val="tree7.ac"/>
<attnum name="color" val="0x00A000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree8">
<attstr name="object" val="tree8.ac"/>
<attnum name="color" val="0xFFFF00"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree9">
<attstr name="object" val="tree9.ac"/>
<attnum name="color" val="0xF0F000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree10">
<attstr name="object" val="tree10.ac"/>
<attnum name="color" val="0xE0E000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree11">
<attstr name="object" val="tree11.ac"/>
<attnum name="color" val="0xD0D000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree12">
<attstr name="object" val="tree12.ac"/>
<attnum name="color" val="0xC0C000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree13">
<attstr name="object" val="tree13.ac"/>
<attnum name="color" val="0xB0B000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree14">
<attstr name="object" val="tree14.ac"/>
<attnum name="color" val="0xA0A000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree15">
<attstr name="object" val="tree15.ac"/>
<attnum name="color" val="0xFF8000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree16">
<attstr name="object" val="tree16.ac"/>
<attnum name="color" val="0xE08000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="tree17">
<attstr name="object" val="tree17.ac"/>
<attnum name="color" val="0xA08000"/>
<attstr name="orientation type" val="random"/>
</section>
<section name="treeg1">
<attstr name="object" val="treeg1.ac"/>
<attnum name="color" val="0xA04000"/>
<attstr name="orientation type" val="random"/>
<attnum name="delta height" val="4.0"/>
<attnum name="delta vert" val="10.0"/>
</section>
<section name="stadn">
<attstr name="object" val="stadium1.ac"/>
<attnum name="color" val="0x0000FF"/>
<attstr name="orientation type" val="standard"/>
<attnum name="orientation" val="180" unit="deg"/>
</section>
<section name="stads">
<attstr name="object" val="stadium1.ac"/>
<attnum name="color" val="0x0000FE"/>
<attstr name="orientation type" val="standard"/>
<attnum name="orientation" val="0" unit="deg"/>
</section>
<section name="stade">
<attstr name="object" val="stadium1.ac"/>
<attnum name="color" val="0x0000FD"/>
<attstr name="orientation type" val="standard"/>
<attnum name="orientation" val="90" unit="deg"/>
</section>
<section name="stadw">
<attstr name="object" val="stadium1.ac"/>
<attnum name="color" val="0x0000FC"/>
<attstr name="orientation type" val="standard"/>
<attnum name="orientation" val="270" unit="deg"/>
</section>
We will work on the test.ac file that we have created (this file must work into torcs). Copy the file to test-bak.ac.
Now to create the file of the shading run
accc +shad test-bak.ac test-shade.ac
Finally we are going to combine the shading and the description of the track into one file (test.acc):
accc -g test.acc -l0 test-bak.ac -l1 test-shade.ac -d3 1000 -d2 500 -d1 300 -S 300 -es
The shading of the track is in the file shadow2.rgb. To create this file open test.blend in blender.
Create a cam. The cam must be on the z axis and the dimensions of the render must be the same as the test-elev.png (in this case 1024 x 529), click on F10 and set this dimensions.
create a light on the same position that is in the xml file:
<section name="Graphic">
<attnum name="light position x" val="-10000"/>
<attnum name="light position y" val="10000"/>
<attnum name="light position z" val="7000"/>
To set up the possition select the light and click on the n key. The lamp mus be ray shadow and the kind of light lamp or sun. You can also specify the power and other parameters (for example the lens of the camera, I have used a lens of 35). You must set the clip end of the camera to 2000 or above. Finally center the camera on the track.

To center the camera

So the centre values are:
![]()
![]()

you have to set up the z value to get all the track inside the area, Z = 727,129:

rendering the image and saving as png 100% quality (F3):

resize this file to a power of 2 (1024 x 512 for example) and save as shadow2.rgb. You can adjust the bright and the contrast of the image (or increase the power of the lamp) and smooth the shadows with the gimp. You can also paint the image with other colors: green, red...:

Finally change on the xml file
<section name="Graphic">
<attstr name="3d description" val="test.acc" />
Run torcs and enjoy your track with the shadows:

*** Some tags that I don't understand
I dont know how works sone things in torcs, I decided to explain it here. Please, if you know how i can solve some of these "problems" post it on the formula 1 torcs forum and I will include it on the tutorial and of course I will add you as the autor of the topic:
http://www.s8.createphpbb.com/f1torcs
Thanks.
Left &
Right part of segment
<attstr name="type" in="level,tangent" val="level"/>
that is used for
<!--Left part of segment-->
<section name="Left Side">
and
<!--Right part of segment-->
<section name="Right Side">
When we finish to modify the xml file of the track, we will create the track wiht the terrain using trackeditor (read the beginning of this tutorial). Make sure that the track is OK, it's to say, the xml is perfect and we won't make any change on it. In order to do this, you should test the track into torcs in several races.
If the track is OK, now we can modify the track with blender.
First of all make a bakcup of the original track, go to the folder tracks/category/name and copy name.ac to name-backup.ac.
Open blender and go to File -> Import ->AC3D (.ac) and select name.ac. Your track will be loaded into blender. You must put the textures of the track in the same folder of the name.ac in order to be loaded by torcs, you can copy them from trocs/data/textures.
Save the track 3d description of the track as name.blend (File -> Save As) in the folder tracks/category/name. Now you can edit this file.
One unit in blender is one meter of the real track when you export to TORCS.
Add new objects (the objests must have triangles, so convert squared faces to triangles (select the faces into blender and pres Crtl + T)), modify them, add uv mapping.
You can Append objects in an easy way. Go to File ->Append and select the blender file you want to append. This is useful to add trees, adverts... to your track in an easy way and we can create objets ready to append to the tracks. The objet will be appent to your track, so now you can move it, scale and put it in the right place.
If you want to make a copy of one object, just pres Shift + D, you can move the copy by moving the mouse, very easy, isn't it?
If you want to make a new object, for example a bridge with and advert I recomend you to create first the object in a new blender file and then Appent it to your track.
To export the car into ac format that is readable by torcs you have to use the TORCS AC3D exporter. You can find this phyton script with this document. To install the script just copy the file ac3d_torcs_export.py to Blender Foundation\Blender\.blender\scripts. Now the exporter is available in the export menu.
To export the ac file, select all objects (press a a) and go to File -> Export ->TORCS AC3D (.ac): name.ac. (If you have problens to export because blender crashes, reopen the name.blender, press aa, File -> Export ->TORCS AC3D (.ac): name.ac without doing any modification to the mesh, I think it's a bug of Blender that will be solved in a future).
Now test the new 3d description of the track into torcs, enjoy it.
Now I will show you an example: modify the test track.
Copy the test.ac file in a new folder called test_blender.
Copy the textures that uses your track from trocs/data/textures (You
can copy all if you don't want to search for every textures) to
test_blender folder.
Open blender and click on File -> Import ->AC3D (.ac). Select
test.ac. You track will be loaded into blender.

Save the track 3d description of the track as test_blender.blend
(File -> Save As) in the folder test_blender. Now you can edit
this file.
The next step is edit the track. I'm going to change the TORCS logo
of the start by a new one: Formula 1 Torcs. First of all create this
texture with the GIMP anc copy it to test_blender folder:
f1_torcs_logo.rgb (512x256 pixels)

Select the object and click on the / key on the keyboard in order to
edit the object. Change the Object mode to UV face select mode


The in another quadrant select the UV/Image editor.
Now click on Image -> Open and Select the image f1_torcs_logo.rgb that we have created

Finally, select the faces of the (right click to the face and mayus to add new faces) in the UV face select view and in the UV/Image editorview select all the vertex (click b and drag the mouse). Scale (click s key) and rotate (click r key) to fit the poligons to the logo

Now you can see the result in the 3d view.

Now we will add an advert to the track.
Open the track with blender
Click on file append (Shift F1). Select advert.blend and Object ->
advert_f1_torcs and then click on load library. The object will be
loaded into blender and placed near to 0,0,0.
Select the object by right click amd move it to the right place.

You can make new copies of the selected object using the Shift + D
keys.
You can change the texture of the advert. For example we will
change it for the michelin_logo.rgb.
Select the object and clik on /. Then Go to UV Face Select and select the faces you want to change the texture.

Select the object and clik on /. Then Go to UV Face Select and select the faces you want to change the texture. In the UV mapping window go to Image -> Open and select the michelin_logo.rgb. Change the UV size... and now you have the advert ready.

You can also import directly an ac file to your track.blend. For
example a tree from the torcs/data/objects folder.

Now you can export the track: select all object (click the a key)
but don't select the cam and the lamp and click on File ->export
-> AC3D TORCS.
Copy this file (test.ac) and the new textures to the test folder
(trocs/tracks/test).
Run torcs and enjoy your new track.

We can make a real track with trackeditor.
We can search the track map of the real track on Google Earth:

With the selection tool, select the track and paint it with black in a new layer. Now hide the original layer. You have to select the scale too, the scale will be our reference to make the tack to scale. (We can adjust later the track length with the option on trackeditor.)

Now we have to create the track with trackeditor and test the track into torcs.

You can also serah more images on the internet, for example I have found this one:

Which has a good detail of the new turn of la caixa:

So if we want a more actual track we have to modify these turn with trackeditor. Moreover with the aid of trackeditor we have to add the track-border with the aid of the background image. Finally we have the final track and we are sure we won't modify the track any more.
So, now we have to edit the xml file in order to make a good banking and height steps.
You can create a video around your track in an easy way, you just need an open source video editing program: VirtualDubMod.
Create the images (png) with TORCS
You have to set up the torcs/confing/raceengine.xml.
<section name="Movie Capture">
<attstr name="enable capture" in="yes,no" val="yes"/>
<attnum name="fps" val="5"/>
<attstr name="output directory" val="\Archivos de programa\torcs\movies"/>
</section>
You have to set up the eneble capture (yes), set the number of frames per second (fps) and finally the output directory.
Run torcs and to make the movie press the c button in your keyboard. The png images for you video will be saved into the output directory.
The name of the images is: torcs-0001-00000000.png, torcs-0001-00000001.png, torcs-0001-00000002.png, torcs-0001-00000003.png...
Create the video from the png images.
Now we will use VirtualDubMod. Start this program and click on File -> Open Video File and select torcs-0001-00000000.png and click on Open, (al the images created with torcs will be loaded into VirtualDubMod.

Go to video -> Frame Rate and set up the frame rate you have choosen in the torcs/confing/raceengine.xml.
Now File -> Save as and select the video compression and type the name of the video and click on Save. It can take a while, and your video will be created.
If you want you can modify the video with the tools provided with VirtualDubMod, change the resolution...
Enjoy it.
You can record the sound that is sounding on your speakers, you just need an open source sound editing program: Audacity.
Record the sound from TORCS with Audacity.
Open Audacity and select the stereo mix option (it is the type of reconding we want). Adjust the volume of the input (the michrophone that is drawn to in the display net to the mix option):0,05 or 0,01%.

Press the record button and run torcs. Play with torcs and the sound will be recorded into this audio file in audacity. Now you can save the waw, ogg or mp3 (you will need to download the lame_enc.dll from the Internet because is not provided with audacity) file by clicking on File -> save.
Congratulations you have the audio file of your lap in torcs. Now you can edit the audio file with the tools provided with torcs.
You can mix the sound and audio file with the aid of VirtualDubMod.
Open your video file in VirtualDubMod, then go to Stream -> Stream List and click on Add then select your audio file. Right click on the text that will apear and select the option Full processing mode. Afther that right click and select the Audio compression.
Your audio is ready.
Finally you can save the video file with the audio: File -> Save as and select the video compression and type the name of the video and click on Save. It can take a while, and your video will be created.
It's very simple to create a car.
I will explain how to make a car for torcs in windows.
Import the ac file of an existing car into blender.
Add new objects, modify them, add uv mapping.
Finally convert squared faces to triangles (select the faces into blender and pres Crtl + T).
Export the car into ac format.
Now we have to make the acc files, these are the carshape files for torcs.
To create these files first of all create a directory on your hard disk. For example: c:\tmp.
Now copy into this directory accc.exe (from your torcs installation directory) and stripe.exe (is not provided with torcs).
You can get stripe.exe for windows with this document (stripe.zip) or serch the web.
To install it, unzip and copy stripe.exe into the same directory of accc.exe
Copy your ac file into the C:\tmp directory and go to Start > Run > cmd.
Change the directory to your C:\tmp. It's to say type "cd C:\tmp" into the console.
To run accc.exe type into the console: "accc +es 0 my_carshpe.ac my_carshpe.acc" Now you have your acc files for torcs.
You can modify the physics of the car and other properties by modifying the xml file.