Summary
Server-side Stats Tracker for Arma Reforger. Captures player/session events and pushes them to your API/MySQL for live dashboards, leaderboards, and after-action reports.
Description
PB Stats Tracker is a server-side Enfusion Script component that records gameplay telemetry from your Arma Reforger server and ships it to your backend for analysis. It’s designed for live dashboards, leaderboards, after-action reports (AARs), retention analytics, and admin tooling—without requiring any client mods.
What it tracks
Players & sessions: joins/leaves, time played, faction, map, server build.
Combat events: kills, deaths, weapon, distance, headshots, teamkills.
Objectives & misc: captures, vehicle use, revives/downs (if available), chat flags.
Performance meta: tick timestamps, session IDs, and basic error counters.
How it works
In-game component: Hooks server events and buffers them safely.
Transport: Sends compressed JSON to your HTTP ingest API
POST /ingest?key=YOUR_SECRET (recommended)
—or write directly to MySQL if you choose to integrate EDF/RPF yourself.
Reliability: Buffered async dispatch with retries/backoff so gameplay isn’t blocked.
Why an API (vs direct DB)?
Security: Don’t expose DB creds on the game host; rotate a simple secret instead.
Portability: Easier to scale and move storage (MySQL, Postgres, or even a data lake).
Flexibility: Validate/transform events server-side before insert; enrich with Geo/IP, clan, or ban lists.
Firewalls: Outbound HTTPS is simpler than opening DB ports.
Yes, you could push straight to SQL (EDF/RPF), but the API pattern is safer and more flexible for production and multi-server fleets.
Quick setup
Backend
Stand up a small ingest service (Node/Express, Python/FastAPI, etc.).
Configure INGEST_SECRET=... and your DB connection.
Create tables (examples below).
Game server
In the mod config, set:
API_URL=https://yourhost/ingest
API_KEY=the-same-secret-as-backend
SERVER_NAME, optional tags (region/map).
Dashboards (optional)
Point Grafana/Metabase to the DB for leaderboards & AARs.
Troubleshooting
“Secret not matching”
Ensure API_KEY in the mod equals INGEST_SECRET on the backend (no spaces/newlines).
If passed in the query string, URL-encode it; if in a header, confirm the header name matches your backend.
Restart the server after config changes to clear any cached value.
No data arriving
Check firewall/NAT for outbound HTTPS from the game host.
Inspect backend logs for 4xx/5xx; enable request body logging (redact secrets).
Verify server time drift (<±2 min) for signed/dated schemes (if you enable them).
Performance & privacy
Low overhead: Batched, async sends; minimal main-thread work.
POPIA/GDPR friendly: Only stores SteamID and gameplay metrics. You can hash IDs or add retention windows.
Roadmap
Built-in EDF/RPF direct-SQL mode (optional).
WebSocket live feed for overlays.
Per-role performance stats and heatmaps.
Zero client mods, production-ready transport, and clean data for your community dashboards.
License
Arma Public License (APL)