Ploting my Caves of Qud data

The code for the following article can be found on my Github profile. The second ipython notebook, 2 Plotting my Caves of Qud data goes into the plots and high score data in greater detail.

Caves of Qud is a rougelike RPG set in a post-apocalyptic world where mutants and robots abound. And it is very easy to die. A lot. Since purchasing the game on Steam at the start of August I have played over 60 hours of Caves of Qud resulting in many deaths. Each time a character dies the save file is wiped and the game starts over, back at level nothing with no inventory bar a bitter taste in your mouth (there are settings that allow you continue instead of restarting). On each death a very detailed entry is made on the High Scores screen including the "real world" date and time the character died, the "in game" date, how many turns were made, how many zones were visited and what the final score was.

A few days ago I went checking if there was a way of pulling down this data (instead of writing it out by hand) with the view to doing some analysis of it and found that indeed there was. The games high scores are contained on a file called HighScores.vcd (or maybe .dat) and can be found in the games directory (easiest thing to do is search CavesOfQud in file explorer). After a mammoth struggle cleaning the data I was able to build the following plots in ipython:

Click to open in new window.

The first plot is a scatter plot of the turns and scores for each game with a line fitted using sklearn. sklearn gives back an intercept of -2171 and a coefficient of 1.219. One way of looking at this is to imagine that I start the game with -2171 points and every step I take gains me 1.219 points. My final score is worth turns multiplied by 1.219, then subtract 2171. This isn’t bad as one game I quit after 19 turns gave me a score of -1351 points and the root mean square error is 1532 points. In my current save game (At the grit gate, I’ve just gotten the order to travel to Golgotha) which I’m going to get back to after I finish this I am on turn 59924 which gives me a predicted score 70905 points. Nice!

The second plot is much the same as the first but with zones visited instead of turns. The intercept here is -2433 and the coefficient is 187. The zones plots seems to match the line closer than the turns plot. My theory is that a lot of turns does not mean you have done a lot in game. In recent games on my way to the Rust Wells (an early game mission) there have been a few times when I have gone through 5 zones before hitting a wall and having to backtrack. This mean I have executed a lot of turns (most actions, such as taking a step, count as a turn) as I move through the 5 zones and then move back through them again but if I clear the zones of enemies and loot on the first leg of the journey there is no way to gain experience on the second leg. Zones are only counted the first time you enter them. Therefor the more zones visited the more enemies you have faced, the more chests found etc. There is obviously a lot more to it than just turns and zones but the more zones you visit the greater your chance to gain experience is, which would affect you score.

The third plot is a bar chart of the games, sorted by date played, with a 5 game simple moving average. Over my first 25 or so games only 4 of them have a positive score! The SMA peaks with my record score in the middle of the graph before falling with some poor games, just barely staying positive. It’s not great but is respectable at the moment, around the 4500 points mark and if there is a 70,000+ point payday coming in my next game that should greatly improve it. The 3 red bars represent patch releases. The patch on the 21st (the 15th and 21st are represented by one line as I didn’t play any games between them) bought about some changes which threw me a bit and my scores suffer for a bit before rebounding. I will always blame Ctesiphus, who was introduced in that patch.

The final graph is a histogram representing the frequency of all of my scores. Over half of them have been negative. I don’t want to talk about it.

The high score data also includes other information, looked at in more data detail here. Out of 53 games I died in 37 of them with no artefact. The most common artefacts I died holding were:

no artefact                37
Fix-It spray foam           3
semi-automatic pistol       2
acid gas grenade mk I       2

The most common enemies which killed me (more than one kill) were:
young ivory/bleeding                          10
unknown                                        8
snapjaw                                        6
salthopper                                     4
fire ant/scalding steam                        4
wizard                                         3
jilted lover                                   2
equimax                                        2

There are 8 incidences where there was no death description recorded. As in, the line in my high scores data is empty. I would be interested if anyone knows what this means. 10 kills come from bleeding, all caused by young ivorys when I used to take haemophilia as a defect. Early game, no bandages, young ivory pops up in Red Rock, game over. I now take brittle-bones as a defect and kill every young ivory that pops up while holding back tears. The entry "wizard" is for when I was hit by confusion and then taken out by lase beams by a faction leader on my way to or at Red Rock, another early game worry

There is a number of other ways to analyse the above data. Enemies could be grouped differently (there are 6 faction leaders I have died to, which would be the 3rd highest killer), I could examine weapons and create a column for ranged and melee or even melee-weapon (swords etc.) and melee-limb(claw etc.) I am most prone to dying in the month of Tuum Ut (8 deaths) but is it likely I will die early or late in the month? What were the most common causes of death in my first 30 games where I was getting to grips with Caves of Qud and what have been the most common causes since? What is dangerous regardless of how much experience I have as a player and what was only dangerous when I was stupid and running down stairs without looking? (fire-ants come to mind) My plan is to get some more data points and come back to look at these questions later.

From taking a look at my data I’ve realised that I’m not as good at the game as I thought I was. When you die all you need do is hit a few buttons, fill in a new name* and a new game starts, it takes less than 20 seconds. I didn’t realise how many low and minus scores I was raking up, even after my record score. Recently I was killed by a legendary ogre who hit 8 times for 51 damage. Ouch! Stupidity and over extension seem to be costing me. Over extension is what I call freezing a high tier creature with freezing hands and hitting it over and over again even though it doesn’t look like any damage is being done in the hopes of getting a big xp boost. Then it unfreezes and you no longer have a body. Being too brave, taking too many chances. The game forces you to do that, especially as the xp for killing creatures drops the more you level up. I killed 5 creatures in a row in my current game and scored 0 xp. Yes, bravery gets you points, but it also gets you killed. In my recent games I have found myself being a bit more cautious, not running into rooms for fear of turrets, not rushing blindly down stairs or into underground zones for fear of fire-ants and paying more attention to the items and salves I have which could save me when I’m surrounded by chute crabs.

Cleaning this data has been very tough, I would count this as the toughest project I have done since taking up data science, but it was also great fun. To see usable data appearing from a game that I have been playing, data that describes my actions and ability at this game, was really cool. I plan to come back to this project in future when I have more data points. Also, I would love to get data from other players which I could work on for a month or so. Then I would get updated data from the players at the end of this month or next, put it all together and post it here. If you play Caves of Qud and would like to help you can email your high scores .vcd or .dat file to me at Live Long and Drink.

*My naming convention started with dead Soviet leaders, then people who I have biographies of in the shelf to my direct left, then the name of the author of what I am currently reading. Courtesy of "At Swim-Two-Birds" my current character is O’Brien VI.