Jump to content

[M2Dev] Advanced Files To Build Your Server: Src & Server Files & Client [x64 / DX9Ex / CMake / Python3.14 / FreeType / XChaCha20-Poly1305]


Recommended Posts

  • Honorable Member

Hello everyone,

I’ve recently decided to start developing a set of clean, modernized files that are:

  • Easy to use
  • Have no external dependencies
  • Work out-of-the-box with CMake

For the base, I used the sources and client originally released by @ TMP4, and I’ve made several adjustments to simplify and modernize the setup.

🔧 What’s Included

  • Fully CMake compatible (no need for pkg or vcpkg).
  • All external dependencies are contained within the project:
    • vendor folder → dependencies built with the project
    • include folder → header-only libraries
  • 64-bit
  • Client build uses DirectX9 Ex

 

🚀 Getting Started

Server

Repo:

This is the hidden content, please

  1. Clone the repository.
  2. Run install.py -> it will create the required channel folders automatically
  3. You can configure map indexes per channel inside channels.py

Server Sources

Repo: 

This is the hidden content, please

cmake -S . -B build

This will generate the solution or makefiles, depending on your setup.

Client Sources

Repo: 

This is the hidden content, please

cmake -S . -B build

For a compatible client base, you can use this repo: 

This is the hidden content, please

Main features

  • x64
  • DirectX 9 Ex
  • batched text rendering
  • global party
  • effect decorators removed
  • better memory pooling
  • dislay mode detector removed
  • automatic MSAA detection
  • DeVIL -> stb_image
  • no DLLs, all libs are static
  • WebView2 for embedded browser
  • SSE2 mesh deform
  • new sound system: Miles -> MiniAudio
  • new custom pack system using ZSTD (compression) and XChaCha20-Poly1305 (encryption)
  • spdlog used for logging
  • FreeType
  • XChaCha20-Poly1305 via libsodium
  • Python 3.14 (with JIT enabled)

 

Contributors

 

You can join to our community committed to developing these files: https://discord.gg/2AyKB4Tydr

 

Small guide from @ Helia01 how to set up a MariaDB:

 

Changelogs are available directly in the commit messages. I’ll be pushing updates regularly. I recommend pulling the repository from time to time to stay up to date.

 I won’t be adding new features. My focus is strictly on rewriting, cleaning, and modernizing existing code.

Contributions are welcome! If you’d like to collaborate and contribute in your free time, feel free to join in.

Edited by Distraught
  • Metin2 Dev 853
  • kekw 14
  • Eyes 45
  • Flame 24
  • Think 2
  • Confused 1
  • Scream 5
  • Lmao 1
  • Good 257
  • muscle 30
  • Love 96
  • Love 745

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

When cloning, it says: This repository exceeded its LFS budget. The account responsible for the budget should increase it to restore access.

Edited by Flex
  • kekw 1
  • muscle 2
  • Honorable Member
On 8/24/2025 at 8:21 AM, Flex said:

When cloning, it says: This repository exceeded its LFS budget. The account responsible for the budget should increase it to restore access.

Actually you can use any client, in the client files there are no modifications. I just downloaded from @ TMP4's topic and put the cfg files under a config folder (so the root folder is not contaminated with many things). This is the only change you have to do, as I modified their loading path in the client sources. Also, you can delete all the dll files because everything is statically linked.

Edited by Distraught
  • Metin2 Dev 1

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

  • Active+ Member

First of all, thank you for sharing this. Additionally, it would be really great if you could add an installation guide or video for those unfamiliar with it. I've never used cmake before, so I'm unfamiliar with this type of setup. 

Thanks again.

  • Good 2
  • Love 1
  • Honorable Member
6 hours ago, blaxis said:

First of all, thank you for sharing this. Additionally, it would be really great if you could add an installation guide or video for those unfamiliar with it. I've never used cmake before, so I'm unfamiliar with this type of setup. 

Thanks again.

There are many tutorials on the internet about CMake, but I literally wrote down the only command you need to use.

 

UPDATE:

  • SpeedTree GPU leaf placement fixed & enabled by default
  • new mesh deformer using SSE2 instructions (~2x faster deform)
Edited by Distraught
  • Good 1
  • Love 2

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

Good job for this but there are some problems, compiling on freebsd 14.0 x64 are some errors, your serverfiles doesnt start the channels, just auth and db, using another serverfiles (tmp4) and game/db compiled from your source doesn't let you enter, you can login, select char see the map for 2 second and client it crash, without any error or something like this. You also can't create new char. Thats its all i tested on freebsd, on windows it works fine (i didn't test the create char part)

  • Active+ Member

the github links you shared for the client src and client don't work properly and won't clone. trying to get a build gives a lib error. i bought the build as open source. your contribution to the community is significant. thx.

Edited by hasanmacit

hasanmacit

  • Honorable Member
On 8/24/2025 at 8:21 AM, Flex said:

When cloning, it says: This repository exceeded its LFS budget. The account responsible for the budget should increase it to restore access.

I looked up GitHub's docs and I found this. Based on what they say, all of their plans have a bandwidth limit, so I would be charged for each download after the limit is reached.

Of course, I won't pay for this. So, if anyone knows any other options where LFS is not charged based on bandwidth, feel free to share.

.png

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

16 hours ago, Distraught said:

I looked up GitHub's docs and I found this. Based on what they say, all of their plans have a bandwidth limit, so I would be charged for each download after the limit is reached.

Of course, I won't pay for this. So, if anyone knows any other options where LFS is not charged based on bandwidth, feel free to share.

.png


You can just upload the large file on drive/mega 

Also i want to let you know on freebsd if you try to create a character db it crash, gdb doesn't show anything and the only error is this

SYSERR: Aug 26 21:17:43 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\...' at line 1
query: UPDATE player_index0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
 

On 8/23/2025 at 1:03 AM, Distraught said:

Hello everyone,

I’ve recently decided to start developing a set of clean, modernized files that are:

  • Easy to use
  • Have no external dependencies
  • Work out-of-the-box with CMake

For the base, I used the sources and client originally released by @ TMP4, and I’ve made several adjustments to simplify and modernize the setup.

🔧 What’s Included

  • Fully CMake compatible (no need for pkg or vcpkg).
  • All external dependencies are contained within the project:
    • vendor folder → dependencies built with the project
    • include folder → header-only libraries
  • 64-bit
  • Client build uses DirectX9

 

🚀 Getting Started

Server

Repo:

This is the hidden content, please

  1. Clone the repository.
  2. Run install.py -> it will create the required channel folders automatically
  3. You can configure map indexes per channel inside channels.py

Server Sources

Repo: 

This is the hidden content, please

cmake -S . -B build

This will generate the solution or makefiles, depending on your setup.

Client Sources

Repo: 

This is the hidden content, please

cmake -S . -B build

For a compatible client base, you can use this repo: 

This is the hidden content, please

Main features

  • x64
  • DirectX 9
  • batched text rendering
  • global party
  • effect decorators removed
  • better memory pooling
  • dislay mode detector removed
  • automatic MSAA detection
  • DeVIL -> stb_image
  • no DLLs, all libs are static
  • WebView2 for embedded browser
  • SSE2 mesh deform

 

Changelogs are available directly in the commit messages. I’ll be pushing updates regularly. I recommend pulling the repository from time to time to stay up to date.

 I won’t be adding new features. My focus is strictly on rewriting, cleaning, and modernizing existing code.

Contributions are welcome! If you’d like to collaborate and contribute in your free time, feel free to join in.

hy nice release but , Maybe if u want to upload all the static library ... i was stuck remake the library to compile src client

  • Metin2 Dev 1
 

 

  • Active+ Member
16 hours ago, Distraught said:

I looked up GitHub's docs and I found this. Based on what they say, all of their plans have a bandwidth limit, so I would be charged for each download after the limit is reached.

Of course, I won't pay for this. So, if anyone knows any other options where LFS is not charged based on bandwidth, feel free to share.

.png

simply use the unpacked assets, there isn’t any unpacked file over 100 MB, so LFS isn’t required at all

  • Love 1
  • Honorable Member
8 hours ago, Koray said:

simply use the unpacked assets, there isn’t any unpacked file over 100 MB, so LFS isn’t required at all

Some libs for the client also requires LFS.

Btw, the client is not really an issue. I mean there are no mods in there besides moving *.cfg files under a config folder and deleting *.dll files, so I could just simple delete it.

 

EDIT:

Ah, wait. So, 100MB is the limit where GitHub requires LFS? Then the libs can be moved from LFS to the normal repo.

I never used GitHub before, because we have our own GitLab instance running, where I had no limitations.

 

EDIT2:

I moved all the libs from LFS to the normal repo, so client-src can be cloned again.

 

EDIT3:

  • pull request from @ Koray merged
  • pull request from @ Amun merged
  • contributors added to the main topic
  • sequence table removed -> deterministic random is used instead

 

EDIT4:

*.eix and *.epk files are removed from client repo, so you can check it out now.

Unpacked files are under an "assets" folder. Open this folder and type in cmd: py pack --all
It will pack all the files and create the packs in the "pack" folder. Thanks for the packer script to @ Amun

Edited by Distraught
  • Metin2 Dev 2
  • Good 1
  • muscle 1
  • Love 3

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

I don't think particle batching will work, some effects using different D3DRS_SRCBLEND / D3DRS_DESTBLEND / D3DTSS_COLOROP states.

using diffuse with static color op states probably destroy colors.

  • Honorable Member
23 hours ago, Denizeri24 said:

I don't think particle batching will work, some effects using different D3DRS_SRCBLEND / D3DRS_DESTBLEND / D3DTSS_COLOROP states.

using diffuse with static color op states probably destroy colors.

Actually, I mostly overcome that, because I put the 3 values for blending states & color operation into a 32bit integer (as 1 byte is enough for each) which I decode at rendering. I had to turn off lighting not to affect the vertex diffuse color, because texturefactor was not affected by that. It's mostly good, some small adjustments needed only, and it'll work.

 

Also, guys pull the repo, some new fixes had been merged from @ Koray:

  • fix camera glitch issue
  • fix some memory leaks

 

Edited by Distraught
  • Metin2 Dev 1
  • Love 4

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

On my test the server work .. i instaled on windows mariadb106 with no_engine_substitution for that .. The problem when i inter the client: Sound and config not work.. if i set in config.exe the rezolution 1920x not work .. the sound not work.When I teleport or do certain things, I get random crashes from the client. No sys errors appear. syserr i think it's disable default .. becouse i dont have in folder log/syserr.txt 

In rest thank and kep going up <#

 

 

spacer.png

Edited by SmyleMDFK95
Core X - External 2 Internal
  • Love 1

Hello!
I just started to learn programming. I have a question: Could you tell me if those files are looking good for starting a  project for a longer time? What kind of c++ is available in the project?  If I would love to add systems like acce/sash/mounts/surfboard and etc., do I have to change something extra because of x64?

  • Honorable Member
2 hours ago, Eqarus said:

Hello!
I just started to learn programming. I have a question: Could you tell me if those files are looking good for starting a  project for a longer time? What kind of c++ is available in the project?  If I would love to add systems like acce/sash/mounts/surfboard and etc., do I have to change something extra because of x64?

It uses C++17 language standard.

You can add other systems but with caution. We changed some stuff, so maybe it's not gonna be a direct copy-paste method. Also, take care of the packet data types as LP64 and LLP64 differs in the size of long.

Edited by Distraught

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

  • Premium

Thank you for your contribution.

Clear up a few questions for me.


Why use CMake?
Doesn't it work on FreeBSD?

Edited by mackabro2
  • Honorable Member
11 hours ago, mackabro2 said:

Thank you for your contribution.

Clear up a few questions for me.


Why use CMake?
Doesn't it work on FreeBSD?

CMake is an industry standard build system. You can use it on any platform.

  • Metin2 Dev 1

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

Is SSE2 even enabled?

bool CPU_HAS_SSE2 = false;
bool GRAPHICS_CAPS_CAN_NOT_DRAW_LINE = false;
bool GRAPHICS_CAPS_CAN_NOT_DRAW_SHADOW = false;
bool GRAPHICS_CAPS_HALF_SIZE_IMAGE = false;
bool GRAPHICS_CAPS_CAN_NOT_TEXTURE_ADDRESS_BORDER = false;
bool GRAPHICS_CAPS_SOFTWARE_TILING = false;

 

I have a problem where the .EXE doesn't respond to configuration changes. For example, music is on even though it's off.

  • Premium
4 hours ago, SinusAlpha said:

Is SSE2 even enabled?

bool CPU_HAS_SSE2 = false;
bool GRAPHICS_CAPS_CAN_NOT_DRAW_LINE = false;
bool GRAPHICS_CAPS_CAN_NOT_DRAW_SHADOW = false;
bool GRAPHICS_CAPS_HALF_SIZE_IMAGE = false;
bool GRAPHICS_CAPS_CAN_NOT_TEXTURE_ADDRESS_BORDER = false;
bool GRAPHICS_CAPS_SOFTWARE_TILING = false;

 

I have a problem where the .EXE doesn't respond to configuration changes. For example, music is on even though it's off.

If your CPU supports it, the boolean will be set to true, check the entire commit and you will see it

	// CPU check
	int cpuInfo[4] = { 0 };
	__cpuid(cpuInfo, 1);

	CPU_HAS_SSE2 = cpuInfo[3] & (1 << 26);

 

  • Good 1
  • Honorable Member
22 hours ago, SinusAlpha said:

Is SSE2 even enabled?

bool CPU_HAS_SSE2 = false;
bool GRAPHICS_CAPS_CAN_NOT_DRAW_LINE = false;
bool GRAPHICS_CAPS_CAN_NOT_DRAW_SHADOW = false;
bool GRAPHICS_CAPS_HALF_SIZE_IMAGE = false;
bool GRAPHICS_CAPS_CAN_NOT_TEXTURE_ADDRESS_BORDER = false;
bool GRAPHICS_CAPS_SOFTWARE_TILING = false;

 

I have a problem where the .EXE doesn't respond to configuration changes. For example, music is on even though it's off.

As I quoted the cfg files are read from the config folder. Create a config program, that saves it there or move metin2.cfg there.

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.