Hi everyone,
I encountered many difficulties while learning to create a proxy using the guide from Alpha Proxy Guide (kondrah/otclient multi-path proxy) (https://otland.net/threads/alpha-proxy-guide-kondrah-otclient-multi-path-proxy.291492/), so I decided to release my own tutorial in case anyone else faces similar problems.
I'd like to share a more detailed tutorial my way on how to set up a proxy.
Special thanks to @Michael Orsino for releasing his proxy, and to @Gesior.pl for his support and for sharing his method of running it.
This setup differs slightly from the original, so I hope it helps those looking for an alternative approach.
I won’t cover the standard TFS setup process here. The assumption is that you already know how to set up a regular TFS server without a proxy.
To ensure compatibility, please use the TFS and OTClient versions listed below:
We’ll need at least two VPS instances: one for the proxy server and another for hosting the TFS game server.
For testing purposes, I recommend using Hetzner Cloud. They offer affordable hourly-based VPS plans. The cheapest option costs around €0.006 per hour. You can also use this referral link: Hetzner Cloud (https://hetzner.cloud/?ref=b8220t4eIakD), which gives you €20 in free credits to use for testing.
I will use debian 12 destributuion!
Set up TFS on your VPS in the usual way, then connect to it using OTClient and the VPS IP address.
Once you’ve confirmed that the connection is working properly, we can proceed with configuring the proxy.
My test servers:
ON the VPS with tfs using IP address 167.235.139.46 we install alpha-proxy:
create proxy table (add to tfs db):
config.lua:
Apply the changes to TFS using the patch file I’ve linked in the post, then recompile TFS (0001-proxy.patch file)
The tfs setup is now complete.
Now set up the proxy VPS 88.198.152.33:
Install and configure the proxy
config:
restart haproxy:
check if HAProxy is running:
The alpha proxy setup is complete.
If you want, you can add more proxy VPSes with HAProxy. The process is exactly the same.
Otclient changes:
In
Then, inside the
Add the following line to
The client setup is complete.
Now we can run both TFS and Alpha Proxy.
alpha-proxy:
tfs:
Run OTClient.
Press CTRL + ALT + D to open the debug console and check if the proxy is working.
if P: shows a value around 5000, something is not working correctly.

this indicates that everything is working correctly:

now we can connect to the server using the IP address and port as follows
I have deployed two additional proxies on new VPS servers for testing purposes:
So, I added two new lines in the init.lua file on the client side.
I also inserted the new proxies into the proxy table in the database.
Client stats before login (press CTRL + ALT + D):

After logging into the game and moving the character, we observe that two proxies are active simultaneously. This means the client is sending packets to both proxies. These proxies then forward the packets to the VPS TFS and the Alpha proxy. The Alpha proxy consolidates the packets from the two proxies into a single stream before sending them to the TFS engine.

You can even replace the VPS IPs of the proxies with subdomains and dynamically update the IP addresses if needed. Without requiring players to restart the client. Set the TTL to 60 seconds in your DNS configuration at the hosting provider, allowing IP changes to propagate dynamically within one minute.
I encountered many difficulties while learning to create a proxy using the guide from Alpha Proxy Guide (kondrah/otclient multi-path proxy) (https://otland.net/threads/alpha-proxy-guide-kondrah-otclient-multi-path-proxy.291492/), so I decided to release my own tutorial in case anyone else faces similar problems.
I'd like to share a more detailed tutorial my way on how to set up a proxy.
Special thanks to @Michael Orsino for releasing his proxy, and to @Gesior.pl for his support and for sharing his method of running it.
This setup differs slightly from the original, so I hope it helps those looking for an alternative approach.
I won’t cover the standard TFS setup process here. The assumption is that you already know how to set up a regular TFS server without a proxy.
To ensure compatibility, please use the TFS and OTClient versions listed below:
TFS
- Nekiro’s downgraded TFS (1.5):
GitHub - nekiro/TFS-1.5-Downgrades: Alternative forgottenserver versions for older protocols support (https://github.com/nekiro/TFS-1.5-Downgrades)
OTClient
Choose one of the following options based on your preference:- OTCv8 (dev version):
GitHub - OTCv8/otcv8-dev: OTCv8 Development repository (source code) (https://github.com/OTCv8/otcv8-dev)
Use this if you know how to compile it. - OTClientV8 (precompiled):
GitHub - OTCv8/otclientv8: Clean, ready to use version of OTClientV8 - Alternative, highly optimized Tibia client (https://github.com/OTCv8/otclientv8)
Use this if you prefer a ready-to-use executable.
We’ll need at least two VPS instances: one for the proxy server and another for hosting the TFS game server.
For testing purposes, I recommend using Hetzner Cloud. They offer affordable hourly-based VPS plans. The cheapest option costs around €0.006 per hour. You can also use this referral link: Hetzner Cloud (https://hetzner.cloud/?ref=b8220t4eIakD), which gives you €20 in free credits to use for testing.
I will use debian 12 destributuion!
Set up TFS on your VPS in the usual way, then connect to it using OTClient and the VPS IP address.
Once you’ve confirmed that the connection is working properly, we can proceed with configuring the proxy.
My test servers:
- 167.235.139.46 - main vps with tfs and alpha proxy:
- 88.198.152.33 - proxy vps with HAProxy
ON the VPS with tfs using IP address 167.235.139.46 we install alpha-proxy:
Code:
sudo apt install -y build-essential cmake git
sudo apt install -y libboost-all-dev
git clone https://github.com/thatmichaelguy/alpha-proxy.git
cd alpha-proxy/ && mkdir build && cd build
cmake ..
make
create proxy table (add to tfs db):
SQL:
CREATE TABLE `proxies` (
`id` int(11) NOT NULL,
`host` tinytext NOT NULL,
`port` smallint(5) UNSIGNED NOT NULL DEFAULT 0,
`priority` smallint(5) UNSIGNED NOT NULL DEFAULT 0,
`disabled` tinyint(3) UNSIGNED NOT NULL DEFAULT 0
);
ALTER TABLE `proxies`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,
ADD PRIMARY KEY (`id`) USING BTREE,
ADD KEY `disabled` (`disabled`) USING BTREE;
INSERT INTO `proxies` (`id`, `host`, `port`, `priority`, `disabled`) VALUES
(1, '88.198.152.33', 7101, 0, 0);
config.lua:
LUA:
-- proxy
ip = "127.0.0.1" -- important, do not change
statusIP = "88.198.152.33" -- set this to your closest forward proxy server IP
bindOnlyGlobalAddress = true -- important, do not change
The tfs setup is now complete.
Now set up the proxy VPS 88.198.152.33:
Install and configure the proxy
Code:
sudo apt update
sudo apt-get update
sudo apt upgrade
sudo apt install haproxy
sudo nano /etc/haproxy/haproxy.cfg
config:
Code:
global
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 300000
defaults
timeout connect 4000
timeout client 180000
timeout server 180000
# login connections
listen l1
bind 0.0.0.0:7101
mode tcp
server srv1 167.235.139.46:7101 send-proxy-v2
# game connections
listen l2
bind 0.0.0.0:7201
mode tcp
server srv2 167.235.139.46:7201 send-proxy-v2
# status connections
listen l3
bind 0.0.0.0:7301
mode tcp
server srv3 167.235.139.46:7301 send-proxy-v2
Code:
sudo systemctl restart haproxy
check if HAProxy is running:
Code:
sudo systemctl status haproxy
The alpha proxy setup is complete.
If you want, you can add more proxy VPSes with HAProxy. The process is exactly the same.
Otclient changes:
In
modules/client_entergame/entergame.lua
, comment all proxy.clear()
.Then, inside the
onProxyList(protocol, proxies)
function, add the following line at first line:
Code:
g_proxy.clear()
Add the following line to
init.lua
:
LUA:
g_proxy.addProxy("88.198.152.33", 7101, 0) -- proxy vps
The client setup is complete.
Now we can run both TFS and Alpha Proxy.
alpha-proxy:
Code:
./build/alpha-proxy 7101
Post automatically merged:
tfs:
Code:
./build/tfs
Run OTClient.
Press CTRL + ALT + D to open the debug console and check if the proxy is working.
if P: shows a value around 5000, something is not working correctly.

this indicates that everything is working correctly:

now we can connect to the server using the IP address and port as follows
Code:
127.0.0.1:7171
I have deployed two additional proxies on new VPS servers for testing purposes:
- 138.199.192.76 – proxy VPS running HAProxy v2
- 91.99.98.174 – proxy VPS running HAProxy v3
So, I added two new lines in the init.lua file on the client side.
LUA:
g_proxy.addProxy("138.199.192.76", 7101, 0)
g_proxy.addProxy("91.99.98.174", 7101, 0)
I also inserted the new proxies into the proxy table in the database.
SQL:
INSERT INTO `proxies` (`id`, `host`, `port`, `priority`, `disabled`) VALUES
(2, '138.199.192.76', 7101, 0, 0), (3, '91.99.98.174', 7101, 0, 0);
Client stats before login (press CTRL + ALT + D):

After logging into the game and moving the character, we observe that two proxies are active simultaneously. This means the client is sending packets to both proxies. These proxies then forward the packets to the VPS TFS and the Alpha proxy. The Alpha proxy consolidates the packets from the two proxies into a single stream before sending them to the TFS engine.

You can even replace the VPS IPs of the proxies with subdomains and dynamically update the IP addresses if needed. Without requiring players to restart the client. Set the TTL to 60 seconds in your DNS configuration at the hosting provider, allowing IP changes to propagate dynamically within one minute.
Attachments
-
0001-proxy.patch9.4 KB · Views: 17 · VirusTotal
Last edited: