• 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

what OTC has anything to do about it? i was talking about website.
Also to use Javascripts it means website must be build with flash?
You can use current Leaflet Map JS version [no flash, HTML4/5 only], but you need to pass positions of stairs/ladders/teleport to javascript. Do you want to write all these positions to text file by yourself? I don't think so.
OTClient can load map, can change map parts to PNG images, but it can also write to file list of all teleports/stairs and their 'target' positions.

If you think about making a game with Leaflets.. it would be hard :p
If you want to make some different kind of 'map view' where you switch floor by clicking on items.. ok, but remember that 'hackers' can always change floor.

About Flash:
It's not supported on Apple phones/tables/macs.
It future (maybe even this year), it won't be supported in Google Chrome and Firefox!
Better do not use this technology, it's outdated.


@Gesior.pl
Can you try to explain the leaflet php code again?
Leaflet is JS and there is no PHP code. I can't explain it more. There are many examples and answers for 'all' questions on stackoverflow.
You can draw on map 'markers' (something like 'address description' on google maps), 'polygons' (any shape made from 'lines'), 'circles'. Then you can add to there markers 'actions' like 'mouse over' or 'click'. You can highlight some area of map and make map zoom to it, when you click on it.

I made with Leaflet RL tibia map, with 900 players streamed from RL map OT server [0 lag on OTS]. Update positions every second and 'animate' move of players. You could search player by name and follow him (map move when player move in game). When you zoom out map, it would be stupid to show '200 markers' on map, so I installed 'grouping' in Leaflet:
https://www.mapbox.com/mapbox.js/example/v1.0.0/leaflet-markercluster/
[ as you can see in this example, when you click on number of points it shows 'polygon' with area where they are and zoom you to that area ]
 
Do you want to write all these positions to text file by yourself? I don't think so
I wouldn't mind xD got like ~30 max
But well, I'm gona stack these posts on my good info collection and get back to it next year. Hopefully I'm using and know how to modify OTC by then.
 
Q:
@Gesior.pl
Can you try to explain the leaflet php code again?
A:
Leaflet is JS and there is no PHP code. I can't explain it more. There are many examples and answers for 'all' questions on stackoverflow.

I meant the PHP scripts that you made, on how to make the images leaflet-"format"
Cause I followed the steps on how to organize the images and it didnt work

This is how my unedited map files (straight outta OTClient):
G7I7mjR.png


This is what happens when I run the .php scripts

The 1st script just completly deleted all the generated folders
The 2nd script just made empty folders for every floor ('map2Composed/6' ../5 ../4' etc). without anything inside them
The 3rd script just made folders from 1-15
 
Sorry for spamming but I cant edit my posts??
I redid the whole thing and this time it worked
 
hi sry if this is the wrong place to ask this but my map editor has like it looks like walls for floors but when i open the game its normal floors how do i change the walls to normal floors?
 
I really didn't read everything on this thread, from what I did read you basically created a program that generates images from otbm's.

There is an easier way to store this data & render it as needed, what you could do is generate a pixel map

Using a Pixel map you could take an entire map 2000 x 2000 and store it in less then a 500kb per level * 16 levels, map = 8 megs...

Not bad eh?

Since there are 16,777,216 color combinations 256 ^ 3 (not including the alpha channel) one could assign each tile in the tibia.spr file to a color code.

I doubt the tibia spr contains more 50k tiles, even if it does, there are still 16,727,216 colors left.

Once that is all taken care of you can choose a portion of the image to render whether it is 2 x 2 or 100 x 100 because the color codes act as pointers to the tiles :)

You could store the whole map in 1 file.. I read somewhere TIFF format supports layers.

This is not just a concept. I actually have a bare bones prototype written up, if your interested in seeing it as its not written for this framework pm me.

Although I wrote it for a different framework its core language is lua.
 
@Codex NG
The most important difference is that your solution doesn't allow "zooming in".
 
I really didn't read everything on this thread, from what I did read you basically created a program that generates images from otbm's.

There is an easier way to store this data & render it as needed, what you could do is generate a pixel map

Using a Pixel map you could take an entire map 2000 x 2000 and store it in less then a 500kb per level * 16 levels, map = 8 megs...

Not bad eh?

Since there are 16,777,216 color combinations 256 ^ 3 (not including the alpha channel) one could assign each tile in the tibia.spr file to a color code.

I doubt the tibia spr contains more 50k tiles, even if it does, there are still 16,727,216 colors left.

Once that is all taken care of you can choose a portion of the image to render whether it is 2 x 2 or 100 x 100 because the color codes act as pointers to the tiles :)

You could store the whole map in 1 file.. I read somewhere TIFF format supports layers.

This is not just a concept. I actually have a bare bones prototype written up, if your interested in seeing it as its not written for this framework pm me.

Although I wrote it for a different framework its core language is lua.
1 color per 1 tile? You mean minimap? I wrote OTClient & PHP minimap generator.
RL map with zoom levels got 1800 files, ~2.6MB, format is GIF for obvious reason (256 colors).

This 'map unpacker' generate map view as in tibia client, so it's 32x32 pixels per tile.

2000x2000x16 [map size and levels] x 32 x 32 [pixels per tile.
It's 65.000.000.000 pixels, 65G pixels, each 3-4 bytes (truecolor), so that map would use 255GB on HDD, but my '75% quality JPG' version uses only 10GB. I think it's good compresion.

I doubt the tibia spr contains more 50k tiles, even if it does, there are still 16,727,216 colors left.
Tibia.spr does not contains tiles. It contains ITEMS, on each tile [map.otbm] can be few items and you need Tibia.dat file to compose them into 1 tile image.

Your idea is right except that:
- you need to render all 'different' tiles [all combinations of items that exist on map]
- some items are visible on more then one tile (64x64 items), so you need to generate these combinations too [if on tile X,Y is item Z, then on tile X-1,Y-1 is visible K part of item Z]
- if you zoom out, on 'screen' will be 100.000 tiles - it would kill webbrowser
- you will send your map in 'almost' .otbm format [all items, all positions], every hacker can write program to track items and get copy of your map :(
 
Here is my samples from the program
This is pixel map ( i know its tiny :( )
2lt2b82.jpg


And this the render from the pixel map using the tiles for the corresponding colors :)
acad1j.jpg
 
@Damc
I tested your version of map unpacker.
Forgotten server 10.76 map generated in 45 seconds
7.72 RL map generated in 17 minutes.
 
I can zoom in and out if I want, after all I am the one who wrote the program :)
We mean that Leaflet Map reduce number of images on screen with zoom levels generated by my program.
If you zoom out your map on screen will be 500.000 tiles [each 32x32 pixels] - it will kill your CPU/GPU.

@Codex NG
How will it generate tiles with many items on it (floor+wall+black board on it)? Ignore .dat file? What will it generate?
Your screenshot looks like map editor that generate 'ground' items only (so its kind of minimap, except that it's unreadable when you zoom out)..
 
We mean that Leaflet Map reduce number of images on screen with zoom levels generated by my program.
If you zoom out your map on screen will be 500.000 tiles [each 32x32 pixels] - it will kill your CPU/GPU.

@Codex NG
How will it generate tiles with many items on it (floor+wall+black board on it)? Ignore .dat file? What will it generate?
Your screenshot looks like map editor that generate 'ground' items only (so its kind of minimap, except that it's unreadable when you zoom out)..
It's an incomplete application atm but it has potential :)
This is something I wrote last year, I haven't worked on it since, I just wanted to show you that it is possible to reference the x,y of a tile as a pixel in an image.

There are ways loading the map without loading all the tiles when you zoom out.

Check out this site it explains a bit about pixels per inch (ppi) :)
http://www.photokaboom.com/photogra...ch_resolution_print_size_viewing_distance.htm
 
It's an incomplete application atm but it has potential :)
This is something I wrote last year, I haven't worked on it since, I just wanted to show you that it is possible to reference the x,y of a tile as a pixel in an image.

There are ways loading the map without loading all the tiles when you zoom out.

Check out this site it explains a bit about pixels per inch (ppi) :)
http://www.photokaboom.com/photogra...ch_resolution_print_size_viewing_distance.htm
Ye. You don't have to draw 500.000, but you need to calculate 'color' of pixel made of pixels from X to Y, so your CPU still got to loop over 500.000 tiles.
So you need to add 'cache' with already zoomed areas to not calculate zoomed image again.. and it's Leaflet Map format (cache of all zoom levels).
 
Cant he just generate the map this way, and then cut it Into tiles to get the same result? If its even possible to get all the items on the floor sprites?
 
Cant he just generate the map this way, and then cut it Into tiles to get the same result? If its even possible to get all the items on the floor sprites?
That is what I do with OTClient. Generate map cut to tiles 8x8 SQM.
To generate map image you need to load .spr, .dat and .otb files. Then load .otbm map. Then handle item images with size bigged then 32x32 px. Why anyone would write it all, when it's all in OTClient?

Then with PHP or other script you need to compose floors into final floors images (when you are on floor X you see all floors below). Then on level 'under' you must add some 'shadow', so users can see that it's not on current floor.
It all requires a lot of 'blending', which use a lot of CPU.

@Damc
With your version of OTClient and new LUA version I generated 7.72 RL map in 7 minutes!
 
7. Run: 5compressor.php

This didn't work for me, it just returned "Wrong config"

Code:
if(!isset($_REQUEST['s']) || !isset($_REQUEST['e']) || $_REQUEST['e'] < $_REQUEST['s'])
{
    die('Wrong config');
}
 
Can I somehow include monster images (from spawns) and maybe even NPCs to show my players? And where can I read more on how I can work with OTClient?
Thank you for this great thing you made
 
This didn't work for me, it just returned "Wrong config"

Code:
if(!isset($_REQUEST['s']) || !isset($_REQUEST['e']) || $_REQUEST['e'] < $_REQUEST['s'])
{
    die('Wrong config');
}
You must open this page with parameters:
PHP:
xxx.php?s=0&e=3
(generate floors 0 to 3), you can open that page in few web browser cards with different numbers like:
PHP:
xxx.php?s=0&e=5
xxx.php?s=6&e=9
xxx.php?s=10&e=11
xxx.php?s=12&e=12
It will run in 4 threads and use all cores of your PC.

You can also use any other program to compress these images. I did not test, but maybe this can help you (I dont know if it compress all images in subfolders):
http://www.imagebatch.org/

Can I somehow include monster images (from spawns) and maybe even NPCs to show my players? And where can I read more on how I can work with OTClient?
Thank you for this great thing you made
Include monster images? All monsters? For RL map it would be around 50.000 monsters. Do you want to show spawn on map with exactly position (paste image of monster to image on map) or let players search spawns on site - they type 'demon' and see list of all demons spawns [like 'google map search' with 'points' that appear on map when you search some kind of shop]? Then they can click on list and it will zoom place with monster.
I don't know any OTClient tutorial, everything changes very fast and documentation is not up to date.
People that know tibia protocol and 'how computers generate image on screen' can easily find everything in OTClient, but for newbies in 'game clients' it's hard to learn.
 
Back
Top