build your torcs track in 20 minutes

67
Build your track Build your track for TORCS in 20 for TORCS in 20 minutes 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:04/01/07 Version v1.01

Upload: api-3715720

Post on 11-Apr-2015

974 views

Category:

Documents


16 download

DESCRIPTION

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.

TRANSCRIPT

Page 1: Build Your Torcs Track in 20 Minutes

Build your trackBuild your track for TORCS in 20for TORCS in 20

minutesminutes

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í CentellesLast modification:04/01/07

Version v1.01

Page 2: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 2 / 67

Contents of the tutorial

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

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 3: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 3 / 67

1 About the tutorial

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 04/01/07

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 4: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 4 / 67

2 Open source Programs needed and useful tutorials

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 SimulatorWe 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 GIMPWe will use this software to edit the images and textures.

BlenderWe can edit the 3d description of the track or a track (ac file) in an easy way.

TrackeditorThis software is provided with torcs. We can make tracks with this.

TrackgenThis software is provided with torcs. We can make tracks from the xml file.

A text editorYou can use you favourite text editor to edit the xml files, for example Scintilla Text Editor.

AudacityUsed to record the sound from torcs.

VirtualDubModWe will use this software to create a video from the generated images with the movie tool from torcs.

OpenOfficeI have used this software to create this tutorial.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 5: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 5 / 67

3 Test track

3.1 The xml file of the original track 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.xmlauto generated : by Track Editorversion : v 0.6.0 24/4/2005copyright : (C) 2005 by Charalampos Alexopoulosemail : --><!--This program is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published bythe 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">]>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 6: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 6 / 67

<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" />

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 7: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 7 / 67

</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-->

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 8: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 8 / 67

</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" />

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 9: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 9 / 67

<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" />

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 10: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 10 / 67

<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-->

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 11: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 11 / 67

<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" />

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 12: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 12 / 67

</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> <!--******************************-->

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 13: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 13 / 67

<!-- 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">

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 14: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 14 / 67

<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">

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 15: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 15 / 67

<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.

3.2 Test the track into torcs: trackgen. 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)

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 16: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 16 / 67

-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]

3.3 Hand edit the track: banking. 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

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 17: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 17 / 67

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:

3.3.1 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 15curve2: banking start 15, banking end 15curve3: banking start 15, banking end 0

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 18: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 18 / 67

<!--******************************--> <!-- 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"/>

3.3.2 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: 0curve2: z start left: 3, z start ritght: 0, z end left: 3, z start ritght: 0

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 19: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 19 / 67

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:

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 20: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 20 / 67

curve1: z end left: 3, z start ritght: 0curve2: z end left: 3, z start ritght: 0curve3: 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"/>

3.4 Hand edit the track: grade. We can add the grade (slope) of the track.

Track without grade:

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 21: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 21 / 67

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: 0Segment 2: z end left: 3, z end right: 0Segment 3: z end left: 3, z end right: 0Segment 4: z end left: 0, z end ritght: 0Segment 5: grade = 10 %Segment 6: grade = - 10 %Segment 7: grade = - 2 %Segment 8: no z specificationSegment 9: no z specificationSegment 10:z end 0

The segments are:

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Segment 9

Segment 1 Segment 2

Segment 3

Segment 4Segment 5Segment 6

Segment 7Segment 8

Segment 10

Page 22: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 22 / 67

Segment 1: recta1Segment 2: curve1Segment 3: curve2Segment 4: curve3Segment 5: recta2Segment 6: curve4Segment 7: curve5Segment 8: recta3Segment 9: curve6Segment 10: straight 2

3.5 Graphic section. 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"/>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 23: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 23 / 67

<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"/>

3.6 Starting Grid section.

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>

3.7 Turn marks 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"/>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 24: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 24 / 67

<!--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.

3.8 Cams section.

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: recta1Segment 2: curve1Segment 3: curve2Segment 4: curve3Segment 5: recta2Segment 6: curve4Segment 7: curve5Segment 8: recta3Segment 9: curve6Segment 10: straight 2

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 25: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 25 / 67

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>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 26: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 26 / 67

</section>

3.9 Surface 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"/>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 27: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 27 / 67

<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-->

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 28: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 28 / 67

3.10 Environment Mapping.

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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 29: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 29 / 67

Exaggerated environment mapping.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 30: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 30 / 67

Good environment mapping.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 31: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 31 / 67

3.11 Profil tangentWith 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"/>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 32: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 32 / 67

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

If we use 0% the result is a soft edge with two segments of the track.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 33: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 33 / 67

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

3.12 Profil steps.

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"/>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 34: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 34 / 67

<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"/>

3.13 Elevation files of the terrain. 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 1GfParmReadFile: Openning "tools/trackgen/trackgen.xml" (0014CFCC)loading windows module modules/track/track.dllLoadLibrary from modules/track/track.dllLoadLibrary return from modules/track/track.dllcalling modInfo from modules/track/track.dll>>> modules/track/track.dll >>>windows module modules/track/track.dll loadedGfParmReadFile: Openning "tracks/road/test/test.xml" (00151094)GfParmReadFile: Openning "tracks/road/test/test.xml" (001B056C)Track step: 20.00 ++++++++++++ Track ++++++++++++name = testauthor = Vicente Martifilename = tracks/road/test/test.xmlnseg = 302version = 4length = 1265.483521width = 14.000000pits = 0XSize = 571.599976YSize = 218.000031ZSize = 21.047829Delta X = -0.000092Delta Y = 0.000397Delta Z = 0.000000

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 35: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 35 / 67

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 = 6522Track step: 20.00 Border margin: 80.00 step: 30.00 height: 1.00GenerateMesh: right, reverse order, interiorRelief: 0 vtx, 0 segLoad ChainsSegments = 302xmin = 35.599823 ymin = 30.000000xmax = 535.568298 ymax = 186.999985Chains = 14147 NodesRenum Nodes, Triangles, SidesGenerateMesh: left, normal order, exteriorRelief: 0 vtx, 0 segLoad ChainsSegments = 306xmin = -80.000000 ymin = -80.000000xmax = 651.599976 ymax = 298.000031Chains = 21648 NodesRenum Nodes, Triangles, SidesGenerating 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

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 36: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 36 / 67

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 -aGfParmReadFile: Openning "tools/trackgen/trackgen.xml" (0014CFBC)loading windows module modules/track/track.dllLoadLibrary from modules/track/track.dllLoadLibrary return from modules/track/track.dllcalling modInfo from modules/track/track.dll>>> modules/track/track.dll >>>windows module modules/track/track.dll loadedGfParmReadFile: Openning "tracks/road/test/test.xml" (00151084)GfParmReadFile: Openning "tracks/road/test/test.xml" (001B056C)Track step: 20.00 ++++++++++++ Track ++++++++++++name = testauthor = Vicente Martifilename = tracks/road/test/test.xmlnseg = 302version = 4length = 1265.483521width = 14.000000pits = 0XSize = 571.599976YSize = 218.000031ZSize = 21.047829Delta X = -0.000092Delta Y = 0.000397Delta Z = 0.000000Delta Ang = 0.000002 (0.000119)=== Indices Array Size = 19160=== Vertex Array Size = 57480

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 37: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 37 / 67

=== 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 = 6522Track step: 20.00 Border margin: 80.00 step: 30.00 height: 1.00Loading Elevation Map tracks/road/test/elevation-map.pngGenerateMesh: right, reverse order, interiorRelief: 0 vtx, 0 segLoad ChainsSegments = 302xmin = 35.599823 ymin = 30.000000xmax = 535.568298 ymax = 186.999985Chains = 14147 NodesRenum Nodes, Triangles, SidesGenerateMesh: left, normal order, exteriorRelief: 0 vtx, 0 segLoad ChainsSegments = 306xmin = -80.000000 ymin = -80.000000xmax = 651.599976 ymax = 298.000031Chains = 21648 NodesRenum Nodes, Triangles, Sides

The result in torcs is:

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 38: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 38 / 67

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 -aGfParmReadFile: Openning "tools/trackgen/trackgen.xml" (0014CFBC)loading windows module modules/track/track.dllLoadLibrary from modules/track/track.dllLoadLibrary return from modules/track/track.dllcalling modInfo from modules/track/track.dll>>> modules/track/track.dll >>>windows module modules/track/track.dll loadedGfParmReadFile: Openning "tracks/road/test/test.xml" (00151084)GfParmReadFile: Openning "tracks/road/test/test.xml" (001B056C)Track step: 20.00 ++++++++++++ Track ++++++++++++name = testauthor = Vicente Martifilename = tracks/road/test/test.xmlnseg = 302version = 4length = 1265.483521width = 14.000000pits = 0XSize = 571.599976YSize = 218.000031ZSize = 21.047829Delta X = -0.000092Delta Y = 0.000397Delta Z = 0.000000Delta 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 = 6522Track step: 20.00 Border margin: 80.00 step: 30.00 height: 1.00tracks/road/test/elevation-map.png bad byte count... 3072 instead of 4096GenerateMesh: right, reverse order, interiorRelief: 0 vtx, 0 segLoad ChainsSegments = 302xmin = 35.599823 ymin = 30.000000xmax = 535.568298 ymax = 186.999985Chains = 14147 NodesRenum Nodes, Triangles, SidesGenerateMesh: left, normal order, exteriorRelief: 0 vtx, 0 segLoad ChainsSegments = 306xmin = -80.000000 ymin = -80.000000xmax = 651.599976 ymax = 298.000031Chains = 2

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 39: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 39 / 67

1648 NodesRenum 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 )

3.14 Object Map: add objects to the track. 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"/>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 40: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 40 / 67

</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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 41: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 41 / 67

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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 42: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 42 / 67

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

The result is:

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 43: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 43 / 67

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">

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 44: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 44 / 67

<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>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 45: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 45 / 67

<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>

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 46: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 46 / 67

3.15 Shading of the track: the acc file. 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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 47: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 47 / 67

To center the camera

So the centre values are:

x=x1 x2

2=−80651,6

2=285,8

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 48: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 48 / 67

y=y1 y2

2=−80298,0

2=109,0

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):

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 49: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 49 / 67

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:

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 50: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 50 / 67

*** 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">

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 51: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 51 / 67

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 52: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 52 / 67

4 Edit the ac file created with trackgen with blender.

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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 53: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 53 / 67

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

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 54: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 54 / 67

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

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 55: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 55 / 67

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

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 56: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 56 / 67

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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 57: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 57 / 67

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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 58: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 58 / 67

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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 59: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 59 / 67

5 Make a real 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.)

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 60: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 60 / 67

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

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 61: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 61 / 67

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:

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 62: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 62 / 67

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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 63: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 63 / 67

6 Create a video from TORCSYou can create a video around your track in an easy way, you just need an open source video editing program: VirtualDubMod.

6.1 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...

6.2 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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 64: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 64 / 67

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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 65: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 65 / 67

7 Create a adio file from TORCS. You can record the sound that is sounding on your speakers, you just need an open source sound editing program: Audacity.

7.1 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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 66: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 66 / 67

8 Mixing the adio file and the video file from 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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS

Page 67: Build Your Torcs Track in 20 Minutes

F1 TORCS Build your track for TORCS in 20 minutes v1.01 67 / 67

9 How to create a Formula 1 car for TORCS.

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.

Vicente Martí Centelles Last modification:04/01/07 Formula 1 TORCS