[TuT] c++17 client side

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 59

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
How to Update Client src c++17


Step 1:

First, we open the client source with visual studio 2019/2022.

Select all projects and right click on them -> properties -> General -> c++ language standard -> Here we choose c++17.





Step 2:

In each file (ctrl + shift +f) , we search for the following & delete them:

Kod:
using namespace std;
Step 3:

Now the following details need to be modified (every file):


Kod:
string pair make_pair vector

to
Kod:
std::string std::pair std::make_pair std::vector

Step 4:

Open Eterbase project stl.h file and delete this code:

Kod:
namespace std {     template <class _Ty>     class void_mem_fun_t         : public unary_function<_Ty *, void> {     public:         explicit void_mem_fun_t(void (_Ty::*_Pm)())             : _Ptr(_Pm) {}         void operator()(_Ty *_P) const         {((_P->*_Ptr)()); }     private:         void (_Ty::*_Ptr)();         };     template<class _Ty> inline     void_mem_fun_t<_Ty> void_mem_fun(void (_Ty::*_Pm)())     { return (void_mem_fun_t<_Ty>(_Pm)); }     template<class _Ty>     class void_mem_fun_ref_t : public unary_function<_Ty, void> {     public:         explicit void_mem_fun_ref_t(void (_Ty::*_Pm)())             : _Ptr(_Pm) {}         void operator()(_Ty& _X) const         { return ((_X.*_Ptr)()); }     private:         void (_Ty::*_Ptr)();     };     template<class _Ty> inline     void_mem_fun_ref_t<_Ty> void_mem_fun_ref(void (_Ty::*_Pm)())     { return (void_mem_fun_ref_t< _Ty>(_Pm)); }         // TEMPLATE CLASS mem_fun1_t template<class _R, class _Ty, class _A>     class void_mem_fun1_t : public binary_function<_Ty *, _A, _R> { public:     explicit void_mem_fun1_t(_R (_Ty::*_Pm)(_A))         : _Ptr(_Pm) {}     _R operator()(_Ty *_P, _A _Arg) const         { return ((_P->*_Ptr)(_Arg)); } private:     _R (_Ty::*_Ptr)(_A);     };         // TEMPLATE FUNCTION mem_fun1 template<class _R, class _Ty, class _A> inline     void_mem_fun1_t<_R, _Ty, _A> void_mem_fun1(_R (_Ty::*_Pm)(_A))     { return (void_mem_fun1_t<_R, _Ty, _A>(_Pm)); } }

Step 5:

In each file (ctrl + shift +f) , we search for the following & modify them:

Kod:
std::void_mem_fun

to

Kod:
std::mem_fn

this

Kod:
std::auto_ptr
to:

Kod:
std::unique_ptr

Step 6:

Open userinterface/userinterface.cpp

Search this:

Kod:
extern "C" { extern int _fltused; volatile int _AVOID_FLOATING_POINT_LIBRARY_BUG = _fltused; };

add under this:
Kod:
extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }

Step 7:

Open Speherelib/spherepack.h

modify this:
Kod:
inline void LostChild(SpherePack *pack);

to:

Kod:
void LostChild(SpherePack *pack);

Step 8:


open etherBase/cipher.h

search this:

Kod:
#include <cryptopp/cryptlib.h> #pragma warning(pop)

add under this:

Kod:
using CryptoPP::byte;


Step 9

Open etherpack/Eterpack.h


Kod:
#include <boost/unordered_map.hpp> #include <boost/shared_array.hpp>

modify to:

Kod:
#include <unordered_map>

Replace all file this:

Kod:
boost::

to:

Kod:
std::

Open etherpack/EterpackManager.h & EterPackPolicy_CSHybridCrypt.h

modify this:

Kod:
#include <boost/unordered_map.hpp>

to

Kod:
#include <unordered_map>


Open GameLib/Area.cpp

remove this:

Kod:
#include <boost/algorithm/string.hpp>

and this:

Kod:
boost::algorithm::to_lower(attrFileName);

modify to:

Kod:
std::transform(attrFileName.begin(), attrFileName.end(), attrFileName.begin(), [](unsigned char c) { return std::tolower(c); });



You can also delete the boost in the include folder.

If you don't understand something, you can ask your questions here.


I edit the topic how to upgrade ikarus libconfig to compatibile with c++17
C++17 ile Metin2 Client Tarafında Geliştirme: Modern Yaklaşımlar

Metin2 özel sunucuları geliştirmek isteyen geliştiriciler için client-side (istemci tarafı) kodlama büyük önem taşır. Bu bağlamda, C++17 standartları ile geliştirilen client-side sistemler, performans, güvenlik ve esneklik açısından önemli avantajlar sunar. Bu yazıda, Metin2 client tarafında C++17 ile neler yapılabileceğini, nasıl daha stabil ve güçlü sistemler kurulabileceğini ele alacağız.

C++17 Özellikleri ve Metin2 Client Entegrasyonu

C++17, modern C++ programlamada önemli adımlar atmıştır. Özellikle structured bindings, string_view, filesystem, if constexpr[/COORD], gibi yenilikler client-side işlemlerde büyük kolaylıklar sağlar. Örneğin, string_view sayesinde, string işlemlerinde performans artışı sağlanabilir. Bu da Metin2 client tarafında paketlerin işlenmesi, karakter verilerinin parse edilmesi gibi işlemlerde hız kazandırır.

Client-side Paket Yönetimi

Metin2 client, server ile sürekli olarak veri alışverişi yapar. Bu veriler genellikle belirli paket yapıları üzerinden gelir. C++17 ile bu paketlerin deserialize edilmesi ve işlenmesi daha okunaklı ve hızlı hale getirilebilir. std::optional kullanarak eksik veya geçersiz verileri güvenli bir şekilde yönetmek mümkündür. Ayrıca structured bindings ile paket içindeki veriler kolayca parçalanabilir.

Modern STL Kullanımı ve Performans Artışı

STL kütüphanesinin C++17 ile gelen güncellemeleri, client-side sistemlerde bellek yönetimi ve veri yapısı kullanımında büyük fayda sağlar. std::any, std::variant gibi yapılar sayesinde, farklı tipteki veriler daha esnek bir şekilde işlenebilir. Bu da örneğin farklı paket tiplerinin tek bir fonksiyonla işlenebilmesini sağlar.

Metin2 Client Derleme Süreçleri

C++17 ile geliştirilen client-side sistemler, doğru derleme ayarlarıyla birlikte daha kararlı ve hızlı çalışan client dosyaları üretebilir. Özellikle Visual Studio 2019 veya GCC 7+ gibi derleyicilerle C++17 desteği aktif edildiğinde, client üzerindeki kodların optimize edilmesi sağlanabilir. Bu da client'in daha az CPU tüketmesini ve daha stabil çalışmasını sağlar.

Python ile Entegre Çalışma: Py Root ve UI Script

Metin2 client tarafında Python ile yazılmış UI script'ler (uiscript) ve py root yapıları mevcuttur. C++17 ile yazılmış client-side kodlarla bu Python betikleri arasında veri alışverişinin güvenli ve hızlı yapılabilmesi için özel interface'ler geliştirilebilir. Bu sayede hem grafiksel hem de mantıksal yönüyle client daha güçlü hale getirilebilir.

Güvenlik ve Anti-Cheat Mekanizmaları

C++17 ile client-side güvenlik önlemleri de güçlendirilebilir. Örneğin, constexpr ifadeleri ile derleme zamanında bazı kontroller yapılabilir. Ayrıca if constexpr sayesinde compile-time seçimlerle farklı güvenlik seviyeleri aktif edilebilir. Bu, client'ın modifikasyonlara karşı direncini artırır.

Sonuç

C++17 ile Metin2 client-side geliştirme, daha güçlü, güvenli ve optimize sistemler kurulmasına olanak tanır. Özellikle özel sunucuların rekabetçi PvP sistemlerinde, client tarafında yapılan iyileştirmeler doğrudan oyun deneyimini etkiler. Doğru teknik bilgi ve C++17 özelliklerinden yararlanarak güçlü client-side sistemler inşa edebilirsiniz.


C++17 Client-Side Development for Metin2: Modern Approaches

Client-side coding is crucial for developers looking to create Metin2 private servers. In this context, client-side systems developed with C++17 standards offer significant advantages in terms of performance, security, and flexibility. In this article, we will explore what can be achieved on the Metin2 client side using C++17, and how more stable and powerful systems can be built.

C++17 Features and Metin2 Client Integration

C++17 has taken important steps in modern C++ programming. Particularly innovations like structured bindings, string_view, filesystem, if constexpr, provide great convenience in client-side operations. For example, string_view allows performance improvements in string operations. This enhances speed in processing packets and parsing character data on the Metin2 client side.

Client-Side Packet Management

The Metin2 client constantly exchanges data with the server. These data typically come via specific packet structures. With C++17, deserializing and processing these packets can become more readable and faster. Using std::optional, missing or invalid data can be safely managed. Additionally, structured bindings allow packet data to be easily dissected.

Modern STL Usage and Performance Improvement

Updates to the STL library introduced with C++17 provide great benefits in memory management and data structure usage in client-side systems. Structures such as std::any and std::variant allow different types of data to be processed more flexibly. This enables various packet types to be handled by a single function.

Metin2 Client Compilation Processes

Client-side systems developed with C++17 can generate more stable and faster-running client files with proper compilation settings. Especially with compilers like Visual Studio 2019 or GCC 7+, enabling C++17 support ensures that code on the client is optimized. This leads to lower CPU consumption and more stable performance.

Integration with Python: Py Root and UI Scripts

In the Metin2 client, Python-based UI scripts (uiscript) and py root structures exist. Interfaces can be developed so that Python scripts interact securely and quickly with C++17-based client-side code. This strengthens both the graphical and logical aspects of the client.

Security and Anti-Cheat Mechanisms

Client-side security measures can also be enhanced with C++17. For example, certain checks can be performed at compile-time using constexpr expressions. Also, if constexpr allows different security levels to be activated through compile-time selections. This increases the client's resistance against modifications.

Conclusion

Developing Metin2 client-side applications with C++17 enables the creation of stronger, safer, and more optimized systems. Especially in competitive PvP systems of private servers, improvements made on the client side directly affect the gaming experience. By leveraging technical knowledge and C++17 features, you can build robust client-side systems.
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Benzer konular

Geri
Üst Alt