Hero Mages

Hero Mages Community Boards => Bugs & Support => Topic started by: Scribe on December 23, 2014, 09:47:28 AM MT

Title: FFA leaderboard bug?
Post by: Scribe on December 23, 2014, 09:47:28 AM MT
Hello,

I completed game #83515 a few days ago. Being victorious, it earned me #1 spot in the FFA leaderboard, and a nice move upward in overall one.  But this game didn't go off my game list (maybe because the other players haven't checked it yet? ). It still shows "Destiny awaits". The problem is,  my scores in the leaderboards keep raising, apparently as if each time I opened the game it counted victory points again.
Could you please take a look and see what's going on?

Thanks
Title: Re: FFA leaderboard bug?
Post by: WorldChamp(ELITE) on March 31, 2015, 11:37:25 AM MT
I have the same problem..
Title: Re: FFA leaderboard bug?
Post by: Ross Przybylski on April 03, 2015, 03:50:26 AM MT
I believe I know what is causing this. For some reason, I commented out a return line in the record game method in the server code. It looks like I may have done this to fix a prior bug where game stats were not being recorded at all.

It would help to have one of you available for a live test so we can check whether my intended fix resolves the problem (this way I can also run tracers to verify the pattern I believe is causing this).

Let me know if I could get your support and when you'd be available.
Title: Re: FFA leaderboard bug?
Post by: Ross Przybylski on April 03, 2015, 06:18:07 AM MT
SUCCESS!!!

So, as it turns out, the server code was actually not causing the problem.

The issue was in the database limits for the "rating" column. I was using a tinyint instead of a smallint. The maximum range of a tinyint is +/- 128. The issue with this game was that when WorldChamp was eliminated, he lost 192 FFA rating points. This caused the database to silently fail as this value was out of the database range.

Because of this, WorldChamp's game status was never recorded, and from the server perspective, this game never got its stats recorded. Therefore, it would keep resetting flag for "not seen game ending" which is why it says "Awaiting Destiny".

Finally, because worldchamp's game record score wasn't captured, everytime the game ended, it tried to update all the records, which is why you saw WorldChamp at -9000 or so FFA points, while others were up positive in the thousands.

To fix, I did the following:
1) Increased size of rating to smallint so this won't happen again
2) I reviewed database backup for 11/14 and used this to determine that this game record had been opened and recorded 54 times!
3) I manually corrected the data by subtracting the points difference for this game times 53 (so everyone effectively only got credited once, the proper and fair amount)
4) I checked to see if anyone else had negative rating scores, and fortunately, it appears this incident was isolated to this one game.
Title: Re: FFA leaderboard bug?
Post by: WorldChamp(ELITE) on April 03, 2015, 02:33:59 PM MT
All you guys take this into consideration next time you want to eliminate WorldChamp first..  ;D Nothing good ever comes from that  :P Thank you Ross for your hard work and dedication to HeroMages, glad to see it fixed!
Title: Re: FFA leaderboard bug?
Post by: Scribe on April 10, 2015, 06:28:56 PM MT
Good job,  Ross. Thank you