I've spent the past few days doing three things:
- Studying for my HADM 430: Intro to Wines exam
- Playing Gunbound
- It's a lot cheaper than making a Flash game, which requires purchasing the very expensive Adobe Flash development software
- It's a bit nicer than making a Java applet, which no one uses these days
- For some things, it's actually a lot easier than one might realize
So I dove in. I made a game using jQuery with quite a bit of DOM manipulation and a few fade effects, as well as some Ajax requests talking to a PHP backend using a text file to store high scores. It was a big challenge at times but I was able to figure out most everything with the help of the jQuery site as well as php.net. Some things I discovered:
So putting it all together, my result is here: Tunnel. To explain, it's a very basic game where you use the mouse to move your ship left and right. As you play, the walls narrow until eventually you have about 2 widths of your ship to fly between. The game ends when you die, and your score gradually increases as long as you live. When you die, your score is checked against the top 10 and if you get a high score, you enter your name to put yourself on the list. It's not too complicated and you can check out the source to see everything that's going on at the front-end. I should mention, however, that this is my own work, so you can't steal it and put it on your own site. Plus, it has a couple bugs that I think are worth mentioning:
- The high scores are stored in a text file, and it's very important that this file is only accessed by one person at a time. If two people get a high score at the same time, the second person is just going to be locked out and might not get their score entered.
- Occassionally, mysterious things happen on the PHP side and the score table gets messed up. I put in some workarounds to try to prevent this, but if the table just happens to dissappear, it can't be helped.
- It is entirely possible to hack the high score system and enter insanely high values. There's a couple ways to do it, which I won't share here. If you have ideas, please don't try them… I know it's hackable, so there's no need to test it. As far as I know, there's no way to make it any more secure than it already is.