Creating a High Score Table


Everyone wants prove they are "the best of the best", and what better way to prove it than getting your name into the halls of fame. A high score table will allow others to pit their wits against each other, while also giving an incentive to play again.

For this tutorial, you will need:

  • Access to a mysql database
  • Able to run php code on your server

Although the code examples will be using php / mysql / flash, the techniques will work using (for example) SQL Server / ASP / C++.



We will be using a mysql database to hold the scores, and php to add / retrieve the data. Flash will fetch the php pages in the same way a web browser does; this is not ideal, because anyone with a browser and knowledge of how the php pages work could abuse your system and post ridiculously high scores, so I wouldn't advocate using this method if security is a major issue for you. So, don't use this method if you plan on giving anyway a luxury cruise for the top score of the month! Having said that, there are ways to build in security to the scripts (using checksums) that would make the effort involved for the casual hacker really not worth the effort.

These are the steps involved:

  • Creating the database
  • php scripts to add / read high scores
  • Flash code to call php scripts

Next...Creating the database






( categories: )