At the current time I have been using a Perlin noise algorithm to randomly generate terrain. The weakness of this algorithm for generating the terrain is that, without some particular exceptions, it cannot produce certain terrain effects such as cliffs, inlets and sharp changes in terrain. There are some techniques that can be employed to produce these effects after the Perlin noise has run but again they take some time to get a realistic looking terrain. Using real terrain would be a great test for the algorithm.
![]() |
Perlin noise generated terrain |
![]() |
A*algorithm avoiding the water and raised terrain |
OS Terrain 50 is available as:
- 50 metre grid in ASCII grid and GML 3.2.1
- 10 metre contours in Esri® shapefile or GML 3.2.1
My goal is to use one (or possibly all) of these file formats to produce some real terrain data to test my A* algorithm. To do this I will use my existing test bed application written using WinForms and C# and modify it to read in the OS Terrain 50 data. The existing test bed is a very simple application that produces a terrain object which is rendered in 2D and is colour coded to show different heights in different colours. The terrain object is then used by the A* algorithm to calculate the most efficient route through the terrain.
The main tasks are:
- A GML/ASCII/Shapefile reader will be developed. There are a number of readers available but I am planning to write my own so that I can learn more about the file format.
- The application will be redesigned so that a new layer is added that can feed the main application with either a terrain object that was produced by the Perlin noise algorithm or a terrain object built from the OS terrain 50. In this way the A* algorithm will not be affected by the type of terrain data loaded.
- The main user interface will be changed to display multiple tiles;
- The application will be changed to use threads to load the tiles in the background.
- The colour code will be updated to produce a better quality display.
I am planning to tackle these tasks in hour long sessions over a period of a week and see where I am after the week has finished. The main risk to completion are finding the time in a week for an hour of coding and half an hour of blogging.
No comments:
Post a Comment