🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

needs some help about match3 game techniques(possible moves and avoid lock)

Started by
1 comment, last by irreversible 3 years, 1 month ago

hi. I have no experience making matching games but at the start, I see some possible problems:

1- possible lock: what is the right algorithm or technique to avoid board lock and have always possible moves for matching on the board.

2- how to find possible matches on the board to help the player?

3- what is the best way to find matches on the board? I think the best way is to make a recursive function to find all those possible matches.

Advertisement

moeen k said:
1- possible lock: what is the right algorithm or technique to avoid board lock and have always possible moves for matching on the board.

One way would be to always have at least one matching adjacent pair next to each three- or larger combination. Or if the tiles drop down, then you can split up combinations with another combination so that when that combination is removed, the result is a new, valid combination. By nesting these, you can create the illusion of some complexity. Or - brute force it to find combinations that work. It's not like even a pocket calculator couldn't handle brute forcing a reasonably small level with only a handful of different item types.

moeen k said:
2- how to find possible matches on the board to help the player?

You might start by looking into “flood filling”.

moeen k said:
3- what is the best way to find matches on the board? I think the best way is to make a recursive function to find all those possible matches.

You could iterate over a board (just go from top left to bottom right) and initiate a flood fill at each tile. Yes, you can use recursion for the fill itself. If a fill “returns” three tiles or more, then you know you've found a combination.

This topic is closed to new replies.

Advertisement