Tracks
- The Concept
A track
is a collection of geometrical objects and physical descriptions. |
|
This document describes how Racer tracks are structured. There
is a Track Editor available which deals with a lot of issues when generating
tracks (actually, the name may suggest that you can create tracks from scratch,
but in fact you create tracks in 3D packages like 3D Studio Max or Maya). For
information on how to use the editor, see the TrackEd
documentation.
If you want to learn how to import tracks from SCGT, go
here.
For a rough explanation on how to convert rFactor tracks to
Racer, visit this page.
I've split this text into various parts:
A track consists of:
- Track models; the road (and grass/fences) are split up into
multiple models. For example, the Carrera track has about 30. This is done
for performance reasons (when a model is not near the car, it is not drawn;
when it is partly visible, it is entirely drawn).
- Trackside models; things like houses, pit buildings, grandstands,
trees etc.
- Sky models; the sky is like a roadside model, but it's special.
Some sky models may move with the player (like is done in SCGT), or just be
plain big and encapsulate the entire track (like is done in GPL). I like the
latter better, as it may help getting nice moving clouds in a huge-looking
sky. The sky also knows a clear color; the screen is filled with this to paint
in places where the sky models doesn't fill the view.
Newer Racer version (v0.8+) need a sky model that encapsulates a track; no movable sky should be used (due to atmosphere calculations). Also, no clear color is used anymore; the sky should fill the entire screen. Using a simple clear color isn't necessary anymore these days, and it's often uglier.
- Track camera definitions; track side cameras (multiple groups
of these may exist, like TV1 and TV2 in Grand Prix Legends for example). These
focus on (a part of) the car or are fixed, just like on television.
- Grid and pit positions; the places where cars are located
when in the pits or on the grid.
- Timelines; lines to determine where start/finish is, and
where other subtimes are located. You must have at least 2 timelines in a
track to avoid the player just reversing over the start/finish line after
just crossing it (and doing a 5 second lap).
- Object properties; for example, flags that indicate whether
models (objects) are surfaces (where you can drive on), if you can collide
with them etc.
- Surface spline definitions
(click for more detailed information). These define the track's slopes in
mathematically smooth curves. These may be omitted, but they are necessary
since just relying on the polygons will make the grade changes be too sudden,
and your track will be very hard to drive at a bit of speed.
- Surface type definitions. The different types of surfaces,
like road, grass, gravel, kerb etc.
Important is the subdivision of the road objects. This has a
big impact on performance, since it is used for surface collision detection
(on what triangle is the car located) and painting (if a model isn't in the
viewing frustum, it isn't painted).
You'll find tracks in Racer's data/tracks/
directory. Every track has its own directory, with most files directly underneath
that.
The most important start is track.ini.
The files you will probably find in a track directory
are:
- track.ini - describes general track information
- geometry.ini - enumerates the 3D objects
that will be loaded to make up the track (and their attributes)
- special.ini - grid & pit positions,
sky clear color, track cameras, timelines, surface types.
- spline.ini - spline definitions.
- bestlaps.ini - a list of the best achievements.
- movables001.ini - a list of movable objects (feature is in beta)
You'll find the track
camera's in special.ini. You can edit most of them using TrackEd, however, some
attributes are only accessable through the ini file. The features are:
- Start and end location, which allows moving camera's
- 2 types of camera's; fixed (stationary), and following (tracks
the car).
- 2 types of zooming; based on the distance to the camera,
and based on the projected distance along the driving direction.
- Ability to dolly (moving camera's, based on the car distance)
- Each camera has a driving direction indicator (which way
the cars more or less when crossing the camera).
- Multiple groups of cameras can exist; this allows you to
give the user 2 or more track views (like switching channels on your TV).
Creating a camera is easy; enter TrackEd, load your track
and select 'Track cameras' mode. The operation buttons will switch to camera
editing. Now click on the track where you want the camera to start, and draw
a line in the car's driving direction. This direction is used to calculate if
the car is currently before or after the camera point, if you use the (default)
projected-distance type camera.
You'll be requested the camera number. The camera ordering MUST be right along
the track; if you don't have camera's placed along the track in the right order,
Racer will have a hard time finding out which camera should be currently used.
The camera is selected as follows:
- The first track camera is always camera 0.
- While driving, Racer looks at the NEXT camera and looks to
see if the car is within the radius (as indicated by the circle in TrackEd).
If so, that camera is selected.
- If the next camera is not yet active, Racer checks to see
if the current car distance is still relatively ok (a margin is used to avoid
accidental flipping of cameras). If so, the current camera stays active.
- If not, the PREVIOUS camera is checked (you may be driving
the wrong way). If it turns out the previous camera is within range, it is
selected.
- If none of the camera's really seem to match, all cameras
are checked and the one closest to the car is selected.
After creating the camera, you may want to edit the radius.
If the car is within the camera's radius, it is selected (but only if this is
the NEXT camera to watch out for). Check the view to see your radius visually.
Use the keys PageUp and PageDown to move through your cameras
(in TrackCam mode).
A track camera has additional properties you can use to
give some live into it.
- A destination position; use this as the end position of the
camera. For a default camera, the closeness of the car is calculated by taking
the distance of the car ALONG THE DRIVING DIRECTION that you specified when
creating the camera (in TrackEd). As the car moves along the camera, the camera
location moves from the start position (where you clicked first in TrackEd)
to the destination position.
- To modify start and end heights, edit the ini file directly
(pos.y and dpos.y).
- The group (tcam.cam0.group for example) gives the group to
which this cam belongs. This allows you to create 2 or more sets (maximum
is 10) of track camera's. Now all I need is a Director Mode. :)
- A start, middle and end zoom (zoom_edge, zoom_close and zoom_far)
is used to set zooming values (=angle in degrees of camera view) at the radius
edge, closest to the camera and far away (for projected-distance, when the
car has passed the camera). Values like 10,30,15 are typical. A value of 1
will select super-zoom-in, a value of 40-50 will render a normal view. Try
larger angles for special effects.
- The flags field determines the characteristics of the camera.
Bits are or-ed together, where:
1=ZOOMDOT; the camera will do projected-distance, meaning that the
camera knows whether the car is still approaching the camera, or is driving
away from it (has passed it).
2=FIXED; the camera will not follow the car, but rather stay at a fixed
orientation (tcam.cam0.rot for example).
4=HILITE; used internally only in TrackEd to highlight a camera.
8=DOLLY; this indicates the camera must move from pos to dpos depending
on how far the camera is located relative to the car being tracked.
To create a flags value, add the numbers of the features you wish to include,
so 9 (a typical value) means 8+1, thus a dollying camera that knows where
the car is relative to the camera.
- Inserting a camera is still a pain and has to be done by
editing the camera ini file (tcam.ini).
- Editing the flags/camtypes is not yet possible from within
TrackEd.
(last
updated
December 30, 2014
)