Project: Simon Says Game v2.0
Technologies: PHP, AJAX, mySQL Database
Cost: Not for Sale (yet)
Here’s a cute little Simon Says game I built for fun to learn more about AJAX. Click the New Game button to start playing. I’ll give vivid details on how I built this game below. Email me if you beat my score!
This version of PHP Simon Says was really fun to create. Here’s the basics of how the game works. The game loads and creates the gameboard – a series of 3 by 3 squares. Each image is actually two images – where one image is flat color and its counterpart has the black faded border. I use a mouseover call to make the tiles swap when the mouse hits them.
The New Game button, or clicking any tile if you’re not logged in, prompts the login div to appear. The login div asks the user for their name and password. We collect name and password for the hi-score section, and so the player can come back again and again to try to beat their best score.
All scores are held in the mySQL database, along with the user’s name and password. A note about passwords, it’s good practice to use PHP’s md5 function to encrypt passwords. Currently I’m not because this is a just a fun game, but when I develop for commercial purposes – I always encrypt.
The banner rotation is controlled by my PHP AJAX Banner Rotator project, using URLs. So the banner images are clickable, and rotate every 30 seconds or so.
I’ve been working on this game for almost 9 months, just poking at it when I have nothing else to work on. Recently I added sounds to the game, for mousing over the image, level changes, game over, start game etc. I have them turned off at the moment.
I’ve also added some random text that appears after each level. The text is funny little comments, or meant to ‘razz’ the player as they move up levels.
Another good practice when developing applications in PHP and AJAX, is to cross-browser test your applications. At the moment, I haven’t fully tested Simon Says v2.0 in Internet Explorer. I develop primarily in FireFox because it has some great development add-ons. If you find any bugs, please report them to me.
As for security, I haven’t implemented any value stuffing or game hacking for this fun little game. Usually I would check all requests to verify they’re coming from the server. It would be easy enough to stuff some values into the database and hack yourself a nice high score. Send me an email if you can figure out how to hack yourself a insane score
Please enjoy my game, and have fun!
Known Issues List:
- when the computer selects the same tile twice in a row – it’s hard to tell that it was selected twice. If the tile is ‘lit’ for more then 2 seconds, it’s been selected twice in a row
- tile images don’t preload – so they hover white on the first time you touch them


August 22nd, 2009
Custom-Coding 
Posted in 










