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

Windows Linux Running on Windows

Discovery

Developing myself
Joined
Apr 16, 2010
Messages
561
Solutions
11
Reaction score
262
Location
Neverland
Hello there!

Well, that's a tip for a lot of ppl who virtualize with another programs, use: WSL2.

Windows Subsystem for Linux​


WSL2 it's a resource, developed by Microsoft to install new Linux Images on Windows.

Microsoft provides a simple tutorial how-to setup everything.

https://docs.microsoft.com/en-us/windows/wsl/install-win10

YOUR WINDOWS 10 NEED TO BE UPDATED TO THE LAST VERSION

Download your Linux image on Microsoft Store:


1609155479720.png



1609155523096.png

1609155620321.png

Have a nice day :p
 
Time for tutorial "how to compile TFS on WSL, run in on Linux and connect from Windows Tibia client".
I will try to do it on evening. It's Microsoft technology :( They will drop support in 1-2 years.
I'm actually not sure about that. Microsoft has been looking to do steps in this direction for years. Even attempting to buy Ubuntu at one time. Big surprise, the linux community wasn't happy about that, so they backed out.
And since the linux community has been taking alot of steps lately to give windows users a better life when using GNU-systems and made the migrations alot easier, Microsoft has taken steps as well. But yeah, the tutorial will definitely be out of date in a year or two... But that goes for almost every tutorial. Most tutorials on OTLand are just not how you do things today anymore (for good reasons).
I really hope this progress continues. I am still forced to use dual-boot and that can be a pain.
 
Time for tutorial "how to compile TFS on WSL, run in on Linux and connect from Windows Tibia client".
I will try to do it on evening. It's Microsoft technology :( They will drop support in 1-2 years.

At this point it might be better to use Docker for such purposes since it also updated recently to be able to use WSL2 if on Windows10 host (works on Home version too), and even if Microsoft decides to drop support, dockerized project would still run (on whatever other virtualization you provide). 🤔
 
Time for tutorial "how to compile TFS on WSL, run in on Linux and connect from Windows Tibia client".
I will try to do it on evening. It's Microsoft technology :( They will drop support in 1-2 years.

Another great stuff, when you use WSL its totally compatible with visual studio.
About connection routing, I'll post another content haha
Post automatically merged:

does it run 32-bit programs like tibia client 6.4?

you keep using windows applications on windows, thats better for development, when coding, testing and deploying applications.
(i'm assuming tibia client 6.4 don't have linux support)
 
I just installed TFS, SSH server, MariaDB, PHP, Apache and Gesior2012 on WSL.
Connected to it from Windows OTClient, so it works, but it's not easy to install.

I found information, that you cannot make IP static on WSL2. Every system reboot, your Ubuntu machine will get new random IP.
Linuxes run using WSL are not using systemd, so most of debian/ubuntu tutorials from google are not compatible. I cannot recommend it for newbie users.

I will try to run TFS using Docker on Windows next weekend. Maybe it will be easier to install and configure.
 
I found information, that you cannot make IP static on WSL2. Every system reboot, your Ubuntu machine will get new random IP.
Ran into that once too, didn't wanna bother fucking with it too much and trashed WSL2 ever since. Still running WSL1 here. Not sure if they've added a proper way to make it run on a static IP yet.
 
Ran into that once too, didn't wanna bother fucking with it too much and trashed WSL2 ever since. Still running WSL1 here. Not sure if they've added a proper way to make it run on a static IP yet.
They made it impossible 'normal way'. First step of setting up static IP is to edit Windows 'vEthernet' network card and set there static IP/subnet, not DHCP. Now - installed WSL2 today - there is static IP by default. Windows/WSL somehow replace that static IP configuration every restart.
So only way to make it static is to create some .bat script that reconfigure Windows network settings every restart.
Linux.. Microsoft way: force some random changes that user cannot reconfigure, WE know better what user needs.
 
They made it impossible 'normal way'. First step of setting up static IP is to edit Windows 'vEthernet' network card and set there static IP/subnet, not DHCP. Now - installed WSL2 today - there is static IP by default. Windows/WSL somehow replace that static IP configuration every restart.
So only way to make it static is to create some .bat script that reconfigure Windows network settings every restart.
Linux.. Microsoft way: force some random changes that user cannot reconfigure, WE know better what user needs.

Hey there brother, would love to test this out and set up a local "test" server to run updates/tests on; did you end up creating a docker for TFS setup by chance?
 
Hey there brother, would love to test this out and set up a local "test" server to run updates/tests on; did you end up creating a docker for TFS setup by chance?
My current Windows TFS dev:
  • OTS compiles inside docker Linux machine
  • OTS runs inside docker Linux machine
  • MySQL runs on Windows
  • Website + phpmyadmin runs on Windows

To connect to server use IP 127.0.0.1 and port 7171.

Tested on TFS 1.4

How to install/run:
  • install WSL2
  • install Docker for Windows
  • install XAMPP - we install MySQL and website on Windows
  • edit file C:\xampp\mysql\bin\my.ini to make it run on all system IPs - just add line:
Code:
bind-address="0.0.0.0"
  • go phpmyadmin and add new user root with password root and 'host' % (it means 'any ip' in mysql)
  • edit config.lua and setup mysql connection ex.:
LUA:
mysqlHost = "192.168.55.102"
mysqlUser = "root"
mysqlPass = "root"
mysqlDatabase = "tfs15"
mysqlPort = 3306
use IP that Windows gets as it's local network IP, it will be accessible from docker - that way TFS 'inside docker' can connect to 'mysql running on Windows'
Code:
version: "3.7"

services:
  server:
    build:
      context: .
    restart: always
    volumes:
      - .:/srv
    ports:
      - "7171:7171"
      - "7172:7172"
Files are in real time sync, so you can edit Lua scripts on Windows and /reload Xxx on GOD to test changes.

Commands:
docker-compose build - checks, if there are any changes in src and compile sources
docker-compose up - starts server
CTRL+C - stops server

To stop/start server use docker-compose up/CTRL+C.
If you edit any C++ file, stop server, run docker-compose build and start it again.

Only thing to optimize left is to keep Linux TFS build folder somewhere in Windows or on some 'docker volume'. Right now every single change in C++ make it compile all files (not just 1 modified file).
You can edit CMakeLists.txt in TFS and remove line:
Code:
    set_target_properties(tfs PROPERTIES INTERPROCEDURAL_OPTIMIZATION True)
to make it compile much faster (compilation time dropped from 70 to 48 sec on my pc).
 
Little update on this. I had problem with compilation of OTClient on Windows, so I made it compile and run on Linux using docker and display client on Windows.
I've tested it with old version of edubart OTC ( GitHub - gesior/otclient_mapgen: Open Tibia map images generator [for LeafletJS]. Loads .otbm file and generate .png images 256x256 px (https://github.com/gesior/otclient_mapgen) ) on Windows 10.

It copies data (including Tibia.dat and Tibia.spr) into docker image, so to update data, you have to rebuild docker image.
It's because Windows -> Linux shared files are loaded super slow. Loading 500 MB Tibia.spr from directory shared using docker-compose volumes takes around 30 second vs 0.5 sec with file inside container.
Other direction (Linux -> Windows) is super fast and OTC was able to generate over 1000 .png images per second on shared volume.

How to do it:
1. Install Xserver ex. https://sourceforge.net/projects/vcxsrv/files/latest/download
2. Run XLaunch - all default, just click Next, Next, Next.
3. In OTC directory create file Dockerfile with:
Bash:
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/London

RUN apt update
RUN 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
RUN mkdir build

RUN 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/.

WORKDIR /usr/src/otclient/build

COPY src /usr/src/otclient/src/
COPY CMakeLists.txt /usr/src/otclient/
RUN cmake .. && make -j $(nproc) && mv otclient ../otclient

COPY data /usr/src/otclient/data
COPY mods /usr/src/otclient/mods
COPY modules /usr/src/otclient/modules
COPY init.lua /usr/src/otclient/init.lua
COPY otclientrc.lua /usr/src/otclient/otclientrc.lua

ENV DISPLAY=host.docker.internal:0.0

CMD cd /usr/src/otclient && ./otclient
4. In OTC directory create file:
Code:
version: "3.7"

services:
 server:
 build:
 context: .
 volumes:
      - ./exported_images:/usr/src/otclient/exported_images
5. To build docker image type: docker-compose build
6. To start client type: docker-compose up

It looks like normal client on Windows, but it's running on Linux and streaming screen to Windows.
There are 2 problems:
  • it - probably - does not use GPU, so it's 100% CPU rendering - on my 13900K it gets 12 FPS in OTC menu
  • it uses extra 2-4 CPU cores to encode -> transfer using network -> decode and display these 12 FPS

1717068229220.png
 
Back
Top