Building the Martian surface
Just as we have been able to make use of the concepts and code we have learned previously to allow us to build a skybox, we can also call upon our knowledge of heightmap-based terrain in order to create the track that the player will drive along. As earlier, we will customize and streamline the code a bit to implement the features we need for Mars Runner.
Simplified heightmaps
In Tank Battles, we used large, detailed heightmaps to create a nicely varied terrain. Our goal in Mars Runner is somewhat different, so our heightmap implementation will change to accommodate that difference. The heightmaps we will be using in Mars Runner are shown in the following image:
As you can see, our heightmaps are very simple. Each of our two heightmaps is a 16 x 16 pixel image. The image on the left-hand side is a solid shade of gray, meaning that the entire map will have the same elevation if we made no changes to the code that creates the mesh.
The image on the right-hand side...