<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/analyzing-nethack-data-part-2-what-players-kill-the-most/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.brodrigues.co/blog/2018-11-10-nethack_analysis_part2/"> Econometrics and Free Software</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p><a rel="nofollow" href="https://www.youtube.com/watch?v=VnW2g6qbbrA" target="_blank"><br>
<img title="Wizard of Yendor battle music" src="https://i1.wp.com/www.brodrigues.co/blog/2018-11-10-nethack_analysis_part2/img/monsters.png?w=456" data-recalc-dims="1"></a></p>
</div>
<p>Link to <a rel="nofollow" href="https://www.brodrigues.co/blog/2018-11-01-nethack/" target="_blank">webscraping the data</a></p>
<p>Link to <a rel="nofollow" href="https://www.brodrigues.co/blog/2018-11-03-nethack_analysis/" target="_blank">Analysis, part 1</a></p>
<div>
<h2>Introduction</h2>
<p>This is the third blog post that deals with data from the game NetHack, and oh boy, did a lot of<br>
things happen since the last blog post! Here’s a short timeline of the events:</p>
<ul>
<li>I scraped data from <a rel="nofollow" href="https://alt.org/nethack/" target="_blank">alt.org/nethack</a> and made a package with the data available on Github<br>
(that package was too big for CRAN)</li>
<li>Then, I analyzed the data, focusing on what monsters kill the players the most, and also where<br>
players die the most</li>
<li><span>@GridSageGames</span>, developer of the roguelike Cogmind and moderator of the roguelike subreddit,<br>
posted the blog post on reddit</li>
<li>I noticed that actually, by scraping the data like I did, I only got a sample of 100 daily games</li>
<li>This point was also discussed on Reddit, and bhhak, an UnNetHack developer (UnNetHack is a fork<br>
of NetHack) suggested I used the xlogfiles instead</li>
<li>xlogfiles are log files generated by NetHack, and are also available on alt.org/nethack</li>
<li>I started scraping them, and getting a lot more data</li>
<li>I got contacted on twitter by <span>@paxed</span>, an admin of alt.org/nethack:</li>
</ul>
<blockquote class="twitter-tweet">
<p lang="en" dir="ltr">There was no need for scraping, we'll happily give out the whole database if you want.</p>
<p>— Pasi Kallinen (@paxed) <a rel="nofollow" href="https://twitter.com/paxed/status/1059333642592366593?ref_src=twsrc%5Etfw" target="_blank">November 5, 2018</a></p></blockquote>
<p></p>
<ul>
<li>He gave me access to ALL THE DATA on alt.org/nethack!</li>
<li>The admins of <a rel="nofollow" href="https://alt.org/nethack/" target="_blank">alt.org/nethack</a> will release all the data to the public!</li>
</ul>
<p>So, I will now continue with the blog post I wanted to do in the first place; focusing now on what<br>
roles players choose to play the most, and also which monsters they kill the most. BUT! Since all the data<br>
will be released to the public, my <code>{nethack}</code> package that contains data that I scraped is not<br>
that useful anymore. So I changed the nature of the package.<br>
Now the package contains some functions: a function to parse and prepare the xlogfiles from NetHack that<br>
you can download from <a rel="nofollow" href="https://alt.org/nethack/" target="_blank">alt.org/nethack</a> (or from any other public server), a function<br>
to download dumplogs such as this <a rel="nofollow" href="http://archive.is/7awsb" target="_blank">one</a>. These dumplogs contain a lot of<br>
info that I will extract in this blog post, using another function included in the <code>{nethack}</code> package.<br>
The package also contains a sample of 6000 runs from NetHack version 3.6.1.</p>
<p>You can install the package with the following command line:</p>
<pre><code>devtools::install_github(&quot;b-rodrigues/nethack&quot;)</code></pre>
</div>
<div>
<h2>The <code>{nethack}</code> package</h2>
<p>In <a rel="nofollow" href="https://www.brodrigues.co/blog/2018-11-03-nethack_analysis/" target="_blank">part 1</a> I showed what killed<br>
players the most. Here, I will focus on what monsters players kill the most.<br>
Let’s start by loading some packages:</p>
<pre><code>library(tidyverse)
library(lubridate)
library(magrittr)
library(ggridges)
library(brotools)
library(rvest)
library(nethack)</code></pre>
<p>Let’s first describe the data:</p>
<pre><code>brotools::describe(nethack) %>% 
  print(n = Inf)</code></pre>
<pre><code>## # A tibble: 23 x 17
##    variable type    nobs     mean       sd mode       min     max      q05
##    </code></pre></div>