Metin2 Statistics with InfluxDB

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
GitHub:
The following tutorial is also available on the GitHub repository.

Kod:
pkg install curl

And link it on the Makefile:
Kod:
-lcurl

Windows Setup​

For Windows it works with both vcpkg and compiling the lib manually.

Shared lib:
Kod:
vcpkg install curl[openssl]:x86-windows

Static lib:
Kod:
vcpkg install curl[openssl]:x86-windows-static

Auto Event Manager​

In case you already have this class/file, just compare and make the necessary changes. All the changes related to Influx are wrapped with the macro <code class="bbCodeInline">INFLUX_STATS</code>.

Don't forget to also make the necessary changes on <code class="bbCodeInline">main.cpp</code>. If you are already using this you won't need to include the header and initialize the class.

Edit Time​

The default is send the data every 10 minutes.

On the file <code class="bbCodeInline">InfluxData.cpp</code>, edit this code:
Kod:
void CInfluxData::Check(int day, int hour, int minute, int second) {     int lastNumber = minute % 10;     if (isInfluxEnabled &amp;&amp; lastNumber == 0 &amp;&amp; second == 00)

If <code class="bbCodeInline">lastNumber = 0</code>, then it means the number is divisible by, in this case, 10. Make sure when you edit the time to don't forget the seconds part, if you don't use it, it will run every second inside the minute you want to run it.

Examples for other times​


<h4>Every minute</h4>
Kod:
if (isInfluxEnabled &amp;&amp; second == 00)

<h4>Every 5 minutes</h4>
Kod:
int lastNumber = minute % 5;

<h4>Every 30 seconds</h4>
Kod:
int lastNumber = seconds % 30;     if (isInfluxEnabled &amp;&amp; lastNumber == 0)

Configuration​

To use this make sure you have it only enabled on ONE core per channel, the online counter inside the channel is common between the cores, just add this on the CONFIG file to enable Influx on the core.
Kod:
INFLUX_ENABLE: 1

The rest of the settings, can either be set on the source or by CONFIG options (this are the default values set on the source):
Kod:
INFLUX_URL: http://127.0.0.1:8086 INFLUX_TOKEN: &lt;token&gt; INFLUX_ORG: &lt;organization&gt; INFLUX_BUCKET: &lt;bucket&gt;

NodeJS Version​

In case you don't to use the source, a NodeJS version is available where you can use the Metin2 API to get the user count and send it to Influx.

The source method is preferred.

Acknowledgments:​

for testing the tutorial on Windows.
for testing the tutorial on FreeBSD.
Metin2 Sunucularında İstatistik Takibi: InfluxDB ile Veri Toplama ve Görselleştirme

Metin2 özel sunucu geliştirme dünyasında, performans analizi ve kullanıcı etkileşimlerinin takibi kritik öneme sahiptir. Bu bağlamda InfluxDB gibi zaman serisi veritabanları, Metin2 sunucularında istatistiksel verileri toplamak ve izlemek için ideal bir çözüm sunar.

InfluxDB Nedir?
InfluxDB, yüksek hacimli zaman serisi verilerini depolamak ve sorgulamak için optimize edilmiş açık kaynaklı bir veritabanıdır. IoT cihazları, sistem logları, metrik veriler gibi senaryolarda yaygın olarak kullanılır. Metin2 özel sunucularında ise oyuncu hareketleri, PvP istatistikleri, item düşüş oranları gibi verilerin toplanmasında büyük faydası vardır.

Neden Metin2'de InfluxDB Kullanmalısınız?
Metin2 özel sunucularında oyun içi etkinliklerin takibi, hata ayıklama ve dengeli sistem geliştirme açısından kilit rol oynar. InfluxDB ile şu verileri kolayca toplayabilirsiniz:
- Oyuncu giriş çıkışları
- PvP kazan-kaybet oranları
- Item drop oranları
- Canavar öldürme istatistikleri
- Sunucu gecikme süreleri (ping)

Kurulum ve Entegrasyon
InfluxDB, Docker kullanarak hızlıca kurulabilir. Sunucu tarafında Python veya C++ ile yazılmış scriptler üzerinden InfluxDB'ye veri gönderimi sağlanabilir. Özellikle Python tabanlı sistemlerde 'influxdb-client' kütüphanesi oldukça kullanışlıdır. Örneğin, oyuncu PvP kazandığında şu şekilde bir veri yazılabilir:

Kod:
[B]from influxdb_client import InfluxDBClient[BR][/BR][BR][/BR]client = InfluxDBClient(url='http://localhost:8086', token='your-token', org='your-org')[BR][/BR]write_api = client.write_api()[BR][/BR][BR][/BR]point = Point('pvp_stats').tag('player', 'PlayerName').field('win', 1)[BR][/BR]write_api.write(bucket='metin2_stats', record=point)


Grafana ile Görselleştirme
InfluxDB ile toplanan veriler Grafana arayüzüyle harika görseller haline getirilebilir. Oyuncu aktivitesi, PvP istatistikleri, sunucu performansı gibi veriler interaktif panellerle izlenebilir. Bu sayede sunucu yöneticileri anlık kararlar alabilir.

Otomatikleştirilmiş Raporlama
Python ile yazılmış scriptlerle, belirli zaman aralıklarında raporlar üretmek mümkündür. Bu raporlar, sunucu performansını artırmak, dengesizlikleri fark etmek ve oyuncu memnuniyetini artırmak için kullanılabilir.

Sonuç
Metin2 özel sunucu geliştiricileri için InfluxDB, veri odaklı kararlar almanın yolunu açar. Geliştirilen sistemlerde hata ayıklama, kullanıcı analizi ve oyun dengesi konularında güçlü bir destek sağlar. Martysama ve diğer Metin2 geliştirici topluluklarında da bu tür veri yönetim sistemleri giderek daha fazla popülerlik kazanmaktadır. Metin2lobby.com olarak, bu teknolojileri öğrenmek ve uygulamak isteyen geliştiricilere rehberlik etmeye devam ediyoruz.



Statistics Tracking in Metin2: Data Collection and Visualization with InfluxDB

In the world of Metin2 private server development, performance analysis and tracking user interactions are critical. In this context, time-series databases like InfluxDB provide an ideal solution for collecting and monitoring statistical data on Metin2 servers.

What is InfluxDB?
InfluxDB is an open-source database optimized for storing and querying high-volume time-series data. It is commonly used in scenarios such as IoT devices, system logs, and metric data. In Metin2 private servers, it can be highly beneficial for collecting data such as player movements, PvP statistics, item drop rates, and more.

Why Use InfluxDB in Metin2?
Tracking in-game activities on Metin2 private servers plays a key role in debugging and developing balanced systems. With InfluxDB, you can easily collect the following data:
- Player logins/logouts
- PvP win/loss ratios
- Item drop rates
- Monster kill statistics
- Server latency (ping)

Installation and Integration
InfluxDB can be quickly installed using Docker. Data can be sent to InfluxDB from scripts written in Python or C++ on the server side. In particular, the 'influxdb-client' library in Python-based systems is very useful. For example, when a player wins a PvP battle, you can write data like this:

Kod:
[B]from influxdb_client import InfluxDBClient[BR][/BR][BR][/BR]client = InfluxDBClient(url='http://localhost:8086', token='your-token', org='your-org')[BR][/BR]write_api = client.write_api()[BR][/BR][BR][/BR]point = Point('pvp_stats').tag('player', 'PlayerName').field('win', 1)[BR][/BR]write_api.write(bucket='metin2_stats', record=point)


Visualization with Grafana
Data collected with InfluxDB can be turned into great visuals using the Grafana interface. Player activity, PvP statistics, server performance, and other data can be monitored through interactive dashboards. This allows server administrators to make real-time decisions.

Automated Reporting
With Python-written scripts, reports can be generated at specific intervals. These reports can be used to enhance server performance, identify imbalances, and increase player satisfaction.

Conclusion
For Metin2 private server developers, InfluxDB opens the path to data-driven decision-making. It provides strong support in areas such as debugging, user analytics, and game balance within developed systems. Such data management systems are increasingly gaining popularity in developer communities like Martysama and others. As Metin2lobby.com, we continue to guide developers who wish to learn and apply these technologies.
 

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

Geri
Üst Alt