Note about paths: I test and compile from svn and test/play by copying the compiled /trigger to /data/trigger.
The Linux racing game Trigger Rally uses a height map to create level geometry, a color map in combination with the /data/textures/detail.jpg image to paint the geometry, a foliage map to place plants on the map and checkpoint coordinates to define the race path.
Copy a map directory to work with, for example
cp roundhouse/ mytrack/
mv roundhouse.level mytrack.level
and edit mytrack.level’s name, comment and author.
In the following steps, overwrite the existing image files and edit values to match your map’s needs.
Hint: insert “a” at the beginning of the name, so that the level appears first in the track list, for quicker testing.
1. Height map
All you need to know about height maps: white is high, black is low.
I like to use Geomorph to create height maps, but the “render/clouds” filters in Gimp can be used just as well. I can only say “play around” to create a 512×512 environment.
To create a complete off-road experience, stop here. To create a more interesting track however, start Inkscape and:
- draw a path using the Curve/Line tool (Shift+6) with no fill and a #000000ff, 12px-width stroke and round cap,
- select all nodes (F2, Ctrl+a) and make all nodes symmetric or ‘auto-smooth’ using the buttons in the tool controls bar,
- set the stroke fill to linear or radial gradient and… play around some more!
- (Optional) duplicate the curve, convert it via “path/stroke to path” and move some nodes around, so that the race track varies in width.
Make sure to export “page area” of the 512×512 image. This way, the coordinates will be a 1:1 match (more on that later, just make sure to save the .svg files).
The last step is to combine environment and track into one height map. Layer blend mode and opacity are values to play around with. The “colors/levels” tool will allow you to make quick black/white (height) changes. Or you can change the verticalscale value (I don’t recommend it).
2. Color map
My setup is simple and not so pretty: two layers in Gimp (terrain and track) and both of them are differently colored via “colors/colorize”. Maybe with a “filter/blur/gaussian blur” of 2px applied to the track layer.
3. Foliage map
Thanks to this image’s white surface, the level will have foliage distributed in respective areas. The distribution of plants is rather organic, so you can just paint with a brush.
What I like to do is taking a white-filled track layer on black background, gaussian-blurring it and overlaying another black-filled track layer, so the track’s borders have even vegetation on them.
For this, you will need the path svg opened in Inkscape. Select single nodes to see their position and copy that to the mytrack.level file. Here are the coordinates for above map:
<startposition pos=”66, 43, 2.0″ oridegrees=”250″ />
<checkpoint coords=”197, 36″ />
<checkpoint coords=”193, 160″ />
<checkpoint coords=”100, 234″ />
<checkpoint coords=”101, 307″ />
<checkpoint coords=”150, 324″ />
<checkpoint coords=”136, 257″ />
<checkpoint coords=”229, 174″ />
<checkpoint coords=”244, 94″ />
<checkpoint coords=”314, 60″ />
<checkpoint coords=”419, 173″ />
<checkpoint coords=”383, 259″ />
<checkpoint coords=”261, 289″ />
<checkpoint coords=”326, 381″ />
<checkpoint coords=”397, 313″ />
<checkpoint coords=”356, 194″ />
<checkpoint coords=”301, 123″ />
These values work well when the following is set:
<race coordscale=”4.0, 4.0″
Here’s a gameplay video of the result:
In a later version, I ended up making the track part much smoother, which might or might not have helped making it easier to drive on the track, rather than on the terrain. You can download the level (GPL2+/CC-BY-SA 3+) and the source files (PD/CC0).
I posted the first track, that made this way, as a patch.
Nikki and the Robots: Story Episodes
Buy the cute Überpixel™ style platformer now!
outrageously blatant self-promotion