Monday, October 28, 2013

Gridiron Solitaire #78: Grinding

All right, no Steam Greenlight page last week. My fail.

Instead, I've been hunting down a few obscure bugs that I'm finally squashing. Here's an example. There's a bug that occurs in roughly 1 in 250 games where the text string that compares the Human pass offense versus the CPU pass defense in the pregame broadcast is blank.

Sure, it's obscure, but it's an atmosphere killer when it happens, because it totally breaks immersion. The problem with this bug, though, is that there was absolutely no pattern. No combination of circumstances seemed to make it happen.

This is one thing about programming that is very, very difficult for me. I'm very comfortable fixing something that breaks every time. That makes sense. Trying to fix something that doesn't work 0.4% of the time is something else entirely.

I spent hours and hours on this over a three day period, first quantifying how often it happened (by setting up a loop that ran 500 trials and logged when the pass comparison string was missing), then trying to understand how this bit of code was different from the running, defense, and special teams comparison.

In the end, I fixed it by finding the difference, then doing that bit of code a different way, even though it should have made absolutely no difference whatsoever. The new way I was doing things was entirely functionally equivalent to the old way.

It did make a difference, though. I ran 2,000 trials after the change with zero occurrences of the bug, and before the change, I'd never had a clean run of even 500 trials.

This is the kind of stuff I'm doing now, the equivalent of wisdom tooth extraction (for me, at least). On the positive side, though, I don't want this to happen to an end user, and I'm happy it won't.

Fredrik continues to work on the website, and I'm working on the Greenlight page this week. 

Site Meter