One file per session
SessionStart, then Turn and Event lines, then SessionEnd: every record is {seq, kind, atUtc, name, payload} in plain NDJSON.
Tune your game on real play, not guesses.
MindAttic.Telemetry records every turn, every state change and every "this happened" moment of a game session into one crash-safe, append-only NDJSON file, then reads it back as flat rows ready for pandas or ML.
What it is
What is the right heal-to-damage ratio? Where do players actually lose? Balance questions like these deserve data, not hunches. MindAttic.Telemetry gives a game four calls, Begin, RecordTurn, RecordEvent and FinishAsync, and turns every run into a replayable record you can analyse later.
Each session is one append-only file with one JSON object per line, flushed as it is written. Because every line on disk is independently valid, a crash loses nothing already recorded. The next launch finds the abandoned file with a simple file-lock probe, closes it with a recovered marker and moves on. No background service, no agent, nothing to install.
It never forces a universal event shape on you. A tactics RPG's turn looks nothing like a platformer's, so you pass the before, command, events and after objects your rules engine already produces, verbatim. On the analysis side, TelemetryReader.Flatten explodes every event, standalone or inside a turn, into one flat row.
It was extracted and genericized from a MindAttic tactics game's battle recorder, which was already tuning real balance decisions from this data before this library existed.
Who it's for
TelemetryUnity calls that run in editor and development builds by default.read_json(lines=True), or iterate records from C#.Features
SessionStart, then Turn and Event lines, then SessionEnd: every record is {seq, kind, atUtc, name, payload} in plain NDJSON.
Every line is flushed and independently valid. A session that finishes cleanly is renamed from .ndjson.tmp to .ndjson; the rename is the clean-finish signal.
The next Telemetry.Begin sweeps for abandoned .tmp files nobody still holds open, appends a {"recovered":true} end record and renames them.
Full before/command/accepted/events/after turns from any event-sourced rules engine, or lightweight named events like shop.purchase, with whatever serializable data you already have.
TelemetryReader.Read streams typed records with JSON payloads; TelemetryReader.Flatten gives one flat row per event for analysis and ML.
Sessions record the game id, app and content version, seed and tags, so a run can be reconstructed by re-simulating it in your own deterministic engine.
com.mindattic.telemetry wraps the core for Unity 6 on any platform, with consistent camelCase member names and verbatim dictionary keys in both builds.
The core targets netstandard2.1 and net10.0 with no third-party packages. Writes are synchronous file appends: nothing to detach and nothing to run in the background.
Problems such as a payload the serializer rejects go to an ITelemetryLog sink that a host bridges to ILogger, Unity's Debug.Log or anything else; a Trace-based sink is built in.
How it works
Start a session when a battle, level or run starts, with its seed, version and tags.
Call RecordTurn after each command your rules engine applies, and RecordEvent for anything else worth knowing.
Pass the game's own outcome to Finish; the file is closed and marked clean.
Flatten sessions into rows and chart, query or train on them offline.
Quick start
The same calls are available in Unity through TelemetryUnity.
The full setup guide lives in the documentation.
var session = Telemetry.Begin(new TelemetryOptions { AppName = "MyApp", AppVersion = "1.4.0" }, "MyApp");
session.RecordEvent("level.start", new TelemetryData { ["level"] = 3 });
await session.FinishAsync(new { completed = true });
// later, offline:
var rows = TelemetryReader.Flatten(path).ToList();Part of MindAttic
MindAttic.Telemetry is the family's game-data recorder. GridGame.Unity consumes its Unity package through a local file: path, and its analysis output feeds balance decisions in MindAttic games.
It sits beside MindAttic.Media.Capture as the other half of observing a game: Capture records what the screen showed, Telemetry records what the rules engine did.
Status
Sessions, the NDJSON writer, orphan recovery and the reader and flattener are done and hardened. The last step to 1.0 is refreshing the DLL vendored into the Unity package and proving a GridGame session reads back with TelemetryReader.Flatten.
Current milestone: MindAttic.Telemetry 1.0: the Unity package at parity with the core.
Next step
Guides, reference and design notes are in the searchable MindAttic documentation. The source, issues and history are on GitHub.