Author

Colin is a data analyst, currently working in Whitehorse, Yukon.

Showing blog posts written by: Colin Luoma

A Brand New Blog



What's the first thing you think when you learn about server-side-scripting and CGI for the first time? Obviously it's take your blog off of Blogger and rewrite your own platform... in C. At least that was my first thought. Luckily there are plenty of online resources to get started. This introduction is particularly helpful and definitely worth reading if you're at all interested in the subject.

Anyways, I've now parted ways with Blogger and have moved my personal blog to an Amazon EC2 server running Ubuntu with Apache2 and my own CGI scripts.

To create my blog I broke it down to some basic elements that I wanted to include: a page to view posts, an info/contact page, a page to add/edit/delete posts, and a database to store everything. For a database I went with SQLite because of how modular the database data is. Since it's all stored in a single file it's easy to copy/backup etc. Once that was set up, each page basically becomes a pretty front-end for database queries. And to make it pretty I decided to make use of Twitter's Bootstrap CSS styling because it takes very little effort to create an appealing looking layout that handles screen of all sizes. Which means that it looks nice on mobile and desktop screens.

I'm fairly happy with how everything turned out. Though there are some features missing that I would like to implement in the future such as a post timeline and a way to directly link to single posts. I think having direct links is important for sharing posts.

All the code has been uploaded to my Github. Since a lot of the HTML was hard-coded into the source (instead of dynamically loaded from files) it serves mostly as a reference for how to do this type of project.

Tags:


Why Assault in Halo 5 Needs to Change

Assault, a game-mode in Halo 5, creates boring, drawn-out games where even the smallest mistake by either side heavily swings the match in the others favor. This is not an interesting game dynamic and at the very least assault needs to be tweaked or, in my opinion, removed entirely from Team Arena. This is just my anecdotal opinion based on my games so far so lets grab some data from 343i's API to see if this really is the case.

I gathered a random sample of 1236 CTF and Assault games (472 assault, 764 ctf) and analyzed their duration and victory conditions.

Game Duration:

At 12 minutes the standard game time runs out. If at 12 minutes one team has more points than the other then the game ends and the team with more points is the victor. If there is a tie when the timer runs then overtime begins and the same check is done at the end of overtime. From the chart above it's quite clear that Assault games are much more likely than CTF to either end due to the timer running out or in overtime. This is indicative of low-scoring games where neither team is able to reach the required 3 points to win.

Victory Conditions:

The red group in this chart indicates the percentage of games that ended due to a 3-cap (a team managing to score 3 points) before the initial timer runs out. The blue region shows the percentage of games that ended from a time-out (one team being ahead at 12 minutes) or a victory in overtime (one team being ahead after overtime or reaching 3 points in overtime). So nearly 25% more Assault games than CTF games end from the timer or in overtime.

I don't have a problem intrinsically with the fact that Assault often produces long games, if the objective was an interesting one. The singular objective in Assault of 1 ball and 1 cap location produces games where decision making means less than in other game types. Since there is no question about what you should be doing at any one time it takes away decisions from the player.

My other main issue is the variability. Under normal gameplay it's very difficult to cap the ball in Assault, as I have shown here with their abnormally long games. However, a single lucky kill (or unlucky death) can easily swing the game in the your favor (or your opponent favor). It's a mechanic that isn't satisfying because it feels like you're playing for that lucky kill instead of making smart decisions throughout the match.


Tags:


Halo 5 February Season Ranks

Inspired by a post on the Halo subreddit showing player rankings in different multiplayer playlists in Halo 5 I decided to do something similar. I used the Halo 5 API R package I wrote a few months ago got to work collecting as much data as I could from users.

The public API has several limiting factors. First is that there's no easy way to simply get a large list of users currently playing Halo. Microsoft doesn't make public player activity numbers public so having easy access to this would probably be against their intention. To get around this I looked at my recent game history, and took all the names of the players of my opponents. Then looked at all their recent game histories. Quickly I was able to get a list of a little over 17,000 unique names that played at least some form of matchmaking.

The second limiting factor is that Microsoft only allows 1 request per second. This isn't really a huge hurdle as I just left it running overnight to gather the data. It would be nicer if there was a faster option though.

Anyways here are some results from the Team Arena, Slayer, and SWAT playlists. Keep in mind that when this data was gathered it had only been about 10 days since the February season went live. I'll try to do something like this again at the end of the month to see if there are any major changes.

Team Arena:



From what I've heard of 343i's Halo ranking system a near normal curve like this is to be expected. With gold and platinum ranks containing the majority of players. There are some spikes at tier 1 of each rank. This is due to the fact that in Halo 5 you cannot rank down out of a division until the next season. So if players are improperly placed into diamond or go on a hot streak and make it into diamond, they'll just end up sitting at diamond 1 most of the season. With how quick the seasons in Halo are (historically slightly over a month for pre-season and January) I don't think this is that bad of an issue, as it does relieve a little bit of 'ladder anxiety' from the matchmaking knowing that you won't rank out of a division if you go on a losing streak.

Another interesting thing is the large percentage of players currently in onyx. I think this is likely due to my small-ish sample size of just over 7000 players for Team Arena, and because it's still early in the season. As the season goes on the more casual players will finish their placement matches and the relative amount of onyx players will probably decrease.

I've also included a boxplot showing win rates of players in the different ranks. Nothing really surprising; as players rank increases so does their win rate. Though from my understanding the matchmaking system should try and give players a close to 50% win rate, so again, perhaps this will even out as the season progresses.

Slayer:



Nothing too different in the slayer playlist other than it seems skewed towards higher ranks. I'm actually a little lost as to why this is. My best guess is that players who play Slayer might be more competitive than those that play Team Arena and combined with it being early in the season it's likely to produce these results. But again, I don't really know for sure. Maybe you have some suggestions?

SWAT:



Compared with the other two playlist there is hardly anybody in SWAT above platinum. From what I've heard 343i have done some tuning for ranks in SWAT which is probably why it looks so different than the others.

Well I hope you enjoyed these. Comments and suggestions on what other kinds of data from Halo 5 might be interesting are definitely welcome. What I really want to do is make some heatmaps (still) but 343i seems like they do not want to make the necessary data to do this available. Maybe soon... hopefully.

Tags:


Halo 5 API: Profile Viewer



Instead of playing Halo, I've been having fun with 343's public Halo 5 API. There's a remarkable amount of information that you are able to pull from them; I'm quite surprised.

This is my first time doing anything like this so, since I'm already familiar with it, I used R and Shiny to throw together a little dashboard to let you view basic arena statistics. I might add more functionality but probably nothing serious unless it gets crazy popular for some reason. More importantly, to go along with the Shiny app, I'm working on a nice R package to allow others easy access to 343's generous amount of game data. Hopefully I'll be able to finish it up with a couple weeks and get it uploaded to CRAN or github at the very least.

I was really hoping I could do a heatmap of where most deaths occur in each level. Kind of like was Bungie did for Halo 2. Unfortunately I didn't see any of that data available through the API but maybe in the future.

Check out the Shiny app and code to come!

R package to access the API is now up on my github!

Tags:


I2C and the ADXL345 on Raspberry Pi

Still mucking around with the Raspberry Pi, I wanted to dip my toes into using the I2C bus to interface with sensors. The sensor I'm going to use to demonstrate here is the ADXL345 accelerometer from Analog Devices. It actually supports I2C or SPI but the RPi only allows 1 SPI device so I wanted to use I2C instead.

To enable I2C on the Raspberry Pi I followed this tutorial.

Hooking up the sensor is simple enough. Power (3.3v), ground, and the two I2C connections: SDA (data) and SCL (clock). However in addition to these 4 connections the sensor needs 2 additional connections. The pin labeled CS goes to power (3.3v) and the pin labeled SDO goes to ground. This is needed to put the sensor into I2C mode instead of SPI.



Now comes the fun part, interfacing with the sensor. For this we will refer to data sheet available here. Looking at the register chart, there are a few things we need to set up before we can actually get data from the sensor.

First we enable i2c; set the address of the sensor, the ADXL345 has address 0x53; and set the clock divider, 2500 gives use a clock frequency of 100kHz which is standard for I2C.

Next we need to write to the POWER_CTL register located at 0x2D. We write 0x08 to it which enables the measurment mode on the ADXL345. Disabling the measurment bit would put the sensor into standby mode. Standby mode powers up the sensor but won't take measurements. This would be useful in a situation where power conservation was an issue.

Finally we must tell the sensor what type of data we want. Writing 0x0B to the DATA_FORMAT register located at 0x31 means we want to use the full resolution of 13-bits with a g range of +/-16g. There are several different ranges to choose from (2, 4, 8, 16) but choosing anything else limits the number of bits to 10 instead of 13. And more bits is always better.

Check out the register descriptions in the data sheet and you will get a much better understanding of what I just described above.

Now that all the initialization is out of the way it's time to actually get from readings from the sensor. The readings are stored in 6 bytes starting at 0x32. There are 2 bytes for each axis. It looks something like this:
DATAX0 - DATAX1 - DATAY0 - DATAY1 - DATAZ0 - DATAZ1
Where DATAx0 has the least significant bits and DATAx1 has the most significant bits. It's important to do a single read of all the registers to minimize any change in the data that might happen between reads.

So combine the bytes and we've got a result from the sensor. Since we're using full resolution mode we will get a range of -4096 to 4095 for each axis and dividing the result by 256 gives the G value. If the sensor is lying flat on a table it should read 1G in the z-axis due to gravity.

And that's pretty much it. Now you can interface with I2C devices from your Raspberry Pi! I wrote a simple program with will flash an LED whenever there is more than a G in either X-axis direction that I hope illustrates what I've explained here.

http://notez.ca/downloads/accel.c
(I've since stopped paying for a server so the file is no longer available. Email me if you are interested to see the code)

Tags: