<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mateusriff</title>
    <description>The latest articles on DEV Community by mateusriff (@mateusriff).</description>
    <link>https://dev.to/mateusriff</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1229778%2F7fe21537-c369-4216-a919-d88c2f62b842.png</url>
      <title>DEV Community: mateusriff</title>
      <link>https://dev.to/mateusriff</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mateusriff"/>
    <language>en</language>
    <item>
      <title>Mining Data Out of Minecraft</title>
      <dc:creator>mateusriff</dc:creator>
      <pubDate>Wed, 27 Aug 2025 03:07:58 +0000</pubDate>
      <link>https://dev.to/mateusriff/mining-data-out-of-minecraft-541f</link>
      <guid>https://dev.to/mateusriff/mining-data-out-of-minecraft-541f</guid>
      <description>&lt;p&gt;&lt;em&gt;Can Minecraft serve as a powerful platform to generate useful data?&lt;/em&gt; This is the question I've been occasionally pondering for the past few months. I've been tapping into the player's in-game inventories and actions, logging them to databases and exploring the resulting data. I'm particularly interested in getting a feel for the economy of a Minecraft world from said data. The results I've been getting are quite interesting and I'd like to share them here, along with my methods.&lt;/p&gt;

&lt;p&gt;On my latest experiment, I logged the player's experience gains along with some metadata to a time-series database during a gameplay session. I later queried the database and plotted the data to make some interesting visualizations and get my point across.&lt;/p&gt;

&lt;p&gt;The rationale behind logging experience gains comes from a hunch I had, that experience points might serve as a proxy for in-game economic activity. After all, whenever a player mines coal, smelts iron ore into ingots, fights mobs, etc., they gain experience — and these are all economic activities in essence.&lt;/p&gt;

&lt;p&gt;I did this using a Minecraft plugin I built myself for a &lt;a href="https://docs.papermc.io/" rel="noopener noreferrer"&gt;Paper&lt;/a&gt; server running on my local machine. The plugin itself is quite simple, consisting of three basic components: (1) an event listener, which listens to an event triggered whenever the player's experience points change; (2) a cache where player experience gains are temporarily stored; and (3) a database client that flushes the cache to InfluxDB every 60 seconds. I went with a time-series database because the data I was working with was fundamentally time-bound. You can check out the plugin's full code, along with the InfluxDB compose file, &lt;a href="https://github.com/mateusriff/MinecraftExpTracker" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, what were my results after playing by myself on my local server for a about 1 hour and 30 minutes? Below, you can see the first plot I made, showing cumulative experience gain over time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewk57bjzw2e9oq7msv4q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewk57bjzw2e9oq7msv4q.png" alt="Cumulative experience gains over time" width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, gains happened in bursts and were followed by periods of little-to-no gains. This correlates with my activity during the session: the bursts happened whenever I mined, fought off mobs, and smelt materials for the home I was building. The occasional freezes in experience gains happened when I was exploring or actually building the house itself once I had the materials.&lt;/p&gt;

&lt;p&gt;Remember the metadata I said I saved along with the experience gains? It included the chunk where the player was when those gains happened. Below, use your imagination to picture a top-down view of a Minecraft world underneath the grid formed by the heatmap. Each square on the grid represents a chunk of the game's world. The lighter the color, the most experience gains happened there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4cqmcc4cs099iicqvjb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4cqmcc4cs099iicqvjb.png" alt="Experience gains per chunk" width="800" height="571"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As expected, the chunk where the most activity happened was the chunk where I was building my home and constantly smelting materials, with a total of 49 experience points gained on it. You can see some activity too in the lower left quadrant of the grid, where there were some caves I mined.&lt;/p&gt;

&lt;p&gt;If we add time as another dimension to the heatmap above, we can actually see when gains happened in each chunk as a function of time!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lqiibs8eym4cgtlrhzl.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lqiibs8eym4cgtlrhzl.gif" alt="Experience gains per chunk as a function of time" width="1400" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There's a story being told there. I started in the lower left quadrant, mining. Then, moved to the upper right quadrant, where I decided to build my home. I moved back and forth between my home and the mines as I needed more materials to build it. &lt;/p&gt;

&lt;p&gt;I can only imagine how cool it would be to collect this sort of data on a server with dozens or even hundreds of players. That's definitely on my to-do list! But before, I want to implement a slighty different approach, from which I believe I could mine data to answer even more interesting questions and tell more detailed stories — follow me if you want to see what's coming up next.&lt;/p&gt;

&lt;p&gt;Although it's in-game economics I'm interested at, approaches like this can be used to mine data out of Minecraft for all sorts of purposes. With Minecraft being an easily extensible sandbox game, our imagination is the limit here! &lt;/p&gt;

</description>
      <category>datascience</category>
      <category>gamedev</category>
      <category>java</category>
    </item>
    <item>
      <title>How to (Over)Engineer a Simple Static Website</title>
      <dc:creator>mateusriff</dc:creator>
      <pubDate>Tue, 24 Dec 2024 14:46:41 +0000</pubDate>
      <link>https://dev.to/mateusriff/how-to-overengineer-a-simple-static-website-4f6m</link>
      <guid>https://dev.to/mateusriff/how-to-overengineer-a-simple-static-website-4f6m</guid>
      <description>&lt;p&gt;Just over a year ago, I was tasked with developing a new website for one of my college’s R&amp;amp;D groups. Their old website was built on top of a jQuery template and generally hard to maintain. Having built user interfaces for about a year up to that point, I thought I had what it took to engineer a better website… I was wrong!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2uvbch36xm9t32teejxy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2uvbch36xm9t32teejxy.png" alt="XKCD Issue 974" width="550" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;a href="https://xkcd.com/974/" rel="noopener noreferrer"&gt;
XKCD 974: The General Problem
&lt;/a&gt;




&lt;p&gt;The projects I had worked on prior to that all used React.js, some with and some without Next.js. As they say, “if all you have is a hammer, everything looks like a nail.” And so I chose these technologies to build a simple static website.&lt;/p&gt;

&lt;p&gt;In hindsight, from the get-go it was obvious this could not end well. React.js is kinda awesome, actually, if you want to build highly interactive, dynamic user interfaces with data-driven content. Next.js is a fine accompanying framework that offers server-side rendering, routing and helps optimize performance (among many other things). However, the website I built was static, meaning it wouldn’t benefit from most of these features. Sure, it could be built with React.js and Next.js — and it was —, but at what cost?&lt;/p&gt;

&lt;p&gt;The aforementioned tools are rather complex. To build websites with them, you need to know their ins and outs. You can’t just write markup and styles and call it a day, as those need to be written inside React’s paradigm of functional components and hooks, adhering to a component-based architecture and handling data flow through props and contexts… That’s all to say you’ll be writing more lines of code.&lt;/p&gt;

&lt;p&gt;That’s not a problem by itself, of course. Your project’s requirements might be impossible to meet with just markup and styles, and you might waste time reinventing the wheel writing your own JavaScript code instead of using an off-the-shelf solution. But if the requirements can be met without this additional complexity, it’s wise to do so. Otherwise, you’ll overengineer and end up with a project that is much harder (and costly) to maintain than it should be.&lt;/p&gt;

&lt;p&gt;This is how we’ve come full circle with the website. The old one had to be replaced because it was difficult to maintain. The new one now finds itself in the same — actually, in a worse 🤫— situation thanks to the brilliance of a young software engineer with limited repertoire. I guess we need a new new website now! I plan on throwing the current codebase away and rebuilding it with as little as possible aside from HTML and CSS. Perhaps I’ll consider a static website generator.&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>softwaredevelopment</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
