2D terrain generation
How is the terrain in games like "Moon buggy", "Route 960" or similar made ?
I dont't mean the "Scorch" or "Worms" like terrain with many peaks, but I lo开发者_JAVA百科ok for a way to generate smooth terain with hills and ditches, smooth enough to let a vehicle drive over it.
Initiate array of random heights
Blur:
foreach height in heights:
new height = mean of all heights in radius N and center in current height
blur will satisfy your condition of smoothing
You want to look for a space-filling-curve, or a spatial index, for example a hilbert curve or a z-curve. It recursivley subdivide the surface into tiles and reduce the 2d problem into a 1d problem but it is basically a reordering of the tiles. You want to look for Nick's spatial index quadtree hilbert-curve blog.
精彩评论