Impatient for stats

A long time ago, NS2 had an awesome project called NS2Stats that gathered round stats for the servers running this mod, you could go on their website and look at the stats for the rounds you had played. One of those stats was accuracy. In the competitive scene, this has always been a number every player has obsessed with, of course, since otherwise they wouldn’t be competing.

I remember playing and wondering during certain periods of the game what my final accuracy would be, especially if I was having a good round. So because I was impatient and wanted that data before the round ended, I thought about incorporating something like that to my mod, at the time still called Custom HUD.

The first iteration was fully client-based, so all the information was from what the client believed it hit, instead of what the server was seeing, but it was still good enough for the impatients like me at the time. When you died, you’d get a message in console like this:

Client-side stats

Because I was hooking into the damage function, and because of the way it works, some of the “weapons” weren’t being tracked, basically, any melee weapons wouldn’t count misses towards the stats, so most aliens would get 100% accuracy all the time. I wanted to address this, so while fixing this issue, I went for an extra step, the server-side.

But this wasn’t the server-side you might expect, I was still tracking the stats client-side, except this time it was only the misses, and hooking into the damage numbers from the server to verify the hits. So when you received a confirmed hit, I would substract a miss from the client stats. This had a very clear downside, and that is, because of latency and interp, you could shoot/attack before this information would reach the server, where you might have already been dead, so you’d get a lower accuracy than the real one. It still had its benefits, as I was now displaying stats broken down by weapons.

clientserverstats

Coincidentially, this all happened 2 weeks before the NS2WC, it was during this period of time that I added the yellow names for parasited players, a change that eventually would find its way into vanilla, the first of many. This was a time where the mod was increasing in popularity because it was required for the tournament, so it was exposed to a lot of new people. Before this, it wasn’t allowed in official competition, and it was running in very few servers. This was a time where I shifted my focus into usability and quality of life changes, which made the already growing mod to grow even more.

But back to the stats. Since it was annoying to open the console every time, I added UI code for it, and because I wasn’t very familiar with the code quite yet, it was very crude looking, as you can see.

First stats UI

This imperfect method of stats gathering would last for about 3 months, when I finally moved it entirely to the server side after being tired of dealing with inaccurate stats, so when that was done, everything was great in the world. A lot of stuff would get added to NS2+ with the stats not being changed at all, until one day I decided to make a proper round end stats UI. So here’s a brief history of its evolution through screenhots.

StatsConcept StatsUIFirstImplementation

StatsUIFirstImplementation2 StatsUIFinalFirstVersion

StatsUIFinalFirstVersion2

Since I had something better looking now, and a lot of the base work was already done, it was easier to add even more stats that people could find interesting, so the next logical step was a Tech Log, Resource Tower graph and Kill graph, things that also existed in NS2Stats, which eventually disappeared for not being able to get a powerful enough server, as you can see on the, now devoid of stats, website.

TechLog2 TechLogRT

The endgame stats UI went from 187 lines of code to the current 2839. And the stats tracking, from 95 to 1717.

A lot of the features that exist in NS2+, and the mod itself, exist purely because I wanted something for myself, usually something small and easy to do, and it ended snowballing into bigger and bigger things as the potential became clear when using it, and also through what people told me they wanted to see. You build something small, and that gets the ball rolling, since you already have a base for further improvements. It’s daunting to overcome the “blank canvas syndrome”, having to start something from scratch can be overwhelming sometimes, so once you do it, things can end up going very fast, focusing on small targets does definitely help. Publishing as often as I did made me receive a lot of feedback and ideas that guided the path the mod and its features would take. Seeing people excited about features I was working on actually made me more excited about working on them, so progress ended up being faster a lot of the time.

People that have modded NS2 know how bad it is to do UI code for the game, so while the process was kind of painful, I am very glad I went through the effort of doing this. I remember that my original goal was simply to know my accuracy before the game ended and I could check NS2Stats, so when I think about the whole process, I find it a bit surprising, but I’m very happy with how it turned out.