Merhaba arkadaşlar bildiğiniz gibi size metin2 de bir iteme 4 taş eklemeyi anlatmıştık fakat sistemde şöyle bir bug mevcut misalen 4 taş basılan bir iteminiz var siz bu itemi depoya koydunuz ve tekrar geri aldınız artık item 4 değil 3 taş basılabiliyor veya 4 taş basmışken teki kayboluyor. Çözümü biraz uğraştırsada sonunda gözden kaçan ufak bir koddan sonra çözdük sorunu ve sizlerle paylaşmak istedik çözümü işlemlerini db source üzerinden yapacağız.
Db/src/clientmanager.cpp açıyoruz.
Aratıyoruz :
Kod Bloğunda Buluyoruz :
Aşağıdaki Şekilde Değiştiriyoruz :
Aratıyoruz :
Aşagıdaki Şekilde Değiştiriyoruz :
Aratıyoruz :
Altına Ekliyoruz :
İşlemimiz Tamamlanmıştır .
[C++] 4 Taş Depo Bugu
Metin2 özel sunucularında geliştirme yaparken karşılaşılan hatalardan birisi de 4 Taş Depo Bugu'dur. Bu bug, oyuncuların depo sistemini manipüle ederek birden fazla taş gibi değerli ögeyi depolama alanına koyup, daha sonra sınırsız şekilde kullanabilmelerini sağlar. Bu durum sunucu dengesini ciddi şekilde bozar ve unfair avantajlara neden olur. Bugun kökeni genellikle C++ ile yazılmış olan oyun sunucusu tarafında meydana gelen mantık hatalarından veya veritabanı işlemlerindeki eksik kontrollerden kaynaklanır.
Bug Nedir?
4 Taş Depo Bugu, oyuncunun 4 adet değerli bir ögeyi depoya koyduktan sonra, tekrar geri alındığında depoda hâlâ aynı ögenin görünmesiyle oluşur. Bu, depo güncellemelerindeki eksik kontrollerden dolayı gerçekleşir. Örneğin, oyuncu 4 adet 'Taş' ögesini depoya yerleştirir, ancak oyun sunucusu bu ögelerin depoya doğru şekilde aktarılıp aktarılmadığını kontrol etmezse, ögeler hem depoda hem oyuncuda bulunabilir.
Neden Meydana Gelir?
Bu bug genellikle aşağıdaki sebeplerle oluşur:
- Oyuncu ögeleri depoya koyarken sunucu taraflı kontrol eksikliği.
- Veritabanı işlemi yapılırken rollback yapılmaması.
- Depo slotları ile oyuncu envanteri arasında çakışma kontrolü yapılmaması.
Sorunların Etkileri
Bu bug, sunucu üzerinde ciddi ekonomik ve dengesizlik sorunlarına yol açar. Oyuncular sınırsız kaynak elde edebilir, bu da oyun içi değerlerin düşmesine ve PvP sistemlerinde haksız rekabet ortamına neden olur. Özellikle Metin2 gibi PVP odaklı oyunlarda bu durum oyun deneyimini ciddi şekilde etkiler.
Çözüm Yolları
Bu bugu düzeltmek için aşağıdaki adımlar atılmalıdır:
1. Sunucu tarafında depo işlemleri için ekstra doğrulama mekanizmaları kurulmalıdır. Oyuncu ögeyi depoya koyduğunda, ögenin oyuncu envanterinden silinip silinmediği kontrol edilmelidir.
2. Veritabanı işlemleri sırasında transaction (işlem bloğu) kullanarak, işlem başarısız olduğunda otomatik geri alma sağlanmalıdır.
3. Depo slotları ile oyuncu envanteri arasında senkronizasyon sağlanmalı ve çakışma durumları kontrol edilmelidir.
4. Sunucu logları izlenerek anomali tespiti yapılmalı ve gerekirse otomatik ban sistemi devreye alınmalıdır.
Teknik Uygulama
Özellikle martysama gibi geliştirici sistemlerde, bu tür hatalar için game core ve db core üzerinde değişiklikler yapılması gerekir. Oyuncu ögesini depoya koyarken sunucu tarafında aşağıdaki gibi bir kontrol yapılmalıdır:
if (player_item_count > 0 && depot_slot_empty)
move_item_to_depot();
else
log_cheat_attempt();
Sonuç
4 Taş Depo Bugu, Metin2 özel sunucularında karşılaşılabilecek tehlikeli ve oyun dengesini bozan bir hatadır. Geliştiricilerin bu tür hataları erken tespit edip gerekli önlemleri alması büyük önem taşır. Oyun sunucusu güvenliği, veritabanı doğrulamaları ve oyuncu envanteri kontrolleri gibi konularda titizlikle çalışmak bu tür açıkların önüne geçebilir.
[C++] 4 Stone Storage Bug
One of the bugs encountered during development on Metin2 private servers is the 4 Stone Storage Bug. This bug allows players to manipulate the storage system by placing valuable items like stones into their storage and then using them unlimited times afterward. This disrupts the balance of the server and causes unfair advantages. The origin of this bug usually stems from logic errors in the C++ coded game server or insufficient checks in database operations.
What Is the Bug?
The 4 Stone Storage Bug occurs when a player places 4 valuable items into storage and upon taking them back, those same items still appear in the storage. This happens due to missing checks during storage updates. For example, if a player deposits 4 'Stones', and the game server does not properly check whether these items were correctly transferred to the storage, the items can remain both in the storage and with the player.
Why Does It Happen?
This bug typically arises due to the following reasons:
- Insufficient server-side validation when players deposit items.
- Failure to perform rollbacks during database operations.
- Lack of conflict checks between storage slots and player inventory.
Effects of the Problem
This bug causes serious economic imbalance and fairness issues on the server. Players can obtain unlimited resources, which devalues in-game items and creates unfair competition in PvP systems. Especially in PvP-focused games like Metin2, this situation significantly impacts gameplay experience.
Solution Approaches
To fix this bug, the following steps should be taken:
1. Extra validation mechanisms for storage operations must be implemented on the server side. When a player deposits an item, it must be checked whether the item has been removed from the player's inventory.
2. Database transactions should be used so that failed operations are automatically rolled back.
3. Synchronization between storage slots and player inventory must be ensured, and conflict scenarios should be checked.
4. Server logs should be monitored for anomalies, and automatic ban systems should be activated if necessary.
Technical Implementation
Especially in developer systems like martysama, fixes for such bugs require modifications to the game core and db core. An example check during the deposit process could look like this:
if (player_item_count > 0 && depot_slot_empty)
move_item_to_depot();
else
log_cheat_attempt();
Conclusion
The 4 Stone Storage Bug is a dangerous issue that can occur on Metin2 private servers and severely disrupt game balance. It is crucial for developers to detect and address such bugs early. Attention to server security, database validations, and player inventory checks can prevent such vulnerabilities.
Db/src/clientmanager.cpp açıyoruz.
Aratıyoruz :
Kod:
void CClientManager::QUERY_ITEM_SAVE(CPeer * pkPeer, const char * c_pData
Kod Bloğunda Buluyoruz :
Kod:
REPLACE INTO item%s (id, owner_id, window, pos, count, vnum, socket0, socket1, socket2,
Aşağıdaki Şekilde Değiştiriyoruz :
Kod:
REPLACE INTO item%s (id, owner_id, window, pos, count, vnum, socket0, socket1, socket2, socket3,
Aratıyoruz :
Kod:
VALUES(%u, %u, %d, %d, %u, %u, %ld, %ld, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)
Aşagıdaki Şekilde Değiştiriyoruz :
Kod:
VALUES(%u, %u, %d, %d, %u, %u, %ld, %ld, %ld, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)
Aratıyoruz :
Kod:
p->alSockets[2],
Altına Ekliyoruz :
Kod:
p->alSockets[3],
İşlemimiz Tamamlanmıştır .
[C++] 4 Taş Depo Bugu
Metin2 özel sunucularında geliştirme yaparken karşılaşılan hatalardan birisi de 4 Taş Depo Bugu'dur. Bu bug, oyuncuların depo sistemini manipüle ederek birden fazla taş gibi değerli ögeyi depolama alanına koyup, daha sonra sınırsız şekilde kullanabilmelerini sağlar. Bu durum sunucu dengesini ciddi şekilde bozar ve unfair avantajlara neden olur. Bugun kökeni genellikle C++ ile yazılmış olan oyun sunucusu tarafında meydana gelen mantık hatalarından veya veritabanı işlemlerindeki eksik kontrollerden kaynaklanır.
Bug Nedir?
4 Taş Depo Bugu, oyuncunun 4 adet değerli bir ögeyi depoya koyduktan sonra, tekrar geri alındığında depoda hâlâ aynı ögenin görünmesiyle oluşur. Bu, depo güncellemelerindeki eksik kontrollerden dolayı gerçekleşir. Örneğin, oyuncu 4 adet 'Taş' ögesini depoya yerleştirir, ancak oyun sunucusu bu ögelerin depoya doğru şekilde aktarılıp aktarılmadığını kontrol etmezse, ögeler hem depoda hem oyuncuda bulunabilir.
Neden Meydana Gelir?
Bu bug genellikle aşağıdaki sebeplerle oluşur:
- Oyuncu ögeleri depoya koyarken sunucu taraflı kontrol eksikliği.
- Veritabanı işlemi yapılırken rollback yapılmaması.
- Depo slotları ile oyuncu envanteri arasında çakışma kontrolü yapılmaması.
Sorunların Etkileri
Bu bug, sunucu üzerinde ciddi ekonomik ve dengesizlik sorunlarına yol açar. Oyuncular sınırsız kaynak elde edebilir, bu da oyun içi değerlerin düşmesine ve PvP sistemlerinde haksız rekabet ortamına neden olur. Özellikle Metin2 gibi PVP odaklı oyunlarda bu durum oyun deneyimini ciddi şekilde etkiler.
Çözüm Yolları
Bu bugu düzeltmek için aşağıdaki adımlar atılmalıdır:
1. Sunucu tarafında depo işlemleri için ekstra doğrulama mekanizmaları kurulmalıdır. Oyuncu ögeyi depoya koyduğunda, ögenin oyuncu envanterinden silinip silinmediği kontrol edilmelidir.
2. Veritabanı işlemleri sırasında transaction (işlem bloğu) kullanarak, işlem başarısız olduğunda otomatik geri alma sağlanmalıdır.
3. Depo slotları ile oyuncu envanteri arasında senkronizasyon sağlanmalı ve çakışma durumları kontrol edilmelidir.
4. Sunucu logları izlenerek anomali tespiti yapılmalı ve gerekirse otomatik ban sistemi devreye alınmalıdır.
Teknik Uygulama
Özellikle martysama gibi geliştirici sistemlerde, bu tür hatalar için game core ve db core üzerinde değişiklikler yapılması gerekir. Oyuncu ögesini depoya koyarken sunucu tarafında aşağıdaki gibi bir kontrol yapılmalıdır:
if (player_item_count > 0 && depot_slot_empty)
move_item_to_depot();
else
log_cheat_attempt();
Sonuç
4 Taş Depo Bugu, Metin2 özel sunucularında karşılaşılabilecek tehlikeli ve oyun dengesini bozan bir hatadır. Geliştiricilerin bu tür hataları erken tespit edip gerekli önlemleri alması büyük önem taşır. Oyun sunucusu güvenliği, veritabanı doğrulamaları ve oyuncu envanteri kontrolleri gibi konularda titizlikle çalışmak bu tür açıkların önüne geçebilir.
[C++] 4 Stone Storage Bug
One of the bugs encountered during development on Metin2 private servers is the 4 Stone Storage Bug. This bug allows players to manipulate the storage system by placing valuable items like stones into their storage and then using them unlimited times afterward. This disrupts the balance of the server and causes unfair advantages. The origin of this bug usually stems from logic errors in the C++ coded game server or insufficient checks in database operations.
What Is the Bug?
The 4 Stone Storage Bug occurs when a player places 4 valuable items into storage and upon taking them back, those same items still appear in the storage. This happens due to missing checks during storage updates. For example, if a player deposits 4 'Stones', and the game server does not properly check whether these items were correctly transferred to the storage, the items can remain both in the storage and with the player.
Why Does It Happen?
This bug typically arises due to the following reasons:
- Insufficient server-side validation when players deposit items.
- Failure to perform rollbacks during database operations.
- Lack of conflict checks between storage slots and player inventory.
Effects of the Problem
This bug causes serious economic imbalance and fairness issues on the server. Players can obtain unlimited resources, which devalues in-game items and creates unfair competition in PvP systems. Especially in PvP-focused games like Metin2, this situation significantly impacts gameplay experience.
Solution Approaches
To fix this bug, the following steps should be taken:
1. Extra validation mechanisms for storage operations must be implemented on the server side. When a player deposits an item, it must be checked whether the item has been removed from the player's inventory.
2. Database transactions should be used so that failed operations are automatically rolled back.
3. Synchronization between storage slots and player inventory must be ensured, and conflict scenarios should be checked.
4. Server logs should be monitored for anomalies, and automatic ban systems should be activated if necessary.
Technical Implementation
Especially in developer systems like martysama, fixes for such bugs require modifications to the game core and db core. An example check during the deposit process could look like this:
if (player_item_count > 0 && depot_slot_empty)
move_item_to_depot();
else
log_cheat_attempt();
Conclusion
The 4 Stone Storage Bug is a dangerous issue that can occur on Metin2 private servers and severely disrupt game balance. It is crucial for developers to detect and address such bugs early. Attention to server security, database validations, and player inventory checks can prevent such vulnerabilities.
