Friday, October 12, 2007

Inside Buff and Recharge Timers

The timers in HeroStats are a source of many questions. Often the issue is missing timers, but there are lots of interesting things about timers beyond just making them show up. In this post I'll talk a bit about how the timers work. (By the way, if you're missing timers, the problem is almost always related to missing chat channels on your in-game setup. See the Known Issue in the Release Notes about this problem.)

HeroStats shows two types of timers - Buff timers and Recharge timers. Buff timers count down how long a particular buff (or in some cases debuff) will be effective. Probably the most commonly used buff timer is Hasten - it lasts for 120 seconds from the time you activate it. Recharge timers count down how long until a particular power is recharged. Just about every power will show a recharge timer, with the exceptions being powers that recharge instantly (i.e. Sprint).

All timers share some features that make it easier to keep track of them. When a timer drops below 30 seconds, it'll change color to yellow. Under 5 seconds, it'll turn red. This makes it easier to see at a glance which powers are about to recharge, or which buffs are about to run out.

Buff timers always start at the same value. No matter what else is happening to your character, the buff length is constant - Dull Pain will always last 120 seconds, for example. These timers are activated when a combat log message is received showing that the buff started. For instance,
when a Force Field character casts Deflection Shield on you, a message like this appears in your combat log:

{PlayerName} protects you from Smashing, Lethal and Melee attacks with a Deflection Shield and grants you some resistance to Toxic damage.
That message triggers HeroStats to start the buff timer. It will continue to count down until the buff expires. Assuming you don't suffer any major server lag (or zoning times), the buff timer should reach zero and disappear at the same time that the buff runs out.

There are several types of buff timers. Self buffs are powers that work on yourself (i.e. Hasten, Dull Pain). AoE buffs are powers that work on you and those around you (i.e. Recovery Aura, Group Invisibility). Target buffs are powers that work on whatever you have targeted (i.e. Speed Boost, Fortitude). The type of buff determines how the buffs are categorized in the HeroStats in-game window. For an AoE buff that you cast, you may see something like "{YourName} -> Group", while a Target buff that you cast will look more like "{YourName} -> {TargetName}".

Buff timers are also used for a few special cases. Inspirations can be shown as buffs, so that you can see how long you have before they wear off. You need to enable the "Show Inspirations as Buffs" setting in the Hero Configuration options (In-Game tab) for this to work. Also, some "pet" powers show as a self-buff, so you can see when those pets will expire. Examples of this include the Warshade Extracted Essence pet, Quicksand, Tar Patch, and similar powers. And finally, some environment effects are shown as buffs - for instance, the buffs and debuffs from exploding Lab Equipment on the tech-lab maps have timers.

Buff timers are configured by the HeroStats developers. I won't get into the details here, but if you're interested, the ChatMessageRegexs.dat file in your HeroStats directory contains some documentation on how it works.

Recharge timers show an estimated time until a power is recharged. Note the word "estimated". Because so many things can affect recharge - enhancements, outside buffs, enemy debuffs - there is no good way for HeroStats to know the exact time until the power will be recharged. It can, however, make a pretty good guess based on the last recharge time of that same power. That's the number you see in the recharge timer - the time it took for that power to recharge after the last time you used it.

How does HeroStats know that last recharge time? Each time you activate a power, the combat log contains a message. The activation message usually looks something like this:

You activated the {PowerName} power.

When a power recharges, another message is logged, looking something like this:

{PowerName} is recharged.

HeroStats keeps track of the time between these two messages - that's the recharge time of the power. Internally, HeroStats keeps a table of every power you've used in the current session and the recharge time for each. Whenever one of those activation messages is received, it looks up the power name in that table and displays a recharge timer.

Example: Let's say you use Hasten, and it takes 180 seconds (3 minutes) for it to recharge. The next time you use Hasten, HeroStats will display a 180 second recharge time. But then let's say you team with a Kinetic character and they Speed Boost you. Now Hasten recharges in 150 seconds. The current timer won't change - it'll still be counting down that 180 seconds. But the next time Hasten is used, the timer will be 150 seconds.

You may already have noticed the hole in this logic - what about the first time you use a power? There's no "last recharge time" on the first use - the power won't show up in that internal table I mentioned above. For this reason, HeroStats will not display a recharge timer for the first use of a power during a given play session. This is a commonly asked question, so I wanted to highlight it. You should see a recharge timer on your second use of any given power. This can be a bit confusing, especially on long-recharge powers like Unstoppable or Power Surge.

Monday, October 8, 2007

Is HeroStats accurate?

In my semi-regular browsing of the official forums for HeroStats questions, I came across a discussion about whether HeroStats tracking is really accurately recording what's actually going on in the game. I want to clear up some misconceptions that I've seen in some of the posts. First of all, the many people that have pointed out that the data recorded by HeroStats is not 100% accurate are absolutely correct. Leaving aside the philosophical discussion on whether any non-finite activity can be 100% accurate, I can point out that there are three main reasons for inaccuracies:

1. There are some powers that do not have combat log messages reflecting the actual behavior of the powers. I've documented these to the best of my knowledge on the Power Notes page of the HeroStats website. If anyone sees something incorrect or missing in that list, by all means report it.

2. The way HeroStats receives its information is passive - the scanning engine has read-only access to the information available to the game client, specifically the combat log. Because of this, HeroStats has no control over what is being done by the game client. This was a conscious design decision to avoid any possibility that HeroStats could directly influence gameplay (which is a EULA violation). What this means is that the game client could change the information being read in the middle of the scanner processing. When this happens, it's possible to miss information. I've got safeguards in place to minimize this, so it's rare, but it can happen and nothing short of violating the EULA by modifying the game client will prevent it. It's worth noting that this behavior is very dependent on the performance of your machine - fast machines with lots of RAM will see very few missed messages, while slower/older machines may see more.

3. We who work with HeroStats are only human. (Really.) We can and do make mistakes. Fortunately we have lots of people who are very willing to point these out to us, and whenever possible we fix the problems ASAP. In the cases where we can't fix something, we document it in either the Power Notes or Known Issues.

Having said all that - I believe HeroStats is a useful statistical tool, even without 100% accuracy. I can't give you any kind of numerical value representing how accurate it is for you, because that will vary based on the performance of your own particular setup (#2 above) and the combat log messages available for your powersets (#1 above). But I firmly believe that HeroStats captures the vast majority of information available in CoX correctly, and those tests that I've run on my own setup have confirmed that to my satisfaction. (Specifically, I tested my Fire tanker running Blazing Aura against several mobs and counted the ticks. This is the worst-case scenario for HeroStats, with multiple identical combat log messages being processed at once. Over 98% of the 2000+ ticks were properly recorded. In the vast majority of real play situations, the percentage of missed messages should be much lower, since we can do some error correction when the messages aren't identical.)

If you choose to believe that HeroStats isn't doing a good job of capturing statistics, that's your prerogative. But please, don't knock those that do use it unless you're willing to show some proof that it fails in a particular way. And by all means, report those issues that you do find, so we can correct them!

Announcing: HeroStats Blogging

"HeroStats is an Open Source statistical analyzer for the game City of Heroes. It runs alongside City of Heroes and collects information about how well your hero is performing."

That's a quote from the official HeroStats website. We've already got the website, mailing lists, and the occasional post on the official CoH forums, so why a blog?

Well, for starters, I thought it would be cool. But beyond that, I've been thinking that there should be a better way to communicate some of the information behind how HeroStats works, something that won't be purged regularly (which the official forums are), can be referenced easily (unlike emails), and that allows comments from the public (unlike the official site). Thus, a blog.

I've got some ideas for the first few posts, so you'll see some updates fairly quickly - I've already got the first one ready, adapted from a post I made on the official forums. After that, updates will depend on my level of motivation and what people want to know. If you've got things you'd like to see more information on, post 'em here, and I'll take a look for future posting.