Knuckle Cracker

Knuckle Cracker => Support => Topic started by: UpperKEES on June 25, 2010, 08:21:04 PM

Title: Average map completion time incorrect
Post by: UpperKEES on June 25, 2010, 08:21:04 PM
The displayed average map completion time on the custom map page (http://knucklecracker.com/creeperworld/viewmaps.php) is calculated incorrectly.

For instance for my latest map NJ-21: The Diver (http://knucklecracker.com/creeperworld/mapcomments.php?id=2426) the following data is currently displayed:

Best Time: 12 min 49 sec
Avg Time: 30 min 7 sec
Scores: 2


The score table displays:

1   UpperKEES    8238   12 min 49 sec   1
2   Luke         5077   58 min 10 sec   1


So the average time should be 70 min 59 sec / 2 = 35 min 30 sec (rounded up)

I think the average time is being calculated from the average score, which is not correct because the time-score function is not linear.
Title: Re: Average map completion time incorrect
Post by: Echo51 on June 26, 2010, 07:18:21 AM
Calculated it myself, and your right, it was indeed off by some seconds.

but is it really that bad?
Title: Re: Average map completion time incorrect
Post by: UpperKEES on June 26, 2010, 07:22:31 AM
Some seconds?  ??? The average in this case is 35 min 30 sec, while it displays 30 min 7 sec. That's a difference of 5 min 23 sec....

The larger the variation between the scores, the larger the error in this calculation will be.
Title: Re: Average map completion time incorrect
Post by: mthw2vc on June 26, 2010, 09:46:38 AM
Yes, I had noticed this error some time ago in some other maps when I first began to fiddle with roccologic's score weighting formula. I personally prefer it this way, though, as outliers do not count as much as they normally would, preventing people who leave it running overnight from throwing the average time through the roof in maps without many scores.
Title: Re: Average map completion time incorrect
Post by: knucracker on June 26, 2010, 09:56:23 AM
Yep.... sure enough UpperKEES is on the money.  I goofed up on this one.  I have a php function that returns a min time for a given map.  It queries for the score and then converts that score into a time.  Works fine by itself.  Then I thought I'd save a few keystrokes and just add a second argument to the function.  The second argument would be the sql function.  So for the quickest time I pass in "min".  For the average time I pass in "avg".

Of course this calculates the average score... which then gets transmuted into a time.  Not the same thing as the average time.

So I can fix this and make it a strict average time.  Or, I could leave it but I have not idea what to call it.  It's "average score represented as time" as is. 
Title: Re: Average map completion time incorrect
Post by: mthw2vc on June 26, 2010, 10:32:20 AM
You could put an asterisk in there to explain that this is not technically the average time.
Title: Re: Average map completion time incorrect
Post by: UpperKEES on June 26, 2010, 11:03:05 AM
I guess nobody will sleep less or play less maps because of it, so do whatever you like.

I think I prefer the final CW patch with real bug fixes if you had to make that choice.
Title: Re: Average map completion time incorrect
Post by: knucracker on June 26, 2010, 07:00:05 PM
Ok, it's fixed now.  Only took about 5 minutes....
Title: Re: Average map completion time incorrect
Post by: UpperKEES on June 26, 2010, 07:18:40 PM
Thanks! :)

I noticed it immediately in Roccologic's Map Info Viewer (http://knucklecracker.com/forums/index.php?topic=2707.0), because every map was listed as 'changed'. Now let's hope people won't avoid certain maps because they seem to take 5 minutes longer....