Jump to content
  • Advertisement
Sign in to follow this  
frostburn

I made a game!!

This topic is 4829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I proudly present my first complete game: Minesweeper! linky How to play: find all the mines on the board. Left-click opens the cell under the pointer, right-click toggles the flag on the cell, and double clicking opens up all cells surrounding a numbered visible cell. A corrosponing number of flags must be placed for it to try. NOTE: I have only tested it on Maxthon 1.3.3 and IE 6.0 SP2. It may not work on any other browser.
The game is made completely in HTML/javascript with some PHP for setting the size of the board and to place the cells. Currently it's set at Expert (though that may change at any time). I'm planning on adding a way of using html GET statements to select board size at load/link time. I started the project on Wedensday evening and coded and drank wine until I had to leave for the party. I continued on Thursday, and got it finished that day except for the image counters and the visual style. I took the Friday off and continued today. Total time spent on the project was probably about 15 hours. I think I may have been sober for about 3 of those [smile]. The hardest thing to code was the flood-fill algorithm used when the player clicks on a cell with no neighboring mines. I would have used a recursive algortihm, but unfortunately javascript doesn't protect it's variables. After trying to do it by storing the temporary values in an array, I gave up and made a non-recursive 4-way flood fill algorithm with edge detection to find those annoying corners that would otherwise go undetected. It works, but it's pretty slow. On my computer it takes a couple of seconds to flood fill a 30x16 board with 1 mine. In normal games such as 30x16 it's fast enough not to be noticable though. Sometimes it doesn't catch the clicks, and especially the right-clicks, but apart from that it looks and acts exactly like the Minesweeper included with Windows XP. So much in fact that I probably will have to change the graphics to avoid being sued by Microsoft for stealing thier pixels [smile]. The left+right click combo for opening all surrounding fields wasn't possible AFAIK, so I did it with a double click instead. Unlike MS Minesweeper, the number of undiscovered mines isn't visible in the counter until the player clicks. I tried to fix it, but even OnLoad tries to call the function before the ID of the DIV is set. I can fix it by "hard coding" it, but I haven't done that yet. It shouldn't take more than a few minutes, so by the time you read this I may already have fixed it. Lessons learned: javascript is very badly suited for recursive algorithms that include for-loops. Events in HMTL/javascript is not 100% accurate. It sometimes doesn't recognize all clicks. Coding while drunk isn't any harder then when sober. For me it's actually easier as I don't spend unnecessary time trying to get everything 100% perfect.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!