So today Mark decided that the current terrain in A22 is boring and too 'perfect', so, after much discussion, he finally convinced me to try a technique he thought up to make the terrain more.... rough.
Terrain Surface Decals
As you may already know, the terrain in Angels 22 is a 2D heightmap, which generally means that the terrain is very sharp, as it is comprised of a bunch of 4 vertex boxes stuck together. I was convinced that the terrain was fine how it was, and that no one would care if it was so sharply defined. Well, I tonight I coded up Mark's technique (which will be described below), and I must say, I was wrong, the new terrain looks much better than the old stuff, and actually solves a lot of my problems, such as how to make good roads.
Because the actual 2D distance between two heightpoints isn't standard, you can't simply slap a sprite in between two points becuase it will either be too little, or too small, resulting in gaps. Mark's idea was to use a relatively long texture, and only use the length of the texture that we actually needed. I guess it's not that novel of a concept, but it never really occurred to me. Anyways, in order to render the overlay, a quad is drawn, and rotated so that it completely covers the distance between two adjacent height points. Then, it is texture mapped using texture coordinates modified using the distance between the two points. The result is a nice texture line that can be stretched, without distorting the texture, which is what allows us to now do stuff like roads, grass, etc. Anyways, you can see the new terrain with a grass overlay over it in the screeny below:
The type of terrain covering can also be changed on a per segment basis, so the whole level doesn't have to be covered in grass, and some parts can have other covers, like roads, or rocks. Also, I implemented a random feature, so that once Mark puts together some more grass textures, the game will randomly pick the ones to be displayed, giving the levels a lot more visual diversity.
Well, that's all for now, and thanks for all the positive comments, they really boost my morale, and keep me coding. Peace Out!