Arkdaşlar Oyunda Kaç Oyuncu Olunca Full Olsun ve Orta Olunca Orta Yazsın Yazısını Config Eklemek İçin ;
config.cpp ' açıyoruz.
fprintf(stderr, "PLAYER_MAX_LEVEL: %d\n", gPlayerMaxLevel); ' Aratıyoruz..
Altına Bi Boşluk ;
Ekliyoruz. CH 1 , CH 2 , CH 3 , CH 4 , GAME99 Açıp Configlere Ekliyoruz. ;
Sayıları İsteğe Göre Değiştirebilirsiniz.
Metin2 Sunucularında Yeni Config Kodu Ekleme: Full ve Busy
Bu yazıda, Metin2 özel sunucularında C++ tabanlı yapıya yeni bir config kodunun nasıl ekleneceği anlatılmaktadır. Full ve Busy gibi durumları belirtmek için özel tanımlamalar yapacağız. Bu işlem hem game sunucusunda hem de auth sunucusunda yapılabilecek temel seviye bir geliştirme örneğidir.
Config Nedir ve Neden Kullanılır?
Metin2 özel sunucularında config dosyaları, sunucunun çalışma parametrelerini belirlemek için kullanılır. Bu dosyalar sayesinde sunucu kapasitesi, oyun ayarları, kanal durumu gibi birçok bilgi dinamik olarak yönetilebilir. Özellikle çoklu kanal sunucularda, bazı kanallar dolu (busy), bazıları tamamen dolu (full) olarak işaretlenebilir. Bu da oyuncuların doğru kanala yönlendirilmesini sağlar.
Full ve Busy Nedir?
Busy, kanalın mevcut oyuncu sayısının yüksek olduğunu; Full ise kanalın tamamen dolu olduğunu ve yeni oyuncuların giriş yapamayacağını ifade eder. Bu kavramlar genellikle client tarafında farklı ikonlarla gösterilir. Client, bu bilgileri auth sunucusundan alır. Auth sunucusu ise config dosyasından bu bilgiyi okur.
Yeni Config Kodu Ekleme Adımları
1. Config Dosyasında Tanımlama Yapmak
Auth sunucusunda bulunan config dosyasında (örneğin game/core/etc/config.cpp) yeni bir değişken tanımlamalıyız. Bu değişken, kanalın durumunu belirleyecek olan channel_status gibi bir yapıya sahip olabilir.
Örnek Kod:
2. Header Dosyasında Değişken Tanımı
config.h veya ilgili header dosyasında int m_bChannelStatus; tanımı yapılmalıdır.
3. Auth Paketi Gönderimi
Client, kanal listesini çekerken auth sunucusuna bir paket gönderir. Auth sunucusu da bu pakette her kanal için status bilgisini dönmelidir. Bu değer 0, 1 veya 2 olabilir. Client bu değere göre uygun simgeyi gösterir.
4. Client Tarafında Uygulama
Client tarafında uiscript/channel.py gibi dosyalarda bu bilgi kontrol edilerek görsel olarak gösterim yapılır. Örneğin, full kanallar gri renkte veya kilit simgesiyle gösterilebilir.
Potansiyel Hatalar ve Çözümler
Hata 1: Config dosyasında yazım hatası yapılırsa, sunucu status bilgisini doğru okumaz. Bu durumda client her zaman normal gösterim yapar.
Çözüm: Config dosyasındaki anahtar kelimeler büyük/küçük harf duyarlıdır. Kontrol edilmelidir.
Hata 2: Status bilgisi auth paketinde eksik gönderilirse client hata vermeden normal olarak algılar.
Çözüm: Paket yapısı doğru tanımlanmalı ve status bilgisi eksiksiz gönderilmelidir.
Sonuç
Metin2 özel sunucularında kanal durumu yönetimini sağlamak, kullanıcı deneyimini artırır. Full ve Busy gibi tanımlar sayesinde oyuncular daha akıllıca kanal seçimleri yapabilir. Bu makalede anlatılan adımlar, C++ tabanlı sunucu geliştirme konusunda ileri düzey bilgi gerektiren ancak oldukça faydalı bir uygulamadır. Bu yapıyı doğru implemente eden geliştiriciler, daha stabil ve kullanıcı dostu sunucular oluşturabilirler.
Adding New Config Code for Full and Busy in Metin2 Servers
In this article, we explain how to add a new config code into a C++ based Metin2 private server structure. We will make custom definitions for statuses like Full and Busy. This process can be applied on both the game and auth servers and serves as a basic level development example.
What is Config and Why is it Used?
In Metin2 private servers, config files are used to define server operational parameters. These files allow dynamic management of server capacity, game settings, channel status, and more. In multi-channel servers, certain channels can be marked as busy or full. This ensures players are directed to the correct channel.
What are Full and Busy?
Busy indicates that a channel has a high number of active players; Full means the channel is completely occupied and no new players can enter. These concepts are usually represented with different icons on the client side. The client retrieves this information from the auth server, which reads it from the config file.
Steps for Adding New Config Code
1. Define in Config File
In the config file located on the auth server (e.g., game/core/etc/config.cpp), we must define a new variable. This variable could be something like channel_status to determine the channel's state.
Sample Code:
2. Variable Declaration in Header File
The header file such as config.h must include the definition int m_bChannelStatus;.
3. Auth Packet Sending
When the client fetches the channel list, it sends a packet to the auth server. The auth server then returns the status value for each channel in that packet. This value can be 0, 1, or 2. The client displays the appropriate icon based on this value.
4. Client-Side Implementation
In client-side files like uiscript/channel.py, this information is checked to visually represent the channel status. For example, full channels may appear grayed out or with a lock icon.
Potential Errors and Solutions
Error 1: If there is a typo in the config file, the server will not read the status correctly, causing the client to always display normal status.
Solution: Keywords in the config file are case-sensitive. They must be carefully checked.
Error 2: If the status information is sent incompletely in the auth packet, the client will treat it as normal without errors.
Solution: The packet structure must be properly defined, and the status information must be sent completely.
Conclusion
Managing channel status in Metin2 private servers enhances user experience. With definitions like Full and Busy, players can make smarter channel selections. The steps outlined in this article are part of an advanced-level but highly useful implementation for C++ based server development. Developers who properly implement this structure can build more stable and user-friendly servers.
config.cpp ' açıyoruz.
fprintf(stderr, "PLAYER_MAX_LEVEL: %d\n", gPlayerMaxLevel); ' Aratıyoruz..
Altına Bi Boşluk ;
Kod:
TOKEN("CHANNEL_BUSY_MAX"){ str_to_number(g_iBusyUserCount, value_string); printf("Max_Orta_Oyuncu_Alma: %d\n", g_iBusyUserCount); continue; } TOKEN("CHANNEL_FULL_MAX") { str_to_number(g_iFullUserCount, value_string); printf("Max_Oyuncu_Alma: %d\n", g_iFullUserCount); continue; }
Ekliyoruz. CH 1 , CH 2 , CH 3 , CH 4 , GAME99 Açıp Configlere Ekliyoruz. ;
Kod:
CHANNEL_BUSY_MAX: 500 CHANNEL_FULL_MAX: 1200
Sayıları İsteğe Göre Değiştirebilirsiniz.
Metin2 Sunucularında Yeni Config Kodu Ekleme: Full ve Busy
Bu yazıda, Metin2 özel sunucularında C++ tabanlı yapıya yeni bir config kodunun nasıl ekleneceği anlatılmaktadır. Full ve Busy gibi durumları belirtmek için özel tanımlamalar yapacağız. Bu işlem hem game sunucusunda hem de auth sunucusunda yapılabilecek temel seviye bir geliştirme örneğidir.
Config Nedir ve Neden Kullanılır?
Metin2 özel sunucularında config dosyaları, sunucunun çalışma parametrelerini belirlemek için kullanılır. Bu dosyalar sayesinde sunucu kapasitesi, oyun ayarları, kanal durumu gibi birçok bilgi dinamik olarak yönetilebilir. Özellikle çoklu kanal sunucularda, bazı kanallar dolu (busy), bazıları tamamen dolu (full) olarak işaretlenebilir. Bu da oyuncuların doğru kanala yönlendirilmesini sağlar.
Full ve Busy Nedir?
Busy, kanalın mevcut oyuncu sayısının yüksek olduğunu; Full ise kanalın tamamen dolu olduğunu ve yeni oyuncuların giriş yapamayacağını ifade eder. Bu kavramlar genellikle client tarafında farklı ikonlarla gösterilir. Client, bu bilgileri auth sunucusundan alır. Auth sunucusu ise config dosyasından bu bilgiyi okur.
Yeni Config Kodu Ekleme Adımları
1. Config Dosyasında Tanımlama Yapmak
Auth sunucusunda bulunan config dosyasında (örneğin game/core/etc/config.cpp) yeni bir değişken tanımlamalıyız. Bu değişken, kanalın durumunu belirleyecek olan channel_status gibi bir yapıya sahip olabilir.
Örnek Kod:
Kod:
[COLOR=#9365b8]if (stricmp(szKey, 'CHANNEL_STATUS') == 0)[BR][/BR]{[BR][/BR] if (stricmp(szValue, 'FULL') == 0)[BR][/BR] m_bChannelStatus = 2; // Full[BR][/BR] else if (stricmp(szValue, 'BUSY') == 0)[BR][/BR] m_bChannelStatus = 1; // Busy[BR][/BR] else[BR][/BR] m_bChannelStatus = 0; // Normal[BR][/BR]}[/COLOR]
2. Header Dosyasında Değişken Tanımı
config.h veya ilgili header dosyasında int m_bChannelStatus; tanımı yapılmalıdır.
3. Auth Paketi Gönderimi
Client, kanal listesini çekerken auth sunucusuna bir paket gönderir. Auth sunucusu da bu pakette her kanal için status bilgisini dönmelidir. Bu değer 0, 1 veya 2 olabilir. Client bu değere göre uygun simgeyi gösterir.
4. Client Tarafında Uygulama
Client tarafında uiscript/channel.py gibi dosyalarda bu bilgi kontrol edilerek görsel olarak gösterim yapılır. Örneğin, full kanallar gri renkte veya kilit simgesiyle gösterilebilir.
Potansiyel Hatalar ve Çözümler
Hata 1: Config dosyasında yazım hatası yapılırsa, sunucu status bilgisini doğru okumaz. Bu durumda client her zaman normal gösterim yapar.
Çözüm: Config dosyasındaki anahtar kelimeler büyük/küçük harf duyarlıdır. Kontrol edilmelidir.
Hata 2: Status bilgisi auth paketinde eksik gönderilirse client hata vermeden normal olarak algılar.
Çözüm: Paket yapısı doğru tanımlanmalı ve status bilgisi eksiksiz gönderilmelidir.
Sonuç
Metin2 özel sunucularında kanal durumu yönetimini sağlamak, kullanıcı deneyimini artırır. Full ve Busy gibi tanımlar sayesinde oyuncular daha akıllıca kanal seçimleri yapabilir. Bu makalede anlatılan adımlar, C++ tabanlı sunucu geliştirme konusunda ileri düzey bilgi gerektiren ancak oldukça faydalı bir uygulamadır. Bu yapıyı doğru implemente eden geliştiriciler, daha stabil ve kullanıcı dostu sunucular oluşturabilirler.
Adding New Config Code for Full and Busy in Metin2 Servers
In this article, we explain how to add a new config code into a C++ based Metin2 private server structure. We will make custom definitions for statuses like Full and Busy. This process can be applied on both the game and auth servers and serves as a basic level development example.
What is Config and Why is it Used?
In Metin2 private servers, config files are used to define server operational parameters. These files allow dynamic management of server capacity, game settings, channel status, and more. In multi-channel servers, certain channels can be marked as busy or full. This ensures players are directed to the correct channel.
What are Full and Busy?
Busy indicates that a channel has a high number of active players; Full means the channel is completely occupied and no new players can enter. These concepts are usually represented with different icons on the client side. The client retrieves this information from the auth server, which reads it from the config file.
Steps for Adding New Config Code
1. Define in Config File
In the config file located on the auth server (e.g., game/core/etc/config.cpp), we must define a new variable. This variable could be something like channel_status to determine the channel's state.
Sample Code:
Kod:
[COLOR=#9365b8]if (stricmp(szKey, 'CHANNEL_STATUS') == 0)[BR][/BR]{[BR][/BR] if (stricmp(szValue, 'FULL') == 0)[BR][/BR] m_bChannelStatus = 2; // Full[BR][/BR] else if (stricmp(szValue, 'BUSY') == 0)[BR][/BR] m_bChannelStatus = 1; // Busy[BR][/BR] else[BR][/BR] m_bChannelStatus = 0; // Normal[BR][/BR]}[/COLOR]
2. Variable Declaration in Header File
The header file such as config.h must include the definition int m_bChannelStatus;.
3. Auth Packet Sending
When the client fetches the channel list, it sends a packet to the auth server. The auth server then returns the status value for each channel in that packet. This value can be 0, 1, or 2. The client displays the appropriate icon based on this value.
4. Client-Side Implementation
In client-side files like uiscript/channel.py, this information is checked to visually represent the channel status. For example, full channels may appear grayed out or with a lock icon.
Potential Errors and Solutions
Error 1: If there is a typo in the config file, the server will not read the status correctly, causing the client to always display normal status.
Solution: Keywords in the config file are case-sensitive. They must be carefully checked.
Error 2: If the status information is sent incompletely in the auth packet, the client will treat it as normal without errors.
Solution: The packet structure must be properly defined, and the status information must be sent completely.
Conclusion
Managing channel status in Metin2 private servers enhances user experience. With definitions like Full and Busy, players can make smarter channel selections. The steps outlined in this article are part of an advanced-level but highly useful implementation for C++ based server development. Developers who properly implement this structure can build more stable and user-friendly servers.
