Updater, encryption and compression
Last updated
Last updated
OTClientV8 comes with updater, encryption and file compression, here's how to use it.
First of all, encryption and compression is basically the same, wherever you encrypt file, first it's being compressed. For example, otcv8 is able to compress Tibia.dat from Tibia 10.99 from 177 MB to 49 MB.
First edit init.lua, make sure you set correct APP_NAME (just keep it unique), Services and Servers
Copy directory with everything, if you encrypt it by mistake you won't be able to recover it back. From now we work in copied directory
Open cmd, run otclient_gl.exe --encrypt
Wait 10-30s for message "encryption complete", close this message
Now create zip archive with data, modules and init.lua. To create zip archive use default windows feature for that, just select data, modules and init.lua, right click, send to -> Compress (zipped) folder. Rename this archive to data.zip
That's it. Copy otclient_gl.exe, otclient_dx.exe, libEGL.dll, libGLESv2.dll, d3dcompiler_46.dll and data.zip to another folder, compress this new folder and send it to players
We will add data.zip to .exe files, because there are 2 exes, if you're using updater and your data.zip is big, let's say bigger than 20MB, remove Tibia.dat and Tibia.spr from data.zip to make it smaller. OTCv8 will download them from updater.
Open cmd, and run 2 commands
It will append data.zip archive to .exe file, type
is windows equivalent of linux cat
.
Remove data.zip, send otclient_gl.exe, otclient_dx.exe, libEGL.dll, libGLESv2.dll and d3dcompiler_46.dll to players.
On your website server, upload somewhere updater.php and set link to updater service in init.lua, for example: updater = "http://otclient.ovh/test/updater.php"
Now create directory for your files, let's make directory called files
Upload otclient_gl.exe, otclient_dx.exe, libEGL.dll, libGLESv2.dll, d3dcompiler_46.dll and data.zip (with spr and dat)
Unpack data.zip, you can use linux command unzip data.zip
Open updater.php and configure it, especially:
Set chmod 777 to dir with updater.php, it must be able to create checksum files, so for example: chmod 777 /var/www/html/otclient/test
That's it your updater is configured. If you change something just remember to encrypt it first and then put it to your files
directory.
Sometimes you may fuckup something, and after update your client won't launch correctly. For your luck there's failsafe mode which can help recover from that state. But before explaing that, let's see how startup procedure looks like:
If there's init.lua in directory launch using this init.lua, don't use updater and finish startup sequence.
Scan files in %appdata%\otclientv8\APP_NAME, if there's an exe of same type (dx/gl in file name) newer than current running file, launch this exe. If new exe has been launched, wait 10s, if it's still working correctly then finish working, if not, then launch failsafe mode.
If there's no any newer exe to launch, check if there's data.zip in %appdata%\otclientv8\APP_NAME, if there is, use that data.zip. If it doesn't exist, use data.zip from current directory and if that doesn't exist too, try to use data.zip inside .exe file.
If anything goes wrong, fatal error, crash or anything else within 10s from start, start failsafe mode
In failsafe mode, otcv8 will load data.zip inside .exe file, not from %appdata%\otclientv8\APP_NAME. It will download all files again and create new data.zip in %appdata%\otclientv8\APP_NAME, then it will restart and try to run itself again using data.zip from %appdata%\otclientv8\APP_NAME. So if you by mistake uploaded wrong file and otcv8 won't start (for example it won't start if you use data.zip and some files are unencrypted), you still can fix that by uploading correct file. Players won't need to download everything again.