Thanks,
It does look a lot like bacteria, this makes me think I am taking the wrong approach. No matter what I do it looks like bacteria. Which is cool, but I wanted islands!
I changed the variables a bit and randomized a few things, there's a bit more detail to the shapes and they're not so square/circular (I realised the cause was placing groups of islands randomly in a set square, so I changed this to make each island offset randomly from the group, altering the group co-ordinates each time)
Rem Project: Map Generator
Rem Created: Tuesday, February 28, 2012
remstart
A recurring function picks a random parent cell and colours it,
then an ever-decreasing number of adjacent cells are selected at random,
becoming parent cells in the process.
remend
Rem ***** Main Source File *****
resx = 1360
resy = 768
global scalex
global scaley
scalex = resx-1
scaley = resy-1
set display mode resx,resy,32
set window off
hide mouse
randomize timer()
sea = rgb(30,100,160)
red = rgb(255,0,0)
dim map(scalex,scaley)
rem === MAIN ===
Do
rem clear world
for x = 0 to scalex
for y = 0 to scaley
map(x,y)=0
next y
next x
rem sea backdrop
box 0,0,scalex+1,scaley+1,sea,sea,sea,sea
rem start
rem Generate Map
for group = 1 to 8
gx = rnd(scalex)
gy = rnd(scaley)
i = rnd(50)+50
for isle = 1 to i
gx = gx + rnd(100) - 50
gy = gy + rnd(100) - 50
gen_island(gx,gy,rnd(100)+10)
next isle
next group
rem end
`gen_island(scalex/2,scaley/2,100)
rem Draw Map
lock pixels
b as float
for x = 0 to scalex
for y = 0 to scaley
if map(x,y)>0
b = 50 + 205/map(x,y)
dot x,y,rgb(b*.5,b,b*.3)
endif
next y
next x
`dot scalex/2,scaley/2,red
unlock pixels
wait key
Loop
end
rem === FUNCTIONS ===
remstart
Let t equal the cell tier. The highest tier being the root cell.
Tier is reduced as the island branches grow outwards.
A branch terminates when t = 0, and returns to its parent.
A cell can be assessed multiple times, but only if it
is of a higher tier in the subsequent branch.
remend
function gen_island(x,y,t)
if x<0 or y<0 or x>scalex or y>scaley then exitfunction
map(x,y)=t
p as float
pick as float
s=3+rnd(5)
if t>0
rem If there are adjacent cells of tier =>t-1, reduce supply.
for v = y-1 to y+1
if v<0 then v=0
if v>(scaley) then exit
for u = x-1 to x+1
if u<0 then u=0
if u>(scalex) then exit
if map(u,v) => t-5 then dec s,1
next u
next v
rem Select child cells
for v = y-1 to y+1
if v<0 then v=0
if v>scaley then exit
for u = x-1 to x+1
if u<0 then u=0
if u>scalex then exit
if map(u,v)<t-2
rem Hypergeometric Distribution
i = u+1-x + (v+1-y)*3
if i<>4
p = s/(9.0-i)
pick = rnd(1000)/1000.0 < p
if pick=1 then dec s : gen_island(u,v,t-1)
endif
endif
next u
next v
endif
endfunction
I don't really know what to do with this now...