Track Maker's Guide

Last update july 8th 2011

France.png Version française


This page describes how to "format" your objects in Blender, when making a track, so that the STK 0.7 track exporter will recognize and export its properties.

If you have not already done so, I recommend you read articles Style Guidelines and Licensing (if you are making tracks/karts for your personal enjoyment then you may not need this, but if you wish to submit your contributions for inclusion into SuperTuxKart having read these articles is an definite prerequisite)


Contents

Get the tools

See article Installing the tools to get the proper blender setup


Modelling

Modelling the track model itself is covered in the following articles :

Note that you need to be already somewhat familiar with blender

Texture your models with UV texturing. Your texture images size must be a power of two, e.g. 256x256 or 512x512, in .png or .jpg format (if you use a jpeg texture, give us the original lossless version [e.g. png] along the jpg one so that we have a lossless version)

Blender procedural materials are not supported and most of what you enter in the material buttons window will be ignored. Vertex colors may however be used.

Track-wide properties

Use the STK Browser tools to edit track parameters.

Properties.jpg

IdProperty.jpg


groups, List of groups to which this track belongs. The tracks that are shipped by default with STK are in group "standard"
designer Name of the designer(s) of this track. This is displayed in the track selection menu.
music The .music file to use for this track.
screenshot The name of the screenshot pictures to use. The screenshot is displayed in the track selection menu. Note that the screenshot file must be a 4:3 image scaled into a square size (this is because many GPUs require textures with power-of-two sides, and with powers of 2 you can't create 4:3 images)
arena Yes or no. Declares this track to be an arena for three-strike battle.
sky-type One of 'dome', 'box' or 'simple' (plain color).
sky-texture (for sky dome and sky box) For sky domes : the one texture. For sky boxes : or a space-separated list of 6 textures for a box. The order of the texture is the same as in irrlicht, i.e. top, bottom, left, right, front, back.
sky-horizontal Number of vertices of a horizontal layer of the sphere (sky-dome only).
sky-vertical Number of vertices of a vertical layer of the sphere (sky-dome only).
sky-texture-percent How much of the height of the texture is used. Should be between 0 and 1 (sky-dome only).
sky-sphere-percent How much of the sphere is drawn. Value should be between 0 and 2, where 1 is an exact half-sphere and 2 is a full sphere (sky-dome only) - floating point values supported.
ambient-color Ambient light color, either a "r g b" or "r g b a" value.
sky-color A "r g b" value to use as sky, useful in tracks were fog is used to hide some of the too distance track models (e.g. mines).
fog Set to non-zero to enable fog. If fog is enabled, the following properties will be used, too.
fog-color Either "r g b" or "r g b a" color values for the color of the fog.
fog-density Density of the fog. Unused
fog-start Distance at which the fog starts.
fog-end Distance at which the fog ends.
camera-far Far distance for camera - useful for indoor tracks where more objects can be culled this way, without affecting the look.
start-karts-per-row How many karts are being placed in one row. The more karts, the wider the track must be (since each kart in a row will have a distance of start-sidewards-distance).
start-forwards-distance How far a kart is in front of the next kart at start.
start-sidewards-distance How much distance to the right/left of each kart in one row. The three parameters allow you to shape where the karts start: e.g. you could put more karts in a row and reduce the forwards distance to make the field a bit wider (perhaps even reduce sidewards distance if the track should be too narrow, but be aware of wider karts)
start-upwards-distance Sometimes drivelines are too low and will be under the actual mesh. This is a simple vertical offset added to each start positions to make sure that karts start on top of the track (and not under it). Generally the drivelines should be fixed, but this allows a quick solution for existing tracks.

Per-Object Properties (or how to handle "special" objects)

The new track exporter uses Blender game Logic Properties to specify certain attributes for objects. The logic properties can be found in the game logic panel (F4). In this text the name 'property' will be used for logic properties (i.e. per object properties), and ID property for ID properties (i.e. track-wide properties).

The type property is used to mark which objects are 'special' (i.e. are not part of the main track), and which objects are part of the main track. All objects that do not have the 'type' property defined to a value listed in this section will become part of the main track. All other objects will be exported as special objects or logic properties - e.g. animated objects or the start line of the race. See the following sub-sections for a full list.


Objects to Ignore

If an object has the property 'type' set to ignore, it will not be exported at all. This can be used to keep certain objects as a template in the blender model for further work, without having them exported into the SuperTuxKart track.

Items

Items (collectibles) are created by adding an 'empty' (add->mesh->empty) structure in blender, and giving it a type property value of banana (previously GHERRING or BANA), item (RHERRING or BBOX), nitro-small (SHERRING or COIN), or nitro-big (YHERRING or GOLD). While the objects will not be displayed in blender, they will be exported correctly for SuperTuxKart.

Start positions for arenas

For battle arenas : empties with the type property 'start' declare the start position for a kart. It should have a second property 'position' indication for which kart position (1 to maximum number of karts) this position is meant. As a shortcut, the type and position property can be set together as 'type="start1"' etc., with an integer number immediately after start indication the position.

Water

An object with the type property set to water will be exported as a special water node. The node will be animated in SuperTuxKart to have "waves". The three properties "height" (default 2), "speed" (default 300), and "length" (default 10) can be set for water nodes.

Note : apply scale and rotation to water objects before exporting!

A nice water splash

For SuperTuxKart 0.7.1 and up only

It is possible to make it so that a water splash is drawn when a kart hits the water. For this, you will need to model both the surface of the water and a "seabed" (bottom of the water).

Then apply the following settings to the surface material :

Surface.png

(the water splash sound is not mandatory, here the splash sound effect that comes with SuperTuxKart is used; splash.xml is a particle descriptor for water splashes that comes with STK)

and the following settings to the "seabed" material :

Seabed.png

(the falling effect options means that the camera will stay in place and look down at the falling kart)

Separate/Animated Objects

If a blender objects has the type property set to object (or special_object) the object will be exported as a separate b3d model, and loaded in SuperTuxKart, a so called track object.

Animated.jpg


There are three main reasons for creating track objects:

All track objects allow you to specify the file name to use when exporting them separately by setting the name property (.b3d will be appended to the name). If this is not set, the blender internal name will be used for the filename.

Track objects can have different physical properties, which also affects what kind of animations can be used for them. The physical properties are set using the 'interaction' property - it defines how a kart and this object will interact with each other. Default is 'static'.

interaction="none" or interaction="ghost"

There is no interaction between the track object and a kart. The kart can drive straight through the track object, and is not affected at all, neither is the track object. So the object is a kind of ghost. This is useful for 'eye candy' where the karts can't drive (e.g. a plane in the sky, or rotating wings of a wind turbine, or a house outside of the track; to create a secret and well hidden entrance to a different part of the track; for plants that are not supposed to stop a kart, ...). The advantage is that these objects do not increase the work for the physics, since they don't exist for the physics. Those objects can be animated with an IPO and/or a skeletal animation.

interaction="static" with IPO animation

These objects can not be moved by the kart, karts will just 'run into a wall'. The objects can also have a skeletal animation. Example for this kind of object would be animals, trains, ... crossing the track (IPO and perhaps skeletal animated), or eye candy into which the karts can potentially run into. This kind of object must have a shape defined (property shape), which must be one of 'box', 'sphere', 'cone{X,Y,Z}' or 'cylinder{X,Y,Z} (one of X,Y,Z defining the orientation of the cone or cylinder) at the moment. This is the shape bullet uses to simulate the object in the physics. Other (simple) shapes can be added on request, but the important point is that objects in the physics world must be simple, it would be too slow to (e.g.) simulate all triangles of a tree. Instead the shape will be approximated by e.g. a cone.

interaction="static" without IPO animation

Similar to the track objects mentioned above karts will be stopped when they hit this kind of object. No skeletal animations are supported for this objects atm (that might be added if needed). Examples would be road blocks used for different versions of the same track, or trees (if it should be faster not to include them in the main track).

interaction="move"

This interaction indicates that the object can be moved by the kart - it can be pushed around, and might be affected by explosions etc. Examples would be road cones, road blocks (that can be moved aside). These objects must have a shape defined (see static objects with IPO above), and should define the 'mass' property. These objects can also have skeletal animations, but might NOT have an IPO.

Animated Textures

Any objects that are part of the main track (i.e. no other special object listed here except objects of type object, see above) can mark one texture to be animated. The object must define the name of the texture in the property anim-texture, and should set the speed of movement by setting anim-dx and/or anim-dy. See the following example:

AnimTexture.png


Checks and Lap Counting

SuperTuxkart is using 'check structures' for triggering events and counting laps. At the moment two different structures are supported:

Checklines are generally added near the middle of the track; they should be in a place where they cannot be missed unless by cheating.

Checkline.jpg
Adding a checkline


Note that a default new lap detection is implemented in STK: it is based on detecting when the distance along track wraps around (i.e. goes from a large value to a value close to 0), which indicates that a new lap has started). If you should want to disable this, give the main driveline a 'strict-lapline=y' property, and a checkline called lap is implicitly created at the start of the driveline (no need to create this line yourself, it will be created automatically for you when you export the track). In any case, this new lap detection has the same name lap as an explicit checkline, and therefore needs re-activiation as well.

Check structures can be activated or deactivated (for each player). When an activated structure is triggered (crossed), the structure becomes deactivated (for the kart that just triggered it). As one effect of triggering, a check structure can activate other check structures.

The minimal case is to have one checkline near the center of the track, that activates the lap line (as in the screenshot above) - this prevents the player from cheating by triggering a new lap detection by driving in circles around the start line since the lap won't be counted unless the lapline was first activated by crossing the middle-of-track checkline.


Activate checkline.png
Making the implicit lapline activate the checkline when crossed


You can also define a chain of check lines: check line 1 activates check line 2, which activates check line 3, which activates the new lap line (which re-activates the first check line). So karts have to cross the check lines in the right order in order to get a lap counted. Note that this system is meant to prevent cheating, i.e. bypassing a significant amount of the track, not to prevent shortcuts. If you want to prevent shortcuts, you either have to model the track appropriately (by putting objects, water, bananas, ...to prevent a kart from using the shortcut), or setting the physics parameters (i.e. making the terrain to cause a slow down of the kart so that it's not worth using this shortcut).

Groups

The check structures can be grouped: all check structures of type 'lap' belong to a group 'lap', and all check structures with the same 'name' property will be grouped together, too. This means that e.g. you activate (say) 'lap', all lap counting lines will be activated; and if you cross a lap counting line, all check structures with the group 'lap' will be deactivated etc. One reason why you want to have more than one lap line is if a kart might cross the start line a little bit to the left or right of the actual start line (and you don't want to widen the quads to accommodate this since the quads might be too wide and look odd in the minimap). Preferred solution is to model the track so that it is obvious where a kart is supposed to cross the line, e.g. having some kind of 'gate' or so. But if this is inconvenient just add more lap counting lines to the left and/or right of the first quad line, and stk will take this into account.

Lap grouping.png
Using grouping to extend the implicitly created lapline


Properties Reference

Since the first lap counting line is automatically added from the driveline, you have to give the main driveline an 'activate' property which specifies which activation line to activate.

Debugging Checklines

STK 0.7alpha3 supports a command line parameter --check-debug, which will cause STK to print a message to the terminal when a check structure is triggered etc. This can be useful in solving problems when laps are not counted correctly.


Level of Detail

Level of detail is the ability to show a highly-detailed model when you're close, and a less detailed one when you're far. Set property type to "object", and set property name to (for instance) "MyObject_LOD100". Then you can make another object called "MyObject_LOD500"; the result will be that if you are 100 meters from the object or closer, the object named "MyObject_LOD100" is shown; if you are between 100 and 500 meters, "MyObject_LOD500" is shown; if you are further than 500 meters nothing is shown.

SuperTuxKart 0.7.2

To instanciate a LOD object, simply duplicate any of the objects and rename it "MyObject_LODx" (adapt the "MyObject" part but leave the "_LODx" part textual). Each LODx object will be shown in-game with the X replaced by the appropriate level

SuperTuxKart 0.7.1

If you wish to have many of the same LOD object in the track, simply duplicate the highest resolution model (the smaller level of detail models only need to appear once)

Furthermore, note that the lower-resolution models can be placed anywhere, their blender location will not be considered

Sun

One light can be defined for STK in blender (if you have more lights, just set the 'ignore' type property in the other lights). The light position is exported as sun position for STK. The following additional properties are used:

Property name Value
ambient A "r g b" or "r g b a" color for the ambient light of the sun.
diffuse The diffuse color for the sun.
specular The specular color of the sun.

Materials

In the STK browser (as shown above), select "Textures" :

Materials.jpg

From there, you can enter the properties of each texture

See the materials page to learn about the syntax of the generated materials.xml file (this is not required to make tracks)

Drivelines

All objects having the type 'maindriveline' or 'driveline' will be exported as drivelines. Drivelines are currently used to specify where to drive for the AI, and to draw the minimap which is displayed in the lower left corner of the race GUI.

For more information, see this separate article

End Camera

The current STK trunk supports different end cameras. For a track several cameras can be defined, each one of a different type. The cameras will be sorted according to the main driveline (which is where the karts will drive during end animations) - the camera closest to the beginning of the track first etc. All blender cameras will be used as end cameras, if you want a camera not to be exported, give its 'type' property the value 'ignore'. The following two camera types are currently defined:

Additionally a camera defines a property called 'start', which defines a start-sphere. If a kart comes into the start-sphere of the next end camera, this camera will replace the current camera. Note that for an 'ahead' camera the camera position you use in blender is only used to determine the start-sphere, i.e. when the camera should be activated. Once the camera is activated, it will instantly fly ahead of the kart, independent of the camera position in blender.

If you have a series of fixed cameras it is very common that the start-sphere of one camera overlaps (or covers) the previous camera. Otherwise it is likely that the previous camera will show the back of the kart, which might not be that interesting (though feel free to ignore this recommendation of course).

Other camera types might be added on request - so please let us know if you have a good idea for a different camera type.

Property Value
type "ahead", "fixed" or "ignore" depending on the type of camera. "ahead" is default
start the radius of the start sphere around the camera. If a kart enters the sphere the camera is activated.


Particles

For SuperTuxKart 0.7.1 and up only

You can add particle emitters anywhere in a track. Simply add an empty, give it the type particle-emitter, and add a kind property where you enter the name of the file describing the properties you wish to use.

Particles.png

For a list of currently available particle files, check the data/gfx folder. You should be able to create new particle types by duplicating an existing one and tweaking its properties.

The format for a particle XML file is described at Particles File

Summary of Properties

Name Value Description
typeignore Do not export this object.
typestart Start position for battle mode, from 1 to maximum number of karts (use on empties)
speed Position attribute
typebanana Create a banana at this location (use for an empty object).
typeitem Create an item at this place (use for an empty object).
typenitro-small Create a small nitro container at this place (use for an empty object).
typenitro-big Create a big nitro container at this place (use for an empty object).
typewater Export as special irrlicht water node.
Additional properties:
name Specifies the name to use for the exported b3d file.
height Height of the water wave.
length Length of the water wave.
speed Speed of the water wave.
typemaindriveline Export mesh as main driveline.
typedriveline Export mesh as driveline.
typeobject Export object as separate b3d file.
Additional properties:
name Specifies the name to use for the exported b3d file.
interaction One of 'none' (or 'ghost'), 'static', 'move'.
shape Only for interaction=static or move: Shape of the object. Must be 'cone{X,Y,Z}', 'cylinder{X,Y,Z}', 'box', or 'sphere'.
mass Only for interaction=move: Mass of the object in kg (a kart has a default mass of 225 kg). This is a float parameter.
ambient r g b a Specifies the ambient color of the sun (in a blender light only).
diffuse r g b a Specifies the diffuse color of the sun (in a blender light only).
specular r g b a Specifies the specular color of the sun (in a blender light only).
anim-textureTexture name Name of the texture to animate.
Additional properties:
anim-dx Animation speed in X direction.
anim-dy Animation speed in Y direction.
typelapA check line that will trigger a new lap to be counted.
typecheckA general check structure
Additional properties:
activate Name of the blender object of a check structure to activate.
toggle Name of the blender object of a check structure to toggle
(from active to inactive and vice versa).
inner-radius For check-spheres only: Inner radius for maximum new ambient light.
color For check-spheres only: New ambient light color.
typebillboard Create a billboard
typeparticle-emitter Create a particle emitter.
Additional properties:
kind Which particles to use
Retrieved from "http://supertuxkart.sourceforge.net/Track_Maker%27s_Guide"

User Tools