match 3 game help

This is driving me crazy…

Match 3 game

How do you know when a board has stopped filling with gems after a player has made a match? i.e. when the board has settled and the move ends

In my game each gem checks itself for everything. I don’t loop through the grid to check for matches. Each gem transitions into each tile checking below, left, right all the way down the grid unit it stops, then checks itself Horizontal and vertical  for a match after it has stopped moving. When a gem drops down, it drops the one above it. If a gem is destroyed it puts a new gem into a Queue and attempts to drop it on the top row.

You think it would be easy to know when the grid has stopped filling and settled.

I know you need to perform this check for each gem, particularly gems that have stopped moving and have no match.

But for each gem – if you loop through the entire grid to see if each tile is settled --this slows the game down, besides a millisecond later there could BE A MATCH on the other side of the board.

The way I do it now – I fire a timer 1000 milliseconds after a gem has stopped moving and has no match.  Then if a gem is being created or is dropping on the board  the timer is reset. But this makes the player  wait almost a second after each swipe… ugh I know a second doesn’t seem like much but other professional games know instantly … any ideas or help

Hi.  I wrote this for the Corona community some time back: https://github.com/coronalabs/CoronaCrush/

It is one of many ways to make a match-3 game.  It might help you to examine it and then to consider your own variations and solutions.

PS - Kudos to Greg Pugh for the art.

Wow – that’s the code I studied that started me on this match 3 adventure. Very impressive. My inspiration :slight_smile:

You use RayCast to check for matches – awesome!

My first attempt at a match 3 game I used an algorithm on line to check the entire board for a match. The algorithm was very fast and efficient – but I noticed you have to wait – wait – for the entire board to stop filling to look for a match. Other match 3 games would make matches while gems were still falling –  !

So I thought of the idea of having each gem check itself after it drops on the board – not loop through the entire grid after the board has stopped filling. It works great – see below my match 3 game. The problem with my way is the board is dynamic, its not so cut and dry when the board has stopped filling.

This is my Match 3 Engine so far:

http://forums.coronalabs.com/topic/51890-bubbles-match-3-engine/

Anyway, thanks for your help and your inspirational source code.

Hi.  I wrote this for the Corona community some time back: https://github.com/coronalabs/CoronaCrush/

It is one of many ways to make a match-3 game.  It might help you to examine it and then to consider your own variations and solutions.

PS - Kudos to Greg Pugh for the art.

Wow – that’s the code I studied that started me on this match 3 adventure. Very impressive. My inspiration :slight_smile:

You use RayCast to check for matches – awesome!

My first attempt at a match 3 game I used an algorithm on line to check the entire board for a match. The algorithm was very fast and efficient – but I noticed you have to wait – wait – for the entire board to stop filling to look for a match. Other match 3 games would make matches while gems were still falling –  !

So I thought of the idea of having each gem check itself after it drops on the board – not loop through the entire grid after the board has stopped filling. It works great – see below my match 3 game. The problem with my way is the board is dynamic, its not so cut and dry when the board has stopped filling.

This is my Match 3 Engine so far:

http://forums.coronalabs.com/topic/51890-bubbles-match-3-engine/

Anyway, thanks for your help and your inspirational source code.