• 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!

OpenTibia OT map generator

Acedb

Well-Known Member
Joined
Oct 27, 2008
Messages
65
Reaction score
62
Hello,

I would like to share with you my tool for map generation, which originally I created ~10 years ago and in the last half a year I spent some time to partially refactor it (actually whole core code was rewritten from functional programming to oop, but parts of logic were just copy-pasted), make it more useable and extendible.
I already made it public few days ago on one discord, but we here have more wide public.
Be aware that, the code is messy - still there are a lot of legacy areas, messy code.

Repository: GitHub - abecek/otMapGenPublic (https://github.com/abecek/otMapGenPublic)

A little show off of capabilities:
- Generating maps through CLI:


- Generating maps in running TFS:
My quite old lap is barely recording video and generating map at once, sorry for that (actual performance of generation it's not so bad as seen on this video):


Below is an example of my "no-freeze" experimental generation script, which is not public, but public scripts give similar final results:


Both generation ways give the possibility to save final map into .otbm file.

Please check Readme for more details, how to use it, etc.

Current generation scripts:
1738290419036.webp
The ones starting with "test..." are used by me for testing and development.
Under data/schemas directory you have files containing lua tables with item ids - representing kind of "bioms" in the minecraft.
1738290438093.webp
You can modify and expand them as much as you like. I hope you will also share them!
If there will be possitive feedback I most likely will continue the project, fix existing bugs, add multi-floor feature and more. Hope you like it!

It's initial goal was to speed up mapping of tombs, but currently it can be used for various purposes - generating random dungeons in game on tfs startup, after modyfications even maybe in the runtime (because of freeze/lag when generation is running currently), etc. It's up to your creativity how you willl use it.

Note: regarding caves - I've not been focusing on it much, probably there are more bugs there than in tomb like scripts.


How fast it is currently? For 100x100 sqm map, ~30 rooms:
1738290919604.webp
with "tableMode" running state enabled on TFS, it took 2.1 seconds to generate above tomb (on quite old lap - dell 5490, i7-8650U, 16GB ram, with chrome, intelij in the background)
Output:
# Executing script: data/talkactions/scripts/otMapGenPublic/data/genScripts/test100.lua, logIdentifier: 6629.809
# Loading schema file: data/talkactions/scripts/otMapGenPublic/data/schemas/test1.lua
1 memory: 4072.208 kB
Main ground created, execution time: 0.024000000000342
2 memory: 9537.219 kB
Available map tiles for potential new wayPoints count: 6 after the procedure.
Waypoints created alternatively, execution time: 0.016999999999825
3 memory: 10693.156 kB
Length: 30
TSP running...
Creating paths...
Paths between waypoints created, execution time: 0.096999999999753
Rooms created, execution time: 0.0020000000004075
4 memory: 14309.355 kB
Bordering walls...
Bordering walls done, execution time: 0.072999999999411
5 memory: 16178.094 kB
Creating 35 markers alternatively..., #acceptedMapTilesTab: 0
Deleting old marker points, to delete count: 0
Initial acceptedMapTilesTab length: 2754
Available map tiles for potential new markers count: 1095 after the procedure.
Markers created alternatively, execution time: 0.020999999999731
6 memory: 23612.098 kB
Ground created, execution time: 0
7 memory: 23755.008 kB
Creating 75 markers alternatively..., #acceptedMapTilesTab: 0
Deleting old marker points, to delete count: 35
Initial acceptedMapTilesTab length: 2636
Available map tiles for potential new markers count: 81 after the procedure.
Markers created alternatively, execution time: 0.028999999999542
8 memory: 16972.797 kB
Ground created, execution time: 0.0010000000002037
9 memory: 17326.41 kB
Correction of the groundId 231 done, execution time: 0.033999999999651
10 memory: 13516.422 kB
Creating 100 markers alternatively..., #acceptedMapTilesTab: 0
Deleting old marker points, to delete count: 75
Initial acceptedMapTilesTab length: 2031
Available map tiles for potential new markers count: 323 after the procedure.
Markers created alternatively, execution time: 0.13700000000063
11 memory: 16381.293 kB
Brush created, execution time: 0.0050000000001091
12 memory: 17857.359 kB
Bordering ground done, execution time: 0.038000000000466
13 memory: 13900.77 kB
Corrections of borders done, execution time: 0.037000000000262
14 memory: 23759.387 kB
Making details in rooms done, execution time: 0.010000000000218
15 memory: 25498.285 kB
Creating details on map done, execution time: 0.16600000000017
Creating details on map done, execution time: 0.16899999999987
Creating details on map done, execution time: 0.14899999999943
Creating details on map done, execution time: 0.14500000000044
Creating details on map done, execution time: 0.16499999999996
Creating details on map done, execution time: 0.14499999999953
Creating details on walls done, execution time: 0.042000000000371
Combined creation of the details done, execution time: 0.9940000000006
16 memory: 17030.34 kB
Map tiles created, execution time: 0.58399999999983
17 memory: 20801.926 kB
# General execution time: 2.1040000000003
 

Attachments

Last edited:
Yep, only thing you need to do is to adapt item ids in schema files or create your own. AS-IS: it should work for >=8.6 (maybe even 8.42?)
I tried looking at the generated maps but sprites/data from my 8.6 client seem to not work with rme (they work with all my graveyard projects tho)
Can you link me yours?
 
Last edited:
Please check with 860 (not 862) from here: OTSME DL - data/tibia-clients/dat_and_spr (https://downloads.ots.me/?dir=data/tibia-clients/dat_and_spr) should work.

You can also try a little trick: create a new map with your spr & dat and import generating860.otbm into it in RME, save it and replace with initial generating860.otbm

or create map on your own, in general you need something like this:
View attachment 89906
Thanks, didnt know about this, neat trick.
Caves are looking amazing. Will tweak it for myself but great work!
 
Can be used forv7.6?? Thanks!!
It's possible, but demands modyfication in generation script(s) and schema file(s). You need to change/remove from there all item ids which are not present on 7.6, replace them with equivalents or remove at all. In generation script probably you will have to comment method calls related to creating carpet brushes, maybe also some detailing method calls - you need to check on your own.

Be aware that, generated maps will be more empty in the result, less detailed.
 
Last edited:
Thanks for your appreciation, but still we have here tens of new posts per day and to be honest I counted on some bigger feedback, more advices, some discussion regarding what features would like you to have next :/
I would like to encourage people for some activity

Maybe a cause of it is that it's a tool, which demands some basic lua knowledge - not ready to use, whole dungeon generation system.

I will reconsider releasing new versions, will see where it will go. For my personal use, for sure I will continue a development for some time.

First run for the jungle, new biome (sand cave gen script used, after minor changes):
1738716322966.webp
 
Last edited:
Really nice.

Is it possible to do a standalone app that can generate random caves/areas?
 
After see and trying many map generators, I can tell you that this one is by far very well adapted to the needs, it seems perfect and very customizable to me. Good work!!
 
Thank you guys,

my point was to achieve similar generated maps quality, as they would be mapped by average+ mapper.
That's why some internal function are slow, ugly in terms of peformance / code quality, but results with better final maps than if they would be written better, more efficient way.

Today's evening / night I will push new version to the github (0.0.7), with erasing maps feature (allows runing many generation proceses on the same map area, without a need to restart TFS each time after the generation), multi-floor feature included (can't promise will I adapt all existing generation scripts to use it or not, or will I create new ones, will see).

Please let me know what new features would you like to have next, maybe more generation scripts? more biomes (schema files)?
I was thinking about feature to create little architectures on maps like coffins on the altars or maybe even some little houses in future...

or fixing this wall border bug:

1738760431924.webp

maybe some transparent multi-floor layer handling? I mean for example tomb, where we have one walkable base floor, but above it we have an additional floor, which makes rooms, tunnels look higher.

Maybe adding spawns / monsters? Im not sure is it possible to create spawns with current map saving mechanism, probably not, but it's possible for sure to write own mechanism for this :)

Of course in the meantime I will continue fixing some minor bugs.

Please let me know, Im open for your ideas!
 
Last edited:
Maybe adding spawns / monsters? Im not sure is it possible to create spawns with current map saving mechanism, probably not, but it's possible for sure to write own mechanism for this :)
For generated map in game this is not an issue, I've tested it with your script (i had very bad map generator before) and it worked just fine. No idea how hard it would be for .otbm map
 
Coming from someone who has no mapping or OT experience, this looks like an amazing tool. I've always wanted to make my own server but lacked the time and knowledge for all things development related. I'm just an ideas guy. Watching the video and seeing it generate a decently random map was awesome to see. It may not be perfect or as amazing as a top tier mapper, but it gets the job done. More often than not an OT is based off how fun it is to play rather than how great the mapping is. I would use it as a way to generate a quick baseline and then add/remove to my liking. Seeing more biomes and variation would be cool. Great job making this!
 
I think you are on your way toward the first AI map generator to be used in public servers because there is not any useful one there, i'm keeping an eye on your project and i suggest open the way for donations because i would've been already, keep it going and more supporters will appear good work shall always be appreciated, thank you for your time
 
Back
Top