The Ultimate Stunts track editor (ustuntstrackedit)
Introduction
The Ultimate Stunts track editor will allow you to make new tracks and edit
existing tracks. Currently (version 0.7.0), the track editor is still very
limited: it is only possible to place/remove tiles on the track,
and to import tracks from the original Stunts game.
Usage
Currently, the user interface is still quite simple. In the main window, there
is a 3D view of the track, the name of the track on top of it, and a menu
on the left. The menu can be used with the mouse. For moving around in the 3D
view, the following controls can be used:
- "Dragging" with the left mouse button: rotate the camera view
- Arrow keys: move the cursor left/right/forward/backward
- PgUp/PgDn keys: move the cursor up/down
The "cursor" position is visible as the position of the blinking tile. The
vertical column of tiles on the cursor position is also visible as a white box
of lines:
Track editing
The "blinking" of the cursor shows two states of the track: the current state,
and what it will look like when you press the Enter key. Sometimes there will
be no difference, and in those cases, you won't see the blinking. The default
edit mode is to insert individual tiles (in fact, it's the only edit mode in
version 0.7.0). So, when you press Enter, the selected tile is inserted on the
cursor position. Any existing tile on that position will be removed in the
action. The following keys can be used:
- Enter: place the tile. Existing tiles on that position will
be removed.
- Insert: place the tile. Existing tiles on that position will
not be removed.
- Delete: remove all existing tiles on the cursor position.
- Tab: select another tile model.
- Shift+Tab: select another tile model (browses tile
models in opposite direction).
- r: rotate the tile model.
- Ctrl+z: undo the last action (replace/insert/delete).
- Ctrl+Shift+z: redo the last undone action.
Currently, the available set of tile models is limited by the selection of
tiles that is already used in the track. Also, the sizes of the track cannot
be changed, route information cannot be changed, and environment settings
(background, lighting etc.) cannot be edited. Currently, all those things need
to be done manually.
Importing Stunts tracks
One of the options in the track editor menu is to import a track from the
original "Stunts" (4D Sports Driving) game. The first thing you have to do is
to enter the directory where the Stunts tracks are. This is an absolute path,
so it is not relative to the Ultimate Stunts data dir. The "." directory is
the directory from where the track editor is started. In the future, this
question will probably be replaced with a more user-friendly directory
browser. After you selected the right directory, you can just click on a
track file, and it will be imported.
Configuring the Stunts import function
The Stunts import function can be configured by modifying a file that is
located in the Ultimate Stunts data directory: misc/trackedit.conf. In this
configuration file, almost the entire track import process can be customized
with the variables in the [trkimport] section.
This import process has the following steps:
1: Load a template track
Ultimate Stunts loads an ordinary Ultimate Stunts track file, which will act
as a starting point for the converted track. This track will be modified later
depending on the contents of the .trk file. The filename of this template
track can be set with the templatefile variable, for instance:
templatefile = misc/trackedit.template
The template track has to be at least 30*30 tiles wide and long, and at least
2 tiles high, or more, depending on the configuration of the rest of the
import process. All the tiles and textures that will ever be used in the rest
of the process should be present in the template track. The initial state of
the tiles should be a flat, horizontal ground.
2: Load the terrain
next, the terrain and tile item bytes in the .trk file are processed. All the
byte values here are hexadecimal values, but without the usual 0x prefix.
What happens here, depends first on the terrain:
- If the terrain byte is 00 (flat ground), only the item byte is
processed
- If the terrain byte is is between (including) 01 and 05
(water), then first a water tile is placed by processing the
terrain byte, and then the item byte is processed.
- If the terrain byte is 06 (high flat ground), then the item
byte is processed, and afterwards the tile height is
increased.
- If the terrain byte is between (including) 07 and 0a
(diagonal ground), then a tile is placed depending on the
combination of terrain and tile byte
- For other tiles, only the terrain byte is processed (on other
tiles a Stunts track never has any item
When a terrain byte with the hexadecimal value xy is processed, it is
done according to the variable terrain_xy in the conf file. When an
item byte with the value pq is processed, it is done according to the
variable tile_pq. Finally, for the terrain bytes between 07 and 0a,
processing a combination of terrain byte xy and item byte pq is
done according to the variable terrain_xy_pq.
All values of the variables terrain_xy, terrain_xy_pq and
tile_pq have the same format. This value contains zero or more units
of the following form:
x,y,z:tileID/rotation/altitude;
Every of these units causes one tile to be changed. The values x,y,z tell which
tile will be changed. tileID/rotation/altitude are the new settings of the
tile, with the same meaning as the three values in the track file format.
x,y and z are a position relative to the tile that is being processed. x and y
are the relative horizontal position in the track, and z is the layer in the
track (the vertical position). So, 0,0,0 is the lowest tile on the processed
position, 0,0,1 is the second-layer tile on that position, etc.. Positions
like 1,0,0 or 0,1,2 are outside the tile that is being processed, but changing
them is allowed to support for large tiles.
The "large tile" item values fd, fe and ff are not processed.