Match-3 puzzle game algorithms

Started by
1 comment, last by markypooch 8 years, 1 month ago

I want to develop a game similar to a match three puzzle game. I am new to game development, but I have basic knowledge of various coding concepts such as data structures and algorithms.

I want a 9X9 grid layout for the game and I would like to have some guidance to design the algorithms to fill up the empty cells of the grid, after match making takes place. I also would like some guidance on how to design the level progression and ramp up the difficulty in a match three puzzle game.

I’d appreciate any suggestions/thoughts/pseudo-code for this topic. Thank you.

Advertisement

Two common factors I've seen seen in these games are the number of colors and the frequency of appearance.

Lower levels usually have few colors, perhaps 3 or 4. High levels tend to have many colors, perhaps 6 or 8 or more.

Lower levels tend to have long runs of colors, driven perhaps by the few choices they've got but also by the design of the game. Some match-chain games (such as Zuma) start with long runs of colors so a match has a big impact, late game it is rare to see more than 2 of the same color generated.

I want a 9X9 grid layout for the game and I would like to have some guidance to design the algorithms to fill up the empty cells of the grid, after match making takes place. I also would like some guidance on how to design the level progression and ramp up the difficulty in a match three puzzle game.

Well I'm not sure how you have your program structured so far (And if you've chosen to have your board represented by a simple array), but code for populating a 1D, or 2D array (in the following example 2D) is quite simple, and can be expressed in many ways. But one simple way is:


//Psuedo Code
Cell board[9][9];
 
for (i = 0 to board.length())
    for (j = 0 to board.length()) //Assuming your board is 
always column, and row symmetrical
        board[i][j] = new Cell() //where 
your default constructor for cell will just self initialize to be representative 
of an empty cell
        //Or alternatively
        board[i][j] = new 
Cell(Enumerator.SomeRandomColor);

Of course, I would imagine as Frob sated that populating your board at pure random may lead to cases that as soon as your game loads you get a match 3 Or match 4 without player intervention, which is obviously a sign of either a very liberal, and player friendly Matching game, or a poorly designed one. (I once played a version of bejeweled that upon a level loading I would get Match 4s all over the place, haha, let's just say Wisdom Cat was not amused)

One simple to code game would be TicTacToe. This would give you an idea on how a very basic matching game is created, and potentially provide you with a base to build into a more complex project which ultimately seems like what you want.

Marcus

This topic is closed to new replies.

Advertisement