bazilerinde bu sorun vardir belki level atlayinca aninda yenilemiyor bunu yaptiktan sonra aninda yeniler
Server:
game/src/..
..packet.h aciyoruz ve bunu ariyoruz
Kod:
typedef struct packet_update_char
Kod:
short sAlignment;
Kod:
DWORD dwLevel;
Kod:
void CHARACTER::UpdatePacket()
Kod:
pack.sAlignment = m_iAlignment / 10;
Kod:
pack.dwLevel = GetLevel();
Client:
UserInterface/..
..packet.h aciyoruz ve bunu ariyoruz
Kod:
typedef struct packet_update_char
Kod:
short sAlignment;
Kod:
DWORD dwLevel;
Kod:
bool CPythonNetworkStream::RecvCharacterUpdatePacket()
Kod:
kNetUpdateActorData.m_sAlignment=chrUpdatePacket.sAlignment;
Kod:
kNetUpdateActorData.m_dwLevel=chrUpdatePacket.dwLevel;
Kod:
void CNetworkActorManager::UpdateActor(const SNetworkUpdateActorData& c_rkNetUpdateActorData)
Kod:
pkInstFind->SetAlignment(c_rkNetUpdateActorData.m_sAlignment);
Kod:
pkInstFind->SetLevel(c_rkNetUpdateActorData.m_dwLevel);
Kod:
struct SNetworkUpdateActorData
Kod:
short m_sAlignment;
Kod:
DWORD m_dwLevel;
Kod:
void CInstanceBase::SetAlignment(short sAlignment)
Kod:
void CInstanceBase::SetLevel(DWORD level) { m_dwLevel = level; UpdateTextTailLevel(m_dwLevel); }
Kod:
void CInstanceBase::UpdateTextTailLevel(DWORD level)
Kod:
void CInstanceBase::UpdateTextTailLevel(DWORD level) { if (IsPC()) { static D3DXCOLOR s_kLevelColor = D3DXCOLOR(152.0f/255.0f, 255.0f/255.0f, 51.0f/255.0f, 1.0f); char szText[256]; sprintf(szText, "Lv %d", level); CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor); } }
Kod:
void SetAlignment(short sAlignment);
Kod:
void SetLevel(DWORD level);
Ekleme bitmistir, bundan sonra leveliniz hep yenileniyor.
Metin2 Level Atlama Sistemi Fix: Anında Yenileme Sorunu
Metin2 özel sunucularında geliştirme yaparken karşılaşılan yaygın sorunlardan birisi, oyuncu karakterinin level atladığında bazı bilgilerin doğru şekilde güncellenmemesi veya geç güncellenmesidir. Bu durum özellikle PvP sistemlerinde ciddi avantaj veya dezavantajlar yaratabilir. Bu makalede, C++ tabanlı Metin2 oyun sunucusunda level atlama sonrası anlık yenileme yapılamaması problemi ele alınacak ve bu konuda kalıcı bir çözüm önerilecektir.
Level Atlama ve Sunucu Güncellemesi Nedir?
Metin2 oyununda karakterler, belirli miktarda EXP (deneyim) topladıklarında seviye atlar. Bu esnada karakterin can, mana,攻击力, savunma gibi istatistikleri değişir. Oyuncu, level atladığında bu yeni değerlerin hemen sunucu tarafından istemciye (client) yansıtılması gerekir. Aksi takdirde, oyuncu PvP sırasında beklenmedik hasar alabilir ya da beklemediği kadar güçlü olabilir.
Problemin Kaynağı
Genellikle bu problem, game_core tarafında level atlama event handler'ında eksik veya yanlış bir packet gönderiminden kaynaklanır. Özellikle bazı özel sunucular, level atlandığında sadece EXP miktarını sıfırlar ama karakterin yeni istatistiklerini istemciye bildiren UpdatePacket göndermez. Bu durumda oyuncu, level atladıktan sonra bir süre boyunca eski verilerle oynamaya devam eder.
Fix Uygulama Adımları
1. Game Core dosyasında char.cpp veya benzeri dosyada level atlama kontrolü yapılır. Bu kontrol genellikle PointChange(POINT_LEVEL) fonksiyonu içinde yer alır.
2. Level artışı tespit edildiğinde, CLifePacket veya CPointsPacket gibi paketlerin gönderilmesi sağlanmalıdır.
3. Gerekirse Python tarafında da UI script üzerinden bu bilgilerin ekrana yansıması sağlanmalıdır. Bu işlem için uiscript dosyalarında gerekli güncellemeler yapılmalıdır.
Örnek Kod Parçası (C++)
Kod:
if (old_level != GetLevel()) {[/COLOR][BR][/BR][COLOR=#9365b8] PointChange(POINT_MAX_HP); // Can yenileme[/COLOR][BR][/BR][COLOR=#9365b8] PointChange(POINT_MAX_SP); // SP yenileme[/COLOR][BR][/BR][COLOR=#9365b8] PointChange(POINT_ATT_GRADE); // Saldırı gücü[/COLOR][BR][/BR][COLOR=#9365b8] PointChange(POINT_DEF_GRADE); // Savunma[/COLOR][BR][/BR][COLOR=#9365b8]}
Test Etme ve Doğrulama
Fix uygulandıktan sonra, auth server[/BR]
ve game server yeniden derlenmeli ve test ortamında level atlama işlemi tekrarlanmalıdır. Oyuncu, level atladığında hemen can, mana ve saldırı gibi değerlerin güncellenip güncellenmediği gözlemlenmelidir. Ayrıca PvP testleri ile bu fix’in doğruluğu onaylanmalıdır.
Sonuç
Metin2 özel sunucularında C++ seviyesinde yapılan bu tip küçük ama kritik düzeltmeler, oyuncu deneyimini ciddi şekilde etkiler. Level atlama sonrası anlık veri güncellemesi yapılmazsa, hem oyun dengesi bozulur hem de oyuncuların güveni azalır. Bu nedenle sunucu geliştiricileri olarak bu gibi durumlara dikkat etmeliyiz. Daha fazla Metin2 geliştirme kaynağı için Metin2Lobby sitesini takip edebilirsiniz.
Metin2 Level Up Fix: Instant Refresh Issue
One of the common issues encountered during development on Metin2 private servers is the failure to properly update character stats immediately after a level up. This situation can cause significant advantages or disadvantages especially in PvP systems. In this article, we will address the issue of not refreshing stats instantly after a player levels up in a C++ based Metin2 game server and provide a permanent solution.
What is Level Up and Server Refresh?
In Metin2, characters gain experience (EXP), and once they reach a certain threshold, they level up. During this process, their stats like HP, SP, attack power, defense, etc., change. After leveling up, these new values must be immediately reflected to the client by the server. Otherwise, players may suffer unexpected damage or become unexpectedly powerful during PvP combat.
Root Cause of the Problem
Often, the issue stems from missing or incorrect packet sending within the level-up event handler in the game_core. Some private servers only reset the EXP value upon level up but fail to send an UpdatePacket containing the new stats to the client. As a result, the player continues playing with outdated stats for a while after leveling up.
Steps to Apply the Fix
1. In the char.cpp file or similar files inside Game Core, locate the level-up check. Usually, this check occurs inside the PointChange(POINT_LEVEL) function.
2. When a level increase is detected, ensure packets such as CLifePacket or CPointsPacket are sent to update stats.
3. If needed, UI scripts on the Python side should also reflect these updates on screen. For this purpose, necessary changes should be made in the uiscript files.
Sample Code Snippet (C++)
Kod:
if (old_level != GetLevel()) {[/COLOR][BR][/BR][COLOR=#9365b8] PointChange(POINT_MAX_HP); // Refresh HP[/COLOR][BR][/BR][COLOR=#9365b8] PointChange(POINT_MAX_SP); // Refresh SP[/COLOR][BR][/BR][COLOR=#9365b8] PointChange(POINT_ATT_GRADE); // Attack power[/COLOR][BR][/BR][COLOR=#9365b8] PointChange(POINT_DEF_GRADE); // Defense[/COLOR][BR][/BR][COLOR=#9365b8]}
Testing and Verification
After applying the fix, both auth server[/BR]
and game server should be recompiled and tested in a controlled environment. The player’s HP, SP, and attack values should refresh immediately after a level up. Additionally, PvP tests should confirm that the fix works correctly.
Conclusion
Minor but critical fixes like this one, applied at the C++ level in Metin2 private servers, significantly impact player experience. If instant stat updates are not handled after a level up, both game balance and player trust may deteriorate. Therefore, as server developers, we must pay attention to such details. For more Metin2 development resources, you can follow Metin2Lobby.
