I threw this up for you. It uses built-in raycasting.
rem basic startup
sync on:sync rate 60:autocam off:randomize timer()
rem create "terrain"
rem it's basicly just a box with bunch of random half-spheres on it
global TerrainObj=1:rem "terrain" object
make object box TerrainObj,1000,1,1000:rem it will be 1000x1000
rem create simple texture to make it look nicer
for x=0 to 3
for y=0 to 3
box x*64,y*64,(x+1)*64,(y+1)*64,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
next y
next x
get image 1,0,0,255,255:texture object 1,1
rem now create random spheres on the box. let's say one hundred spheres
for i=1 to 100
rem create random sized sphere (size up to 200)
size=rnd(199)+1
make object sphere 2,size
rem attach it to the "terrain"
make mesh from object 1,2:delete object 2:rem turn it into mesh
add limb TerrainObj,i,1:rem attach it to the box
offset limb 1,i,rnd(1000)-500,1,rnd(1000)-500:rem position it randomly
color limb 1,i,rgb(rnd(255),rnd(255),rnd(255)):rem make it look nice :D
delete mesh 1:rem we don't need it anymore, so clear the memory :)
next i
position camera 0,100,0
rem MAIN LOOP
do
rem simple mouse look
rotate camera camera angle x()+mousemovey()/2,camera angle y()+mousemovex()/2,0
rem move with cursors
if upkey() then move camera 5
if downkey() then move camera -5
rem get terrain height under the camera
height#=GetTerrainHeight(TerrainObj,252,0,camera position x(),camera position z())
rem position the camera on the terrain
position camera camera position x(),height#+200,camera position z()
rem print current terrain height
text 0,0,"Height at (X: "+str$(camera position x(),2)+", z:"+str$(camera position z(),2)+"): "+str$(height#)
sync
loop
rem the function
function GetTerrainHeight(index,maxheight as float, minheight as float,x as float,z as float)
remstart
index - index of terrain object
maxheight - maximum terrain height
minheight - minimum terrain height
x and z - x and z positions on the terrain
remend
result as float
ytmp#=object position y(index)
result=intersect object(index,x,maxheight+ytmp#,z,x,minheight+ytmp#,z)
if result>0 then result=maxheight-result
endfunction result