Depends what you mean by "planets", really. A planet image, a 2D cave system like, say, Terraria?
If it's just the latter, it might be easier/quicker to use something like a 4-5 Cellular Automaton. Give the code below a whirl and see if it's anything like what you're after. Sorry it's a bit of a mess and almost completely uncommented, but I've literally thrown it together in the past 15 mins. If it's any remotely like what you're after I'll tidy it up a bit, bung in some helpful pointers and explanations, and generally de-fudge the whole thing.
You'll need to put two images in the project's media folder btw - one called "blank.png" for empty space, and one called "ground.png" for, er, the ground. Both images need to be 16x16 pixels
setVirtualResolution ( 2048, 2048 )
LoadImage ( 1, "blank.png" )
LoadImage ( 2, "ground.png" )
Dim mapArray [ 128, 128 ]
for x = 1 to 128
for y = 1 to 128
if (random ( 1, 100)<= 50) REM adjust the value after <= to increase/decrease amount of floor
mapArray [ x, y] = 1
else
mapArray [ x, y] = 0
endif
next y
next x
for x = 1 to 128
for y = 1 to 128
SprCt = ( SprCt + 1)
if mapArray [ x, y] = 1
createSprite ( SprCt, 1 )
SetSpritePosition ( SprCt, ( ( x*16)-16), ( ( y*16)-16) )
endif
if mapArray [ x, y] = 0
createSprite ( SprCt, 2 )
SetSpritePosition ( SprCt, ( ( x*16)-16), ( ( y*16)-16) )
endif
next y
next x
do
REM display map
sync ()
REM define number of itterations
i = (i + 1)
if i <= 5
REM calculate 4-5 itteration (note - range of x/y in 2-127 used as kludge to avoid overstepping edges of array)
for x = 2 to 127
for y = 2 to 127
north = mapArray [x, (y-1)]
northeast = mapArray [(x+1), (y-1)]
east = mapArray [ (x+1), y ]
southeast = mapArray [ (x+1), (y+1) ]
south = mapArray [ x, (y+1)]
southwest = mapArray [ (x-1), (y+1) ]
west = mapArray [ (x-1), y]
northwest = mapArray [ (x-1), (y-1) ]
totAdjacent = ( north + northeast + east + southeast + south + southwest + west + northwest)
if totAdjacent <=3
mapArray [x,y] = 0
endif
if totAdjacent >=5
mapArray [x,y] = 1
endif
next y
next x
REM change sprite images to reflect current itteration
sprCt = 0
for x = 1 to 128
for y = 1 to 128
SprCt = ( SprCt + 1)
if mapArray [ x, y] = 1
setSpriteImage ( SprCt, 1 )
SetSpritePosition ( SprCt, ( ( x*16)-16), ( ( y*16)-16) )
endif
if mapArray [ x, y] = 0
SetSpriteImage ( SprCt, 2 )
SetSpritePosition ( SprCt, ( ( x*16)-16), ( ( y*16)-16) )
endif
next y
next x
endif
loop