By material I mean rock/dirt/air/etc... In the array it would be just an integer like 0 for air, 1 for dirt, 2 for rock...
But to be simple you can do 0-air and 1-dirt.
The attached capx has almost every kind of terrain generation I could think of. At the very least it gives something to play with. Basically any sort of generation will be an equation and you then fiddle with the numbers to get different effects.
Most of it isn't very complicated, not even the equations, although they can look busy. I'll break down one of them, the "dual sine":
(2+rnd1)*sin((2.1+rnd2)*360*Array.CurX/40+33*rnd3)+(3+rnd4)*sin((1.5+rnd5)*360*Array.CurX/40)+15[/code:1bq00sn3]
Basically this is two sine waves added together. The general form of a sine equation is:
y = amplitude * sin(frequency * x + offset)
When two or more sine equations (with different amplitude, frequency and/or offset ) are added together you get an interesting smooth curve. All the numbers are pretty much arbitrary except for 15 which is centering it vertically in the array. The only other values that are somewhat important are the ones that define the amplitude such as (2+rnd1) or (3+rnd4), which I picked to make sure the hills don't get too high or low. As it is it has a vertical range of 14.