• 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 OTClient that unpack map.otbm to .png files - v4.0

OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Senator
Premium User
Joined
Sep 18, 2007
Messages
2,340
Solutions
41
Reaction score
1,758
Location
Poland
GitHub
gesior
To change this to work on a single floor, source changes would be needed?
These lines render lower floors:
Remove them and it will only render current floor.

I will test what LUA functions you need to call to generate image of x,y,z positions. I will also update code and add C++ function that generates any 'from x,y,z' 'to x,y,z' area with multifloor 'on/off'.
DO YOU NEED .EXE OR I CAN MAKE ONLY SOURCE CODE UPDATE?

If you want to compare OTBM maps, you can try this tool:
 

Way20

Well-Known Member
Joined
Sep 29, 2014
Messages
199
Solutions
3
Reaction score
71
I will also update code and add C++ function that generates any 'from x,y,z' 'to x,y,z' area with multifloor 'on/off'.
DO YOU NEED .EXE OR I CAN MAKE ONLY SOURCE CODE UPDATE?
That would be great, this function could make the process to generate images for specific areas much easier. I would appreciate if you could provide also the .exe.

If you want to compare OTBM maps, you can try this tool:
wow, didn't know about that, I will definitely check it out, thank you.
 
OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Senator
Premium User
Joined
Sep 18, 2007
Messages
2,340
Solutions
41
Reaction score
1,758
Location
Poland
GitHub
gesior
That would be great, this function could make the process to generate images for specific areas much easier. I would appreciate if you could provide also the .exe.


wow, didn't know about that, I will definitely check it out, thank you.
Add in version 5.1. There is source code and x64 .exe:

How to generate big image:
1) Load OTBM into RAM:
Lua:
prepareClient(854, '/things/854/items.otb', '/things/854/world.otbm', 1, 1)
g_map.setMaxXToLoad(70000)
g_map.loadOtbm('/things/854/world.otbm')
g_map.setMaxXToLoad(70000) - this is thing that not allowed to render map before. I forgot that otclient_mapgen requires to set 'maxX' position for map loading, by default it's -1, so it does not load tiles at all.

2) Generate image:
Code:
g_map.drawCustomMap('test.png', 32000, 32000, 7, 32500, 32300, false)
test.png - it will generate file with that name in folder with otclient.exe
32000, 32000, 7 - start position
32500, 32300 - end position (so image will be 500 x 300 tiles)
false - do not render lower floors

In case you want to render lower floors, but without shadow, type this before "g_map.drawCustomMap...":
Code:
g_map.setShadowPercent(0)
 

Way20

Well-Known Member
Joined
Sep 29, 2014
Messages
199
Solutions
3
Reaction score
71
Add in version 5.1. There is source code and x64 .exe:
For some reason x64 .exe file is not opening for me (no errors at all, it just doesnt open). I managed to install visual studio today and was able to compile x32 version, It worked to generate bigger images but gave me bunch of errors on console, other than that it worked perfectly, thank you.
View attachment 55281
 

Majster12

Member
Joined
Feb 20, 2009
Messages
132
Solutions
1
Reaction score
14
WARohlQ.png


PHP Fatal error: Uncaught Error: Call to undefined function imagecreatetruecolor() in C:\Users\xyz\Downloads\otclient_mapgen_v5.1_win-x64\otclient_mapgen_v5.1_win-x64\website_and_php_files\2_tile_generator.php:54
Stack trace:
#0 {main}
thrown in C:\Users\xyz\Downloads\otclient_mapgen_v5.1_win-x64\otclient_mapgen_v5.1_win-x64\website_and_php_files\2_tile_generator.php on line 54


Solved
Needed to uncomment extension=gd in php.ini
PPo8ffS.png
 
Last edited:

Majster12

Member
Joined
Feb 20, 2009
Messages
132
Solutions
1
Reaction score
14
How to reduce the distance between monsters by which the script groups monsters?
Because grouping monsters like this doesn't really help me. haha
yMYnYqD.png
 
OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Senator
Premium User
Joined
Sep 18, 2007
Messages
2,340
Solutions
41
Reaction score
1,758
Location
Poland
GitHub
gesior
Last edited:

Majster12

Member
Joined
Feb 20, 2009
Messages
132
Solutions
1
Reaction score
14
Now it's set to 25 tiles in X and Y range, and 1 floor (distance between monsters):
https://github.com/gesior/otclient_mapgen/blob/master/website_and_php_files/map_viewer/map.js#L165

Spawn image you posted is as I planned it. It shows big spawns where you can hunt for given monster.
I tried changing the number 25 to a smaller number such as 5 as well as to a larger number such as 100 but nothing changes.
What number should I use to get more groups but smaller?
 
OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Senator
Premium User
Joined
Sep 18, 2007
Messages
2,340
Solutions
41
Reaction score
1,758
Location
Poland
GitHub
gesior
I tried changing the number 25 to a smaller number such as 5 as well as to a larger number such as 100 but nothing changes.
What number should I use to get more groups but smaller?
Setting it to 5 or 2 should work. Make sure that map.js reloaded. It may be cached in web browser (chrome/firefox/safari) - in this case CTRL+F5 should reload it. If you are using cloudflare.com, it can be also cached there.
 

Majster12

Member
Joined
Feb 20, 2009
Messages
132
Solutions
1
Reaction score
14
Setting it to 5 or 2 should work. Make sure that map.js reloaded. It may be cached in web browser (chrome/firefox/safari) - in this case CTRL+F5 should reload it. If you are using cloudflare.com, it can be also cached there.
Thank you very much, caching was the issue. I totally forgot about it.
 

zippy

Member
Joined
Feb 1, 2011
Messages
233
Reaction score
8
Hi Gesior, great release. I have couple of questions. How to generate whole map into a png file?
Also if i would like to generate a minimap like below, where position is matching in real game. Such as on the minimap if i put a flag on position 1000, 1000, 7 it will be same as the png image generated. (By the way i would like to generate it as below, not with the high details such as now.)

map_edron.jpg
 
OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Senator
Premium User
Joined
Sep 18, 2007
Messages
2,340
Solutions
41
Reaction score
1,758
Location
Poland
GitHub
gesior
Hi Gesior, great release. I have couple of questions. How to generate whole map into a png file?
Also if i would like to generate a minimap like below, where position is matching in real game. Such as on the minimap if i put a flag on position 1000, 1000, 7 it will be same as the png image generated. (By the way i would like to generate it as below, not with the high details such as now.)

map_edron.jpg
Whole map as one image is generate for some zoom level. Also on some zoom level there is map with 1 pixel per 1 tile - split into 256x256 images.
Zoomed out images are in folder 'map/1', 'map/2' etc. after processing images with PHP script (last step of tutorial).

Tile colors on map above are not tile items zoomed out, but also they are not minimap colors. It's image created by some graphic designed.
 

zippy

Member
Joined
Feb 1, 2011
Messages
233
Reaction score
8
Whole map as one image is generate for some zoom level. Also on some zoom level there is map with 1 pixel per 1 tile - split into 256x256 images.
Zoomed out images are in folder 'map/1', 'map/2' etc. after processing images with PHP script (last step of tutorial).

Tile colors on map above are not tile items zoomed out, but also they are not minimap colors. It's image created by some graphic designed.
Thank you for the answer, i see what you mean. But is it possible to generate whole map as minimap.png?

By the way, thank you for this awesome tool!
 

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
923
Solutions
30
Reaction score
340
DashAsBinSh - Ubuntu Wiki (https://wiki.ubuntu.com/DashAsBinSh) :

My script is 'bash' script. You can run it by:
Code:
/bin/bash linux_run_all.sh
or [it will auto detect its bash, not dash]:
Code:
./linux_run_all.sh

EDIT:
Using sh command to run .sh file looks like a good idea, but in case of Debian, it forces use of 'dash' in place of 'bash'.
[email protected]:/home/ubuntu/otclient_mapgen/website_and_php_files# ./linux_run_all.sh
1: Move files to map_tiled folder
./linux_run_all.sh: line 6: php: command not found
2: Generate all zoom levels
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
./linux_run_all.sh: line 11: php: command not found
06:35:00 - Generate zoom levels - running processes: 0
3: Generate list of files to compress
./linux_run_all.sh: line 21: php: command not found
4: Compress images
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
./linux_run_all.sh: line 26: php: command not found
 
OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Senator
Premium User
Joined
Sep 18, 2007
Messages
2,340
Solutions
41
Reaction score
1,758
Location
Poland
GitHub
gesior
Player streaming is working? The update.php file is missing. It works or not?
Did not test it for years, but it should work. It looks like you just need to change update.php to update_outfits.php
Code:
    streamUpdateURL: 'update_outfits.php',
    streamUpdateOutfitsURL: 'update_outfits.php',
It will stream outfits data then, but show only 'map points' on map. You can also change this:
Code:
streamPlayers: true,
so it will display outfit images.

There should be update.php that stream player positions without outfits - version that saves transfer. I don't remember why I removed it, maybe I forgot to commit it.
 
Top