I wrote a Generating system too on my OT.
Screen shots:
Obelisks are event items dont look at it ;p
First image is dynamic because it using current map file of event terrain.
shot from "only sand" test
and focus ;p
sometimes it cant handle borders (matter of border mask more info below)
and this is most beautiful IMHO
single island from last stand type event
of course its full random.
It works in 5 layers
-generate water(clean area)
-generate terrain
-add borders
-add trees/other stuff
-add monsters
300x300 generating time without massive freezes takes 2 minutes.
Now im working on putting mountains/buildings.
The main part of generating tool is brush.
it spawns brush and this brush can make other brushes that live on its own way and dies and gives birth to other brushes. It has "eyes" and paints only on allowed floors own FOV 90 degrees with scans way ahead so it goes right way etc...
But to make this islands i using single brush type with long live and i changing angle from 0 to 359 and random change live of brush.
Its full in C++ and data from .XML's
Api in LUA
Code:
drawIsland(pos,radius,id,10000)
placeBrush(id,angle,delay,pos)
placeBorder(startPos,endPos,0)
placeRender(5)
etc
EXAMPLE DATAS:
brushes.xml
Code:
<!--dirt on lava-->
<brush
id = "15"
mask =
"
0;1;1;1;0;
0;1;1;1;0;
0;1;1;1;0;
0;1;1;1;0;
0;0;0;0;0
"
itemsToRender = "103"
allowedFloors = "103;598"
maxChilds = "1"
maxAge = "200"
childAngleLimit = "45"
bornChance = "10000"
dieChance = "10000"
pulse = "false"
/>
Mask for borderizing:
Code:
<borderMask
mask =
"
0;1;0;
2;2;2;
0;2;0
"
itemid = "4828"
/>
1 and 2 means
Code:
<itemGroup id = "1" name = "water" itemids = "4608-4625;4664-4666"/>
<itemGroup id = "2" name = "standardWaterBorder" itemids = "103;106;424;4595;670;724;4526-4550;4828-4831;9535"/>
for placing details it uses data like:
Code:
<renderableArea id="1" startx="3000" starty="3000" startz="7" endx="3500" endy="3500" endz="7" count="1000" itemsToRender="2755-2758" allowedFloors="4608-4666" />
for monsters data like:
Code:
<respawnArea id="27" startx="3500" starty="3500" startz="7" endx="3600" endy="3600" endz="7" manual = "true" count = "150" monsters = "Touch Zombie" allowedFloors = "103;106;351-355"/>
For Example to make terrain like this last one it goes:
-A drawIsland(it spins around modulating radius as i said before) creating dirt base using brush id = 12.
Code:
<!--dirt-->
<brush
id = "12"
mask =
"
0;1;1;1;0;
0;1;1;1;0;
0;1;1;1;0;
0;1;1;1;0;
0;0;0;0;0
"
itemsToRender = "103"
allowedFloors = "103;4608-4625;4664-4666"
maxChilds = "1"
maxAge = "200"
childAngleLimit = "45"
bornChance = "10000"
dieChance = "10000"
pulse = "false"
/>
-2 brushes spawning in count of 500 in the same time to mix terrain(dirtfloor,dark grass)
Code:
<!--dirt floor-->
<brush
id = "13"
mask =
"
0;1;1;1;1;
0;1;1;1;1;
0;1;1;1;1;
0;1;1;1;1;
0;1;1;1;1
"
itemsToRender = "351-355"
allowedFloors = "351-355;103;4608-4625;4664-4666"
maxChilds = "2"
maxAge = "100"
childAngleLimit = "90"
bornChance = "100"
dieChance = "100"
pulse = "true"
/>
<!--dark grass pulse-->
<brush
id = "14"
mask =
"
0;1;1;1;1;
0;1;1;1;1;
0;1;1;1;1;
0;1;1;1;1;
0;1;1;1;1
"
itemsToRender = "106"
allowedFloors = "106;103;4608-4625;4664-4666"
maxChilds = "2"
maxAge = "100"
childAngleLimit = "90"
bornChance = "100"
dieChance = "100"
pulse = "true"
/>
so final code in lua looks like
Code:
drawIsland(pos,math.floor(math.random(30,40)),12)
for i = 0,500 do
local pos = {x = math.random(3510,3590), y = math.random(3510,3590), z = 7, stackpos = 0}
addEvent(placeBrush,10000,math.floor(math_random(13,14)),math.random(0,359),0,pos)
end
Thats my way of doing this stuff and hopefully it works
Most of problems are in borders(creating right masks).
It takes me half year to invent this but writing of main core was easy less than week.
May be force of math.random be with you Good Luck!