• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Generating maps?

Looks very good, really really good. I believe there was a similar project being made a few months/years ago, although I'm not sure what happened to it. Either way, random dungeons would add a whole new dimension of content to OTs. Think of the possibilities. It certainly would bring back life to custom servers. Diablo 2 servers wouldn't be a pipe dream any more...
 
Actually Diablo 2 has very simple generator.
In Tibia client borders are separate items so you need a code to apply them, while in D2 it's done by client
It's time to replace all those old-dated events.
 
Last edited:
Checking dungeon state, information about players inside and maybe more when I get more ideas
 
Absoulutety it's impossible. That's possible. I knew what's the system. You still do very good. I saw it in practise. I'll wait for next reflections of the project.
 
bump
looks like I have to work alone again...

new: multi-floor support, debug channel commands(two gifs loading below)
9ff30b95d9f3cb221cc5df686ec062ad.gif

JAb3JX.gif
 
This is just really cool :)
 
Well, nice great job. Its awesome.
Maybe you could write simple app which would help with creating config? Simple OTBM intepreter so one could create small structure in Remeres, and later import it? Or if you are willing to take bigger workload - whole app for config creation. It would render structures much more usable.
 
Is there any script showoff-related part of forum? I think this thread took bad turn and should be moved somewhere.

@Gall
I never wrote any app like that. I am noob in programming stuff. All I learnt about lua is from googling my problems and hours of testing on tfs.
Even if I could, you have to enter all ids manually.
 
Is there any script showoff-related part of forum? I think this thread took bad turn and should be moved somewhere.

@Gall
I never wrote any app like that. I am noob in programming stuff. All I learnt about lua is from googling my problems and hours of testing on tfs.
Even if I could, you have to enter all ids manually.
Ah:/
Well I could experiment with interpreting .otbm with python(causes that's easy language for begginers like me), then convert it into string and save to file. Definitively doable, I just don't know if I have enough patience for it. Unfortunatelly I am bit overworked thanks to my university until Christmas
 
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.
mapa.png


shot from "only sand" test
mapa2.png


and focus ;p
1.png

sometimes it cant handle borders (matter of border mask more info below)
2.png


and this is most beautiful IMHO
single island from last stand type event
3.png

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 :D
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!
 
Last edited:
@pszczelaszkov
Nice. If you used smaller sizes you'd get something better, but multi-autoborder must be hard thing(took me two days to write simple 4 bit binary-based autoborder)
You can fix your autoborder by adding it layer by layer and checking what is around the item(as z-order thing in rme)

I gave up on generating surface, because (as you can see) it can't be detailed as perfect as caves.

One question:
It saves map in otbm format or loads generated area to ot memory?

Dunno if it could help you with buildings... here is my code for structures

this is how I spawn them:
Code:
-- inst.tier is cave config reference point
      for str_row = 0, inst_tier.map_size[2]-1 do -- spawned line by line
       for str_level = 0, inst_tier.map_size[3]-1 do -- multi-floor support, WIP
         addEvent(doStructures,global_gen_delay[id],id,s_types,str_row,str_level)
         global_gen_delay[id] = global_gen_delay[id] + pits_event_config.main.chunk_update_interval
       end
       end

this is how they get spawned: http://pastebin.com/pFb6h0yK
 
Last edited:
@zbizu
It take me few days to analyze your code but thanks ;p
For now i try make buildings with brush with stonefloor.
and put border on it for example:stonefloor-grass with mixed walls.
But i need invent next thing something like structures that i can define in .XML to make groups of items as you in caves for example:chest on table,chairs near table.
For caves i try modify brush to delete mode.
And i draw plain mountain in rect shape and just try to drill in it with delete brush and put borders on it.
But i need add to this shit Z-layer support so i could make roofs,other floors in buildings nicely.
Good idea with z-order in borders i try it but for now i try fix it with changing borders masks to more rigorous.

Answering your question:
It generates map to memory so it only respawns teleport after it and event with random terrain is ready.
But to make this .pngs i wrote a dumpTile(startpos,endpos) function
It dumps stacks 0 and 1 into simple .txt file so i can later load it with app in java and generate .png from it
maybe if i have more time i try write dump to binary file so i could take a snapshots to use terrain later.

I enabled swim system in this water so players can surf from island to island and search for obelisks ;p
With random terrain i hope it gives them some fun.
 
I didn't made any deletions, I just placed mountain(id 919) and then random tunnels(floor) with min 3, max 7 lenght in both directions. Sometimes it makes square room which is awesome itself. I render borders only when I'm done with floor stuff.
Sorry for posting messy code here. I'm refering everything to config to make it easier for me to write.

Major part of tunnels function in my code:
Code:
      for tunnel_x = 0, tunnel_v_a - 1 do -- horizontal/vertical swap happend before
       for tunnel_y = 0, tunnel_v_b - 1 do
         tunnel_current_tile = {x = inst_tier.map_corner.x + map_row + tunnel_x, y = inst_tier.map_corner.y + tunnel_y + row, z = inst_tier.map_corner.z + level} -- map corner + where it is now
         if tunnel_current_tile.x < inst_tier.map_corner.x + inst_tier.map_size[1] and tunnel_current_tile.y < inst_tier.map_corner.y + inst_tier.map_size[2] and tunnel_current_tile.z < inst_tier.map_corner.z + inst_tier.map_size[3] then -- tunnel will stop on map edge
           doCreateItem(inst_tier.map_floor[math.random(1, #inst_tier.map_floor)], 1, tunnel_current_tile)
         end
       end
       end
 
Back
Top