Thursday, August 2, 2007

Minesweeper!

Finally! My Minesweeper game is ready for the web! It's the classic game in a web 2.0 costume. Why did I do that? when surely it's been done before. Because I like minesweeper.

Developing this game has taught me one something about the time it can take from prototype to somewhat finished product: Developing the completely playable "offline" prototype version was quick and easy - after all, I developed minesweeper already in high school on my programmable Casio calculator. So I thought it would take about trice the time to finish it, but in the end it took about ten times that time.

One reason for this is the online highscore functionality. But T-rex, online highscores just means keeping a list of the best times on the server and sending it to the client. Yes, but then it wouldn't take much to figure that all you need to do is type "register_highscore.php?time=0&name=script%20kiddie" into your browser's address field to get an instant all-time high. So how did I solve that?

The game is played simultaneously on the client (i.e. in the web browser) and on the server (in php). Sweeps are sent at regular intervals to the server, which then plays the same moves and checks the results. So in the end it's the server that decides that a game is over, how long it took, and whether that's a new highscore or not. That, ideally, is not so complicated either, but well there are lots of opportunities to make stupid mistakes. (Especially when you're having a shochu on the rocks while coding (I did it during my vacation).)

The other reason is that it's hard to make a web app behave like a nifty game. You need graphics, animations, and that kind of stuff that often causes you to run into problems with layout positioning and, most of all, browser inconsistencies. Web browsers just aren't ideal for making applications yet. (Well, tell me a platform that is, anyway...) The game runs best, as always, in Firefox. Although I admit I haven't tried IE 6 yet. I'll tackle that beast tomorrow. :) IE 7 works good, though.

I still have a number of features planned that I'll implement during the coming weeks, but at least now it's good enough to play. Try and beat my times! Here's the url again:

http://henrikfalck.com/minesweeper/

Labels: , , , ,

3 Comments:

Anonymous Anonymous said...

Love your Minesweeper game, but I've been banned (by cookie), and I have no idea why. :(

I am 'MarkF', by the way. :)

I've also observed a bug: I finished 'easy' during a low bandwidth spurt between your site and my home PC. The displayed completion time was about 0:51, but it then jumped to 0:17 and offered me a high score. I reloaded the page so as to not corrupt the high scores list.

Thanks!

Mark

Sunday, September 30, 2007 12:15:00 AM JST  
Anonymous Anonymous said...

Hi - 'MarkF' here again. I found another probable bug. I just beat 'normal' in about 1:00, but then the clock jumped to 0:00 before prompting me for a high score; my entering a name (oops - sorry) has caused the high score in 'normal' to be rather ridiculous. :(

Sunday, September 30, 2007 2:12:00 AM JST  
Blogger Henrik Falck said...

Mark, thanks a lot for your comments! I'm glad you enjoy the game. And man you're fast! I need to practice...

Based on your comments I've made the following fixes over the weekend; they're live now:

* If the end time of the client (which will always be very accurate on an unhacked client) is higher than that of the server, then the client's time is used. This will fix the first problem you mention with high-lag situations.

* The "0:00" issue I had actually fixed before but hadn't uploaded the fix to the server yet. It was simply a display issue [similar to Excel 2007 ;)], the time was 1:00 and it's correctly recorded in the database and is now displayed correctly.

* Lag between client and server is measured now, but currently the data isn't used. I'll see how accurate it seems and try to figure out if I can use that data to improve timing in high-lag situations.

* Tried to easen some over-sensitive paranoia checks for cheating and hack attempts that causes temporary bans. Probably your debugging, while very helpful, triggered one of these because the behavior might have been a bit abnormal. :)

Cheers,
hefa

Monday, October 1, 2007 9:44:00 PM JST  

Post a Comment

Links to this post:

Create a Link

<< Home