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

is it possible to make otclient on web browser?

Yeah, no numpad for now. Are you using chrome? I didn't have issues with shift + left, what happens for you when it gets stuck?
I told you wrong, it's shift + right click - using firefox. Once you do so, basically you cannot do anything expect clicking buttons in-game.

And this is how the website looks like on safari (iOS) - tried google chrome aswell, same.
Used Gesior's link.

1728323450893.webp
 
SharedArrayBuffers (for threading) only works with https, and then we won't be able to stablish ws:// connections because of mixed contents.
What if you serv website with client using HTTP?
The browser hijacks the keys, you will have a better experience playing in fullscreen (F11). Let me know how it goes.
The website is working on my android device, but the client is not adapted to open the virtual keyboard. What issues did you face?
Tried F11, but ex. TAB still navigates to other website elements (works inside client, but also change web browser selected element).
Maybe client without data.zip loaded won't have that problem.
, I've used the link from Gesior with his adapted data.zip and nothing happens (iOS), however tried the same on Bluestacks and same issue - nothing is being downloaded nor any buttons are available.
On my Samsung phone with Opera/Chrome browser it downloads client and starts it, but clicking on text fields does not open phone's on-screen keyboard, so I cannot login. IDK Mehah OTC, but maybe some option in data.zip must be enable to make it work with phone.
1728323834811.webp
 
I told you wrong, it's shift + right click - using firefox. Once you do so, basically you cannot do anything expect clicking buttons in-game.

And this is how the website looks like on safari (iOS) - tried google chrome aswell, same.
Used Gesior's link.

View attachment 87544
Got the issue now! Shift gets stuck as pressed and you have to press it again, will have to update the game window to proper release it somehow. Thank you!
About iOS, damn, will need to test it here. But virtual keyboard won't work anyway.
Post automatically merged:

What if you serv website with client using HTTP?
The client won't work because of security enforcement when using SharedArrayBuffers. It will only only work without https when accessing using localhost (not even 127.0.0.1).
Post automatically merged:

Tried F11, but ex. TAB still navigates to other website elements (works inside client, but also change web browser selected element).
Maybe client without data.zip loaded won't have that problem.
Yeah, tab is an issue with browsers, as other function keys. We can't completely disable it and the best behavior I've seen so far is with chrome fullscreen. The client hotkeys will probably have to be changed to not conflict with browser hotkeys that we are not able to disable.
I will experiment more with using javascript to intercept browser keys as best as possible and still pass them to the client. Starting with tab and shift + right click if possible.
Post automatically merged:

On my Samsung phone with Opera/Chrome browser it downloads client and starts it, but clicking on text fields does not open phone's on-screen keyboard, so I cannot login. IDK Mehah OTC, but maybe some option in data.zip must be enable to make it work with phone.
View attachment 87545
Sadly, for now, the only way to open the virtual keyboard is making the browser focus on a real html input. I've experimented with creating a hidden input and focusing it when an input is selected in the game. It's hacky and mostly works. The best behavior is controlling it using the new VirtualKeyboard API (chrome only for now). Still lots of UI changes needed to make it usable though.
Post automatically merged:

@Gesior.pl @Niebieski it's actually easy to intercept all keys using javascript and still pass them to the client. There are exceptions, like shift + right click on firefox... Will implement soon.
Post automatically merged:

@Gesior.pl I've updated the guide to include your server, if you don't mind. I've also pushed the update to hijack all browser keys, a quick ctrl + shift + r to refresh cache might be needed.
 
Last edited:
it's actually easy to intercept all keys using javascript and still pass them to the client. There are exceptions, like shift + right click on firefox... Will implement soon.
I've tested it in Chrome. I can use hotkey (F1/Shift+F1 etc.), Ctrl, Shift and even Tab.

With normal Chrome settings I cannot use CTRL+T/CTRL+SHIFT+T, as these are Chrome card management shortcuts, but there is an option to install website as "application" in Chrome and then CTRL+T/CTRL+SHIFT+T (open/close Terminal) works in OTClient:
1728387018270.webp


I had this problem before, but I did not report it, as it was unplayable without proper keyboard handling.
When I run in game, I get errors in random moments and it freezes client, then kick from game after 10-20 seconds (probably server closes connection for no ping) and I have to login character again:
Code:
ERROR: got a network message with invalid checksum, size: 44
(after reconnect and 1 minute of running around)
ERROR: got a network message with invalid checksum, size: 2896
These packets are probably from OTS, as size: 2896 happened when I walked on stairs (big packet with new visible things on map).
 
Last edited:
There's another issue I've just found - if you login the game, and keeps the client open for a longer time while watching other tabs (it disconnects you and client is being stucked - you cannot do anything aslong as you won't refresh the site) - Firefox
 
if you login the game, and keeps the client open for a longer time while watching other tabs
It's normal and probably can't be fixed. Not active tabs in web browser goes into some 'low power' or 'suspended' mode, which heavily reduces available CPU power.
Ex. my site Item Image Generator - OpenTibiaLibrary (https://item-images.ots.me/generator/) generates .png images in web browser using JS and when it's not 'active tab', it slows down around 99% percent. Tibia XTEA encryption processing probably takes more CPU than this low power mode allows to process and it makes client disconnect. Tab miniature in Chrome also does not update (client runs with map-click -> server makes it walk), so rendering is probably disabled or so slow that it can't generate single frame in 5-10 seconds.
I will test this today.

EDIT:
I just though what I've reported and what problem @Niebieski has... maybe when OTC is in other Tab it gets ERROR: got a network message with invalid checksum, size error and it disconnects you from game.
 
Last edited:
There's another issue I've just found - if you login the game, and keeps the client open for a longer time while watching other tabs (it disconnects you and client is being stucked - you cannot do anything aslong as you won't refresh the site) - Firefox
It's normal and probably can't be fixed. Not active tabs in web browser goes into some 'low power' or 'suspended' mode, which heavily reduces available CPU power.
Ex. my site Item Image Generator - OpenTibiaLibrary (https://item-images.ots.me/generator/) generates .png images in web browser using JS and when it's not 'active tab', it slows down around 99% percent. Tibia XTEA encryption processing probably takes more CPU than this low power mode allows to process and it makes client disconnect. Tab miniature in Chrome also does not update (client runs with map-click -> server makes it walk), so rendering is probably disabled or so slow that it can't generate single frame in 5-10 seconds.
I will test this today.
The main game loop synchronizes with the browser's requestAnimationFrame, so it's true that it's related to reduction of power usage.
 
The main game loop synchronizes with the browser's requestAnimationFrame, so it's true that it's related to reduction of power usage.
Now I know why client don't go over 240 FPS even with V-sync disabled:
Code:
The frequency of calls to the callback function will generally match the display refresh rate
So I can't go infinite FPS and compare how many Web Client is able to generate compared to Mehah .exe.
I've compared it with 240 FPS on Windows, both clients use around 10% on GPU, but .exe uses only 2-3% CPU (less than 1 core 100% CPU speed) and Chrome with client uses 8-10% CPU (10% of 32 threads is 3 CPU cores going 100%).

EDIT:
I also got report from someone playing on cheap laptop with integrated GPU: it's unplayable. He had a lot of problems with downloading client, then with loading client and final in-game FPS is unplayable.
 
Last edited:
It's normal and probably can't be fixed. Not active tabs in web browser goes into some 'low power' or 'suspended' mode, which heavily reduces available CPU power.
Ex. my site Item Image Generator - OpenTibiaLibrary (https://item-images.ots.me/generator/) generates .png images in web browser using JS and when it's not 'active tab', it slows down around 99% percent. Tibia XTEA encryption processing probably takes more CPU than this low power mode allows to process and it makes client disconnect. Tab miniature in Chrome also does not update (client runs with map-click -> server makes it walk), so rendering is probably disabled or so slow that it can't generate single frame in 5-10 seconds.
I will test this today.

EDIT:
I just though what I've reported and what problem @Niebieski has... maybe when OTC is in other Tab it gets ERROR: got a network message with invalid checksum, size error and it disconnects you from game.
While I can understand you may be disconnected, I believe that it shouldn't freeze the client at all so I need to refresh the site
 
@Gesior.pl @Niebieski
I've pushed a fix to networking, it should properly handle all bytes now. Please let me know if you have any more freezes when playing.

I also got report from someone playing on cheap laptop with integrated GPU: it's unplayable. He had a lot of problems with downloading client, then with loading client and final in-game FPS is unplayable.
I'll try to profile the client and see if I can do anything to improve it. WebGL is indeed more CPU heavy: Optimizing WebGL — Emscripten 3.1.69-git (dev) documentation (https://emscripten.org/docs/optimizing/Optimizing-WebGL.html)
Post automatically merged:

@Gesior.pl by the way, my branch has a few modification to data and modules to fix files encoding and naming. Will help with not being able to load some modules.
And thanks for setting up the server, it has been of great help.
 
And this is how the website looks like on safari (iOS) - tried google chrome aswell, same.
Used Gesior's link.

View attachment 87544
@Niebieski I've setup a hackintosh and Safari works out of the box, so I will try to test iOS using the emulator from Xcode. This is probably just a problem with my javascript setup of the downloader and unzipper. You can confirm this by seeing if demo.otarchive.com will launch on your device.
Post automatically merged:

@Niebieski I've setup a hackintosh and Safari works out of the box, so I will try to test iOS using the emulator from Xcode. This is probably just a problem with my javascript setup of the downloader and unzipper. You can confirm this by seeing if demo.otarchive.com will launch on your device.
Nevemind, it also works in the simulator. Will have to try a real phone.
1728490651239.webp
 
Last edited:
@Niebieski I've setup a hackintosh and Safari works out of the box, so I will try to test iOS using the emulator from Xcode. This is probably just a problem with my javascript setup of the downloader and unzipper. You can confirm this by seeing if demo.otarchive.com will launch on your device.
Post automatically merged:


Nevemind, it also works in the simulator. Will have to try a real phone.
View attachment 87588
Tested on ios, getting empty dark page
 
you use websockify to redirect 444 to 7171 and nginx which listens on 444 and does proxy_pass on 7171? don't the exposed ports conflict with each other?
I run it like this on another machine (web.skalski.pro - 188.245.102.85) , not on machine with OTS:
Code:
444 -> 7171
443 -> 7172
and websockify on 2x screen to pass packets to another machine (to arm.skalski.pro - 130.61.85.191):
Code:
websockify -v localhost:7171 130.61.85.191:7171
websockify -v localhost:7172 130.61.85.191:7172
If you want to put in on 1 machine, you must make nginx redirect to other port ex. 6171 and 6172 and run websockify on these ports, which redirects to 7171 and 7172. nginx will offload SSL and websockify will convert WebSocket to normal Socket (TCP) connection.
 
@Gesior.pl

Thanks for explanation. So you only use nginx to have ports 443 and 444 provided with a certificate and pointing to the internal port, and then websockify redirects the internal ports to the engine ports 7171 and 7172 respectively? Doesn't that add delay to the gameplay (player > host A > host B > host A > player)? Couldn't it be simplified to just websockify? I saw that it has an option to pass it certificates as parameters (GitHub - novnc/websockify: Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service. (https://github.com/novnc/websockify?tab=readme-ov-file#encrypted-websocket-connections-wss)) - If you have a commercial/valid SSL certificate with one or more intermediate certificates, concat them into one file, server certificate first, then the intermediate(s) from the CA, etc. Point to this file with the --cert option and then also to the key with --key. Finally, use --ssl-only as needed., would that simplify configuration?
 
@Gesior.pl

Thanks for explanation. So you only use nginx to have ports 443 and 444 provided with a certificate and pointing to the internal port, and then websockify redirects the internal ports to the engine ports 7171 and 7172 respectively? Doesn't that add delay to the gameplay (player > host A > host B > host A > player)? Couldn't it be simplified to just websockify? I saw that it has an option to pass it certificates as parameters (GitHub - novnc/websockify: Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service. (https://github.com/novnc/websockify?tab=readme-ov-file#encrypted-websocket-connections-wss)) - If you have a commercial/valid SSL certificate with one or more intermediate certificates, concat them into one file, server certificate first, then the intermediate(s) from the CA, etc. Point to this file with the --cert option and then also to the key with --key. Finally, use --ssl-only as needed., would that simplify configuration?
It should work connecting directly to websockify with SSL, yes.
 
Back
Top