If you grew up around the 1980s, it's possible that nothing gives you nostalgia quite like some of the video games from those days. I was given a Sega Mega Drive for Christmas when I was seven years old, and a large chunk of my early childhood memories involve my brother and me glued to the screen playing Sonic the Hedgehog 2, Wonder Boy in Monster Land, and Streets of Rage 2. I never played Mario 64, although I always wanted to. We never had a Nintendo 64, but I remember seeing gameplay on TV and thinking it looked worlds ahead of anything I'd played before. Don't get me wrong: my Sega was still genuinely considered sacred.

Of course, a lot of time has passed since then, and somehow I reached adulthood without ever playing Mario 64. Until recently.

I was looking for a game to use for some experimental work involving telemetry and observability. My idea was pretty simple: find a game and export some of its data into a telemetry backend so I could visualize events as logs or traces. I just wanted to prove that I could get a few recognizable pieces of game data into a telemetry backend.

Could I produce logs from game events? Could I record character movements? Could I see those records arriving in a backend and query them like telemetry from an ordinary application?

That was the milestone. Perhaps because Mario 64 felt like something missing from my childhood, it was the first game that came to mind.

SM64CoopDX and Lua

My first idea was to run a Super Mario 64 ROM in an emulator like Project64 and somehow extract the data from there. But that somehow was trickier than I initially thought. My optimism was greeted with the reality that games do not ship with a plug-and-play option for monitoring their internal state. I suppose I imagined that an emulator would run the game like a script and that all the useful signals would be available somewhere.

In practice, this part of the experiment started to look more complicated than the telemetry experiment itself. Before I could send anything to a backend, I first needed a reliable way to access the game's internal state. An older console game running inside an emulator does not exactly provide convenient hooks for modern telemetry. Accessing that state would have meant dealing with emulator internals, memory addresses, or decades-old game code. That was more complicated than I had in mind.

While looking for a more practical solution, I stumbled across SM64CoopDX. It is a multiplayer PC port of Super Mario 64 with support for Lua mods. I suppose I got lucky: the first game that came to mind for this experiment happened to have a community-built version that made its internal state relatively easy to access.

A quick word about Lua: it is a lightweight scripting language designed to be embedded into other applications. It is used in game development because it allows developers and modding communities to extend or modify a game's behaviour without changing or recompiling the underlying game engine. You can read more on the Lua website.

Instead of inspecting emulator memory or modifying the game engine, I could use SM64CoopDX's existing Lua modding API. I created a small telemetry mod that ran inside the game's modding environment and read information exposed by SM64CoopDX, including Mario's position, health, current action, level, and area.

At the simplest level, reading Mario's coordinates looked something like this:

local mario = gMarioStates[0] local x = mario.pos.x local y = mario.pos.y local z = mario.pos.z 

Here, gMarioStates[0] represents Mario's state. From there, the mod could read the values that changed as I moved through the game.

Those values were not telemetry yet. They were simply game data available to the Lua mod. The next step was to sample them, add context, and turn them into structured records that could be sent to a telemetry backend.

Our first telemetry

The first version of the mod did two basic things. It sampled Mario's position and watched for changes to his native movement action. The mod also collected and batched that data. A separate Python bridge ran alongside the game, read those batches from SM64CoopDX's mod storage, and converted them into OpenTelemetry logs, metrics, and traces.

Those observations eventually became structured records resembling this:

session=1796037959 level=9 area=1 x=-3311.779 y=159.178 z=5642.744 action=50333824 health=1920 

When Mario entered a native jump action, I could produce a separate event:

event=jump_started type=single action=50333824 

Later, when he landed or the action was interrupted, that became a completed jump with some additional context:

event=jump_completed type=single result=landed distance=426.310 height=235.879 airtime_ms=1166.7 

So far, although I had made progress, the output was not exactly pretty. It was a stream of logs saying, in effect, "Mario was here," "Mario started a jump," and "Mario completed a jump."

Seeing those records appear in Grafana still felt like a win. The game was producing recognizable telemetry. In Loki, I could filter the logs by service and inspect their attributes. In Tempo, the relationship was even more literal: I could inspect traces containing mario.jump spans, with each span representing an individual jump and its duration. I could confirm that Mario's actions in the game corresponded to records in the backend.

A Mario jump trace in Grafana Tempo. Each raw `mario.jump` endraw span represents one detected jump, including its duration.

Figure 1. A Mario jump trace in Grafana Tempo. Each mario.jump span represents one detected jump, including its duration.

If the experiment had stopped there, it still would have proved the original idea, albeit with a few shortcuts. But I started wondering what else was possible and how to make this string of data come to life.

Getting the data into the backend

Thanks to the Lua mod, I could collect the data. To make any of this useful, however, I still needed to move it out of the game and into an observability backend.

The complete path looked like this:

SM64CoopDX -> Lua instrumentation mod -> Python bridge -> OpenTelemetry Protocol (OTLP) -> Grafana LGTM stack -> Grafana dashboard 

The Lua mod writes small telemetry batches into SM64CoopDX's mod storage. Then a Python bridge watches that storage, parses the batches, adds attributes, and translates the records into OpenTelemetry logs, metrics, and traces.

The bridge exports all three signals over OTLP/HTTP to a local Grafana LGTM container:

http://127.0.0.1:4318/v1/logs http://127.0.0.1:4318/v1/metrics http://127.0.0.1:4318/v1/traces 

From there, the logs are available in Loki, metrics are available through the Prometheus data source, and traces are available in Tempo. Grafana sits on top and provides the interface for querying and visualizing them.

What does OpenTelemetry add here?

This is probably a good point to distinguish telemetry from OpenTelemetry. Full disclosure: I work in the observability space, so this experiment was also an opportunity to learn more about OpenTelemetry. I chose a local Grafana LGTM stack because it was straightforward to run without configuring hosted-service credentials and because other people could reproduce the experiment using open-source components.

Mario's coordinates, actions, jumps, health, and level changes are the telemetry. OpenTelemetry did not make the game produce those values, and it did not draw the visualization. The Lua mod collected the game data, while Grafana rendered the chart.

OpenTelemetry provided the standard structure and transport between those two ends. I could have written the positions to a CSV file and plotted them with a script. But this was an observability experiment, and OpenTelemetry became useful because I wanted to treat the playthrough like an observable system and represent it using the same signals used for applications and infrastructure.

In this project, those signals map to the game roughly like this:

OpenTelemetry signal Mario data How I used it
Logs Position samples, jump starts, and damage events Building the XY route and placing event markers
Metrics Jump counts, map visits, and completed events Aggregation and dashboard navigation
Traces Game sessions, map visits, jumps, and falls Showing how individual actions belong to a larger journey

The trace model is deliberately simple:

mario.session └── mario.map_visit ├── mario.jump ├── mario.jump └── mario.fall 

The most visible part of the project, the route in Grafana, is primarily built from logs in Loki. Prometheus is useful for aggregate measurements and for populating the session and map-visit selectors. Tempo provides another way to inspect the structure and timing of a playthrough.

OpenTelemetry therefore has a real role here, but it is the plumbing. It gives the data a consistent vocabulary, lets the different signals share identifiers, and transports them to an OTLP-compatible backend. Grafana was my choice for querying and visualizing those signals, but it was not the only possible destination.

Okay, let's make this look better

To be fair, the Lua mod made getting this far relatively straightforward. But I started thinking more about how the data could be visualized. Looking at a list of X/Z positions and jump actions was cool, but it felt disconnected from the journey of our heroic plumber. What was the best way to display all this information so that it was coherent and interpretable at a glance?

If I already had Mario's position, could I plot those coordinates and see the path he took through a level? If I knew when he jumped, could I place those jumps on top of the route? Could damage, falls, deaths, or other events become additional visual markers?

That was the point where the project stopped being only about exporting a few logs and became a data-visualization experiment.

The position values are three-dimensional:

  • X represents movement along one horizontal axis.
  • Z represents movement along the other horizontal axis.
  • Y represents height.

For a top-down journey view, I could use X and Z as the two Grafana axes. Ordinary position samples would form the route, while jumps and other events could be drawn as larger points at the coordinates where they occurred.

The mod samples Mario's position every six game frames. SM64CoopDX updates at 30 frames per second, giving me five position samples per second. That was frequent enough to produce a recognizable path without generating a record for every frame.

The idea now looked something like this:

Position logs -> green route Jump events -> yellow markers Damage events -> orange markers Deaths -> red markers 

At this stage, I was not trying to reconstruct the level itself. The goal was simply to plot Mario's movement through coordinate space.

Even so, the path could tell a story much better than a list of logs. Dense clusters could show places where I stopped, explored, fought enemies, or repeatedly attempted something. Loops could reveal backtracking - or simply me wandering aimlessly.

Turning coordinates into a journey map

Before building the map, I divided each game session into individual map visits. A playthrough could include Castle Grounds, the castle interior, Bob-omb Battlefield, and a later return to an earlier location. The bridge assigned each continuous section its own game_map_visit_id, allowing the dashboard to display one meaningful part of the journey at a time.

The main route comes from a Loki query for position samples:

{service_name="sm64coopdx"} |= "Mario position sample" | game_session_id = "$session" | game_map_visit_id = "$visit" 

A second query finds the jump markers for the same session and visit:

{service_name="sm64coopdx"} |= "Mario entered a native jump action" | game_session_id = "$session" | game_map_visit_id = "$visit" 

Damage and death markers follow the same pattern:

{service_name="sm64coopdx"} |= "Mario took damage" | game_session_id = "$session" | game_map_visit_id = "$visit" {service_name="sm64coopdx"} |= "Mario died" | game_session_id = "$session" | game_map_visit_id = "$visit" 

Inside Grafana, I extract the structured fields and convert the coordinate values into numbers. An XY chart uses mario_position_x as the X field and mario_position_z as the Y field.

The position samples are displayed as a green line with small points. Jump events use larger yellow points, damage uses orange, and deaths use red. Each event type is a separate series, which means its marker size and colour can be configured independently.

Two dashboard variables make the result usable:

  • Game session chooses a single playthrough.
  • Map visit chooses one continuous visit to a particular level or area within that playthrough.

The map-visit selector is populated from a Prometheus navigation metric. The stored value remains the exact visit ID, while the displayed text combines the visit number, level name, and area. That produces entries such as:

002 - Castle Grounds - 1 003 - Peach's Castle - 1 005 - Bob-omb Battlefield - 1 

Selecting one game session and one map visit keeps each journey separate. The green line is Mario's route and the yellow circles are jump events.

Figure 2. Selecting one game session and one map visit keeps each journey separate. The green line is Mario's route and the yellow circles are jump events.

Building the XY panel from separate Loki queries for position samples, jumps, and damage, with independent marker styling for each series.

Figure 3. Building the XY panel from separate Loki queries for position samples, jumps, and damage, with independent marker styling for each series.

Seeing the journey

At this point, the visualization was finally telling a story I could recognize. The shape of my journey - the turns, the backtracking, and the places where I jumped - came alive on the dashboard. I could see where I took damage and where I finally died fighting an evil mushroom. Watching the route populate in Grafana gave me a real sense of joy. It was no longer a giant list of logs asking to be interpreted; the data had become something that connected directly to what I had experienced while playing the game.

The finished Bob-omb Battlefield visualization: Mario's route in green, jumps in yellow, damage in orange, and a death marker in red.

Figure 4. The finished Bob-omb Battlefield visualization: Mario's route in green, jumps in yellow, damage in orange, and a death marker in red.

What got complicated

Position data was straightforward because the game exposes Mario's coordinates. Other events were less consistent. Native jump actions were available and gave me a reliable foundation. Some other gameplay events looked easy at first but did not have an equally dependable signal in the environment I was using.

Collecting stars looked like an obvious event to add, but I could not find a signal that was sufficiently unambiguous and repeatable. Rather than keep a fragile implementation, I eventually cut the scope back to the things that worked reliably: journeys, map visits, jumps, falls, damage, and deaths.

That was probably the most useful lesson in the project. Instrumentation is not just about finding a callback that appears to work once. The event needs to be unambiguous, repeatable, and useful after it reaches the backend.

One of the more visible problems appeared in an early coordinate plot. A long, perfectly straight line stretched across the chart, even though Mario had not travelled along that path. It appeared while moving between parts of the game and was most likely Grafana connecting position samples from opposite sides of a map transition before the journey had been divided into visits. The result looked almost like a closed loop. It was an interesting reminder that a visualization can look convincing even when the data has been grouped incorrectly. Separating the journey into map visits removed that ambiguity.

An early coordinate plot containing a straight line that Mario had not actually travelled. It appeared around a map transition, before the journey was divided into separate visits.

Figure 5. An early coordinate plot containing a straight line that Mario had not actually travelled. It appeared around a map transition, before the journey was divided into separate visits.

There were other smaller complications too:

  • Telemetry batches had to stay below the game's storage-value limit.
  • A malformed batch needed to be skipped without stopping the bridge.
  • Position sampling needed enough detail without generating excessive data.
  • Grafana needed transformations before string coordinates could become XY fields.
  • Dashboard variables had to preserve machine-readable IDs while displaying friendly labels.

None of these problems is unique to games. They are smaller versions of the same questions that appear in normal instrumentation work: What is the event? How is it identified? What context belongs with it? How much data should be collected? What happens when part of the pipeline fails?

What would be cool to try next

One idea I had was to be able to display the shape of the levels themselves.

As far as I know, SM64CoopDX can actually expose the collision surfaces that make up a level. I guess it's possible that those triangles could be extracted, projected onto the same X/Z coordinate plane, simplified, and displayed behind Mario's route. Perhaps that could reveal invisible walls or secret areas? It would be fun to see if it works, so perhaps that is an experiment for another day.

Other possible extensions include:

  • Identifying specific enemy types and plotting them as different shapes.
  • Capturing additional events, such as collecting stars.
  • Calculating the virtual distance Mario travelled.

Closing thoughts

I am not an expert in OpenTelemetry, PromQL, LogQL, or the internals of Super Mario 64. If you're a telemetry buff, there is no breaking news here. But this little puzzle helped me understand each of them a little better. It also showed me how data can tell us something meaningful about the system we are observing. Observability data does not have to come from a microservice or a Kubernetes cluster. If something can produce structured events, those events can be collected, correlated, queried, and turned into a story.

I hope you enjoyed this little thought experiment. If it helped you learn anything, even better. If you have any ideas for how I could improve it or what might be a useful addition, I'd love to know!

Last but not least, thanks to the SM64CoopDX team - most of this experiment was possible because of their work and modding API. Also, even though I played only the first two maps on repeat while getting this working, the PC port looks great. When I have the time, I hope to actually play the game :)