Geocoded highscores in Flash?
February 6, 2010 6:46 AM Subscribe
How do I make a Flash quiz with an internal high score table dividing players by country?
I want to make a geography Flash quiz of the "how well do you know other countries?" variant. The catch is, after each question there should be a stats page comparing your score with players from other countries' scores, so you can see who knows each other best.
To acheive that, I suppose the quiz needs to figure out the IP of the player, figure out the country from that, write that alongside the score in some sort of server-side file or database, and query that after each question to show how's the player doing when compared to other countries.
Is this a big security no-no? What are the implications? How to pull this off?
Background: I'm just a graphic designer studying Actionscript, so very basic answers are appreciated.
I may be way over my head here - who would be the ideal person to ask for help or include in this project? What I should study to understand the steps involved at least in theory, so I can talk to this person? What should I study in Flash so I can make my part of the deal interface smoothly with the "other side"?
I want to make a geography Flash quiz of the "how well do you know other countries?" variant. The catch is, after each question there should be a stats page comparing your score with players from other countries' scores, so you can see who knows each other best.
To acheive that, I suppose the quiz needs to figure out the IP of the player, figure out the country from that, write that alongside the score in some sort of server-side file or database, and query that after each question to show how's the player doing when compared to other countries.
Is this a big security no-no? What are the implications? How to pull this off?
Background: I'm just a graphic designer studying Actionscript, so very basic answers are appreciated.
I may be way over my head here - who would be the ideal person to ask for help or include in this project? What I should study to understand the steps involved at least in theory, so I can talk to this person? What should I study in Flash so I can make my part of the deal interface smoothly with the "other side"?
Response by poster: Sure, if all else fails, I could do that! But the point is that I want to figure stuff out! ;-)
posted by Tom-B at 7:28 AM on February 6, 2010
posted by Tom-B at 7:28 AM on February 6, 2010
Best answer: The simplest way to do this would be using PHP (or asp or whatever server side language you prefer) and an SQL database. When the user submits their score in flash, the flash calls the page and sends the variables (score, name etc).
This PHP file then grabs the variables sent to it, as well as getting the user's IP address, and does a GeoIP lookup on it. If you've put the IP records in another database, then it's a simple query to find the country from the IP address.
That will give you the country and then you can write the score record into the scores table of the database.
posted by derbs at 10:57 AM on February 6, 2010
This PHP file then grabs the variables sent to it, as well as getting the user's IP address, and does a GeoIP lookup on it. If you've put the IP records in another database, then it's a simple query to find the country from the IP address.
That will give you the country and then you can write the score record into the scores table of the database.
posted by derbs at 10:57 AM on February 6, 2010
Best answer: Hi TomB forgot to come back to answer the other couple of questions in your post.
Firstly, security. There's no security implications really in the method I outlined above. You give your IP address out every time you visit any website on the internet. It's as secret as a zip code.
Secondly, and i'm guessing you're firmly on the flash side of things here, the type of person you need to speak to is a medium to advanced level web designer/programmer, with server-side skills (PHP, ASP, Ruby, Python etc). From their perspective, all you're giving them a simple http POST, similar to when you submit your comments here on metafilter.
In terms of Flash, you should definitely read up on some Actionscript3 if you haven't already. It's the only way to make Flash do some of the amazing stuff it's capable of. Make sure you don't get into AS2 though - it's deprecated now and you'll do yourself no favours learning it.
This book has a good reputation. If you're coming from a designer's background (like myself), it will take some patience, and at times will make no sense, but stick with it. Everything will drop into place eventually!
posted by derbs at 2:46 PM on February 8, 2010
Firstly, security. There's no security implications really in the method I outlined above. You give your IP address out every time you visit any website on the internet. It's as secret as a zip code.
Secondly, and i'm guessing you're firmly on the flash side of things here, the type of person you need to speak to is a medium to advanced level web designer/programmer, with server-side skills (PHP, ASP, Ruby, Python etc). From their perspective, all you're giving them a simple http POST, similar to when you submit your comments here on metafilter.
In terms of Flash, you should definitely read up on some Actionscript3 if you haven't already. It's the only way to make Flash do some of the amazing stuff it's capable of. Make sure you don't get into AS2 though - it's deprecated now and you'll do yourself no favours learning it.
This book has a good reputation. If you're coming from a designer's background (like myself), it will take some patience, and at times will make no sense, but stick with it. Everything will drop into place eventually!
posted by derbs at 2:46 PM on February 8, 2010
This thread is closed to new comments.
posted by decathecting at 7:22 AM on February 6, 2010