I created a minesweeper game on a webpage!

Steamz and moar.
User avatar
cHeal
 
Posts: 2294
Joined: Sat Jul 16, 2005 11:45 am

I created a minesweeper game on a webpage!

Postby cHeal » Wed Nov 25, 2015 4:41 pm

Hey, so I'm a web developer and I've been planning on making a minesweeper game for the past year but haven't had the time due to work so today, after the busiest few weeks of my life I decided to chill out a little by building a little minesweeper game.

Image

I'm using php, javascript and the game works thus:

prep:
It generates a grid with a totally random distribution of mines ( 15% change of each cell having a bomb ).
It then searches the grid cell by cell and runs a proximity function which calculates the number of adjacent mines to that cell. It returns that number to a hidden element within each cell.

interaction:
left click a cell and it reveals the hidden element inside.
If it's a bomb, it deactivates the grid so you can't click again.
if the element has a proximity count of zero it will flood open the the grid, searching through the surrounding cells (not diagonally) in sequence (using a recursive function)

Time taken: 3 hours


To do:
A few graphics to fancy it up, including a mine graphic.
Right click to flag, with a counter
System to check if all mines have been detected
Restart System
Asynchronous grid generation so the grid is only filled after the first click. This prevents the user from hitting a mine with their first click.

And that's about it. There really isn't much to it.

Hoping next year I will have more time on my hands (I said the same thing last year!) and I can create a minesweeper game in Unreal 4. If it's good I'll release it for mobile for free. Mostly just want to learn the ropes for creating a game loop in Unreal.

Now, back to work!!!
Image

User avatar
Rusty
 
Posts: 1692
Joined: Sun Oct 26, 2003 1:36 pm
Location: Plymouth,Devon

Re: I created a minesweeper game on a webpage!

Postby Rusty » Wed Nov 25, 2015 10:42 pm

I was hoping you'd host it somewhere so we can have a play :)

User avatar
cHeal
 
Posts: 2294
Joined: Sat Jul 16, 2005 11:45 am

Re: I created a minesweeper game on a webpage!

Postby cHeal » Wed Nov 25, 2015 11:28 pm

There ain't much to play really. I'll see if I can grab some free hosting to put it up.

I was more interested in how easy it would be to work out the mechanics. Very, is the answer :)
Image

User avatar
Rusty
 
Posts: 1692
Joined: Sun Oct 26, 2003 1:36 pm
Location: Plymouth,Devon

Re: I created a minesweeper game on a webpage!

Postby Rusty » Thu Nov 26, 2015 7:30 am

It's the sort of thing I'd like to do but don't have the will power to do it. Unless it's a deadline for work, I'd rather play other people's games.

User avatar
cHeal
 
Posts: 2294
Joined: Sat Jul 16, 2005 11:45 am

Re: I created a minesweeper game on a webpage!

Postby cHeal » Thu Nov 26, 2015 10:47 pm

I'm nearly the opposite, can barely find anything that I really enjoy playing and end up dreaming up games I'd rather play instead!

I think I'm past it. Outside of the Witcher games (and Stalker) I haven't played a game in over a decade which really truly made me feel like gaming was important to me, or important in general. I'm a grumpy old gamer at 30!
Image


Return to General Gaming & PW Steam Group

Who is online

Users browsing this forum: No registered users and 1 guest