There is a tool that generates OTS map for www:
It's distributed as .exe for Windows or source code to compile on Linux, but to run it on Linux, you need graphics interface (GUI).
If you have slow PC or slow connection at home, images generation/upload of 10 GB map images may take 10+ hours. To fix these problems, you can use Cloud server with fast CPU, SSD and network to generate these images and then send them to www server using SCP.
In this tutorial I will show you how to run OTS map generator on Linux server without GUI.
I do not recommend running it on machine with OTS online. This tool does a lot of disk reads/writes (~3kk for RL map), that will slow down MySQL database and lag OTS.
For this tutorial I used 8 cores, 16 GB RAM Cloud server from Hetzner.com with Ubuntu 22.04.
It costs 0.04$ per hour to rent, it's billed by hour and it can generate 150 MB .otbm in 2-4 hours.
It installs with
1. Install all system libraries required by OTC mapgen for Ubuntu 22.04:
2. Download OTC mapgen, TFS 1.4 map (10.98), TFS
3. Fix 1 line in OTC mapgen that breaks running map generator from command line:
4. Put your config at end of
Parameters to edit:
It adds these lines to end of file
5. Compile OTC mapgen and move
6. Install X11 auth/virtual screen:
7. Connect to SSH with X11 protocol OR create virtual screen with
IDK why, but when I connect with X11 protocol thru SSH, map generator generates images 30-50% faster, than with virtual screen.
[OPTION 7.1] Use X11 protocol to stream app window [generator works faster]
To connect using X11 protocol, follow this tutorial: Linux - How to connect to GUI app running in Linux terminal (https://otland.net/threads/how-to-connect-to-gui-app-running-in-linux-terminal.293311/)
[OPTION 7.2] Use virtual screen [generator works slower, easier to setup]
To create virtual screen:
To set it as screen in current SSH terminal:
8. Run OTClient mapgen:
9. Wait until it generates all images and shows message
Depending on map size, it may take minutes or hours.
OTBM is converted to PNG. Now we must convert it into format that works on WWW.
10. Move map images to website generator folder and create new empty
11. Install PHP with modules required to generate images:
12. Go to website generator folder and run generator:
Depending on map size, it may take minutes or hours.
Now you can run your map view on website for test:
Replace
and open it in your web browser.
13. If it works, you can close PHP server (
[OPTION 13.1] .zip with no compression, ~4x bigger file, but creates .zip very fast
(
[OPTION 13.2] .7z with strong compression, ~4x smaller file, but it takes few times longer to create .7z
Now you can transfer it to server where you host OTS map website ex. using
To decompress it on second server run (zip):
or (7zip):
What is new in version 4.0?
- website view with NPCs and monsters search
- configurable town names and positions - big names visible on map
- possibility to link NPCs and monsters ex. mymap.com/#npc,Xodet , mymap.com/#monster,Dragon+Lord
- scripts to run 'zoom levels' and 'compression' on 16 cores on windows (for linux it was in version 3.0)
- house images generator - generate images of houses that you can use on 'houses' page in acc. maker
- minimap generator - you can generate full minimap and use it with any OTClient
- sources updated for new linuxes...
It's distributed as .exe for Windows or source code to compile on Linux, but to run it on Linux, you need graphics interface (GUI).
If you have slow PC or slow connection at home, images generation/upload of 10 GB map images may take 10+ hours. To fix these problems, you can use Cloud server with fast CPU, SSD and network to generate these images and then send them to www server using SCP.
In this tutorial I will show you how to run OTS map generator on Linux server without GUI.
I do not recommend running it on machine with OTS online. This tool does a lot of disk reads/writes (~3kk for RL map), that will slow down MySQL database and lag OTS.
For this tutorial I used 8 cores, 16 GB RAM Cloud server from Hetzner.com with Ubuntu 22.04.
It costs 0.04$ per hour to rent, it's billed by hour and it can generate 150 MB .otbm in 2-4 hours.
It installs with
root as default user, so all commands in this tutorial are executed as root.1. Install all system libraries required by OTC mapgen for Ubuntu 22.04:
Bash:
apt update
apt install -y build-essential cmake git-core libboost-all-dev libphysfs-dev libssl-dev liblua5.1-0-dev libglew-dev libvorbis-dev libopenal-dev zlib1g-dev zip
git clone -b stable-3.0 https://github.com/icculus/physfs.git && cd physfs && mkdir build && cd build && cmake .. && make -j $(nproc) && make install && cp /usr/local/lib/libphysfs.a /usr/lib/x86_64-linux-gnu/.
cd ../..
2. Download OTC mapgen, TFS 1.4 map (10.98), TFS
items.otb and Tibia 10.98 Tibia.spr and Tibia.dat:
Bash:
wget https://github.com/gesior/otclient_mapgen/archive/refs/heads/master.zip
unzip master.zip
cd otclient_mapgen-master/data
wget https://github.com/otland/forgottenserver/raw/refs/heads/1.4/data/world/forgotten.otbm
cd things/
wget https://downloads-oracle.ots.me/data/tibia-clients/dat_and_spr/1098.zip
unzip 1098.zip
cd 1098/
wget https://github.com/otland/forgottenserver/raw/refs/heads/1.4/data/items/items.otb
cd ../../..
3. Fix 1 line in OTC mapgen that breaks running map generator from command line:
Bash:
sed -i 's/g_dispatcher.scheduleEvent(prepareClient_action, 1000)/prepareClient_action()/g' otclientrc.lua
4. Put your config at end of
otclientrc.lua, to make map generator auto-start, when you start binary file.Parameters to edit:
1098 - protocol version (requires .dat and .spr files in data/things/VERSION_HERE)'/things/1098/items.otb' - path to protocol version items.otb (/ is data subfolder)'/forgotten.otbm' - path to map .otbm file8 - number of CPU cores to use to generate map
Bash:
echo " prepareClient(1098, '/things/1098/items.otb', '/forgotten.otbm', 8, 1) " >> otclientrc.lua
echo "generateMap('all', 30)" >> otclientrc.lua
otclientrc.lua. If you put wrong values here, use some tool to edit otclientrc.lua file manually, do not execute these 2 lines again!5. Compile OTC mapgen and move
otclient to main directory:
Bash:
mkdir build
cd build/
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j $(nproc)
mv otclient ../otclient
cd ..
6. Install X11 auth/virtual screen:
Bash:
apt install -y xauth xvfb
7. Connect to SSH with X11 protocol OR create virtual screen with
xvfbIDK why, but when I connect with X11 protocol thru SSH, map generator generates images 30-50% faster, than with virtual screen.
[OPTION 7.1] Use X11 protocol to stream app window [generator works faster]
To connect using X11 protocol, follow this tutorial: Linux - How to connect to GUI app running in Linux terminal (https://otland.net/threads/how-to-connect-to-gui-app-running-in-linux-terminal.293311/)
[OPTION 7.2] Use virtual screen [generator works slower, easier to setup]
To create virtual screen:
Bash:
Xvfb :99 -screen 0 100x100x24 &
Bash:
export DISPLAY=:99
8. Run OTClient mapgen:
Bash:
./otclient
9. Wait until it generates all images and shows message
Map images generation finished.. Press CTRL+C to close OTClient.Depending on map size, it may take minutes or hours.
OTBM is converted to PNG. Now we must convert it into format that works on WWW.
10. Move map images to website generator folder and create new empty
map for next images generation:
Bash:
mv exported_images/map website_and_php_files/map
mkdir exported_images/map
11. Install PHP with modules required to generate images:
Bash:
apt install -y php php-gd php-zip
12. Go to website generator folder and run generator:
Bash:
cd website_and_php_files/
./linux_run_all.sh
Now you can run your map view on website for test:
Bash:
cd map_viewer
php -S 0.0.0.0:8080
1.2.3.4 with your server IP and position 76,97,7 (x,y,z) on map with position where you can see something (in example is position for TFS 1.4 map, if you go to wrong position, screen will be black, but it does not mean that map viewer does not work):
Bash:
http://1.2.3.4:8080/index.htm#zoom,14,position,76,97,7
13. If it works, you can close PHP server (
CTRL+C), compress map files and send to www server.[OPTION 13.1] .zip with no compression, ~4x bigger file, but creates .zip very fast
Bash:
zip -0 map.zip map
zip with strong compression is only 30% smaller that uncompressed zip, if you want really strong compression, use 7zip)[OPTION 13.2] .7z with strong compression, ~4x smaller file, but it takes few times longer to create .7z
Bash:
apt install -y p7zip-full
7za a map.7z map
Now you can transfer it to server where you host OTS map website ex. using
scp (replace root with your user, 3.4.5.6 with server IP and /root/map.zip with path, where it should save map file):
Bash:
scp map.zip [email protected]:/root/map.zip
Bash:
apt install -y zip
unzip map.zip
Bash:
apt install -y p7zip-full
7z x map.7z