Archive for February, 2008

Widgety

Thursday, February 21st, 2008

I made a widget that can be placed on your own site if, for some reason, you wish to display your profile(s) somewhere. This only works for 4fite ‘members’ (your profile is activated for regular updates).

Example:

Read the rest of this entry (link below) to see the HTML code.

(more…)

Player Search - Improved

Friday, February 15th, 2008

I’ve written a search that runs independently of the database. I can’t pin it down exactly, it’s either the hosting company’s servers or MySQL itself (or even PHP’s interface to MySQL), but a ” LIKE ‘%whatever%’ ” sometimes draws out to 60+ seconds when checking approximately 40,000 records.

All I know, for now, is that my flat-file index of player names is searched in under 1 second. Not fast by any means, or optimised at all, but this is opposed to a search for the same term direct on the database using phpMyAdmin resulting in a 112 second wait.

My indexes are fine. The same query on my Windows desktop’s MySQL server runs under 300ms, with a database exported from 4fite.com and imported untouched.

According to the MySQL documentation, any LIKE comparison where the argument starts with a wildcard character “does not use indexes”, so that could be the killer, but when I run the same query on my development server there’s no sign of any troubles.

As they are intended to index structured sentences with real words, using FULL TEXT solutions was out of the question. Player names certainly do not fit that profile, and a simply substring search is all that’s needed.

Unfortunately I’m fairly new to debugging a MySQL process in a remote / shared / high volume environment, so I’ll have to do some digging around to find some answers. For now though, my workaround will suffice.

Play Time

Tuesday, February 5th, 2008

Observation of the over-time figures I added in recently shows a discrepancy between the per-class and ‘past 2 weeks’ hours figures that are displayed on the Steam site. I tested this with my own profile.

I was at zero hours for the ‘past 2 weeks’ figure. I then played for a while, over a couple of days. My ‘past 2 weeks’ figure now says 3.6 hours, but there was only a 2 hour difference in my summed per-class figures.

There are two explanations I can think of for this.

First is that the ‘past 2 weeks’ figure takes into account time that isn’t spent in a real game (with both a team and class selected). I mention this because I would have spent at least a half-hour running around testing stuff out on my new PC on a local listen server. That, plus other misc times spectating or joining teams.

Second, and more likely, is simply due to rounding of numbers. If you take a fresh account, and you play each one of the nine classes for 0.09 hours (just over 5 minutes), then your time for each class will most likely be 0.0 (assuming Valve round the hours down) but your time played in the ‘past 2 weeks’ would show as 0.8, because Valve have access to the finer-precision numbers, compared to the ones I scrape from steamcommunity.com.

Neither theory accounts for the 1.6 hour difference on its own. So, without further pondering, I can only assume it’s a combination of both.

In conclusion - if you notice a difference between your ‘past 2 weeks’ figure on the steam site, and the two week figure on 4fite (when it’s available), it’s not a bug as far as I know. They may just be counting different things.