Matei Zaharia's CS 488 Project

My goal was to create and render a randomly generated landscape on which a simple game can be played: the player must visit a number of villages while avoiding bandits. Randomly generated levels can be used to add replayability to strategy and role-playing games, by giving players a new map each game while ensuring that every map is natural-looking and fair. Some of the algorithms from this project will be used in the freeware historical strategy game 0 A.D., under development by Wildfire Games. Most of the art assets (textures and 3D models) I used are borrowed from 0 A.D.

I developed scripts to generate four types of maps: highland, mountains, plains, and tropical islands. For each map, a landscape with smoothly shaped rivers, lakes and hills is generated, and objects like trees, rocks and grass are placed on it in a realistic manner (for example, trees are placed in clusters to form forests). Most of the terrain features are placed using Perlin Noise, a smoothly-changing random function which, with some tricks (e.g. adding noise functions with different frequencies together), leads to natural-looking boundaries. With a number of simple rules (e.g. "don't place a tree underwater" or "don't place a village in a forest"), the objects placed on the terrain form natural-looking scenes without requiring any manual map design work.

Graphics algorithms used include:

Here's a screenshot of the Highlands map, showing a village:

Here is the Mountains map, complete with a winding river:

Here is the Plains map; notice how the water is more reflective at the low camera angle, following Fresnel's Law:

Here's is the Mountains map with a sunset lighting set; the water reflects the colour variations in the sky:

Finally, here is sunset on the Islands map:

A big thanks to Wildfire Games for letting me borrow their art - working with carefully designed textures and models rather than "programmer art" was very helpful. The water rendering algorithm has now been incorporated into 0 A.D.", and you can see some of the in-game screenshots here.