How to make a match 3 game
A match-3 game is a grid where swapping two pieces lines up three of a kind. They clear, new ones fall, and sometimes the fall makes another match. The grid takes a weekend to build. Making it feel good on a phone is the real work.
The rules to code
- Swaps. Swap two neighbors. If no match forms, swap them back. That bounce teaches the rule.
- Match check. After each move, scan rows and columns for three or more of the same piece.
- Cascades. Cleared pieces leave gaps. Pieces above fall, new ones drop in, and you check again until nothing matches.
- Special pieces. Match 4 for a line clear, 5 for a color bomb, an L or T shape for an area blast. Candy Crush Saga (King, 2012) made these famous.
- Dead boards. If no move is possible, shuffle. Players should never be stuck.
Level goals turn it into a puzzle
Endless swapping is a toy. Levels add goals: reach a score in 20 moves, clear tiles under the pieces, drop items to the bottom. A goal plus a move limit makes each level a small puzzle. Bejeweled (PopCap, 2001) was score-based; Candy Crush added level goals and a map to travel.
Tools and phone tips
- Unity. The most common choice. You need a 2D array for the board, the match check, and tweened animations for swaps and falls.
- Godot. Free, light on phones and strong in 2D. The same logic, written in GDScript.
- GDevelop. Free, event-based and has phone apps. Workable for simple boards.
- Phone tips. Big pieces (about 8 by 8 fits a phone screen), swipe to swap, a rising sound for each cascade step, and pieces that pop instead of vanishing.
- Roam. A free iPhone app. Describe the board, the pieces and the goal, and it comes back playable. Change it by asking: "add a bomb piece", "15 moves only".
Play it on Roam
Create your match-3 puzzle with Roam
Pick your pieces, a goal and one special piece of your own. Play it on your iPhone and tune the levels by talking.
Try: "match-3 with candy planets, match 4 for a rocket, 20 moves to free 10 trapped astronauts"Questions people ask
How do you make a match 3 game in Unity?
Store the board in a 2D array, check rows and columns after each swap, clear matches, drop pieces down, fill from the top and check again.
Why are match-3 games so popular?
They are easy to learn, fit short sessions on a phone, and cascades give surprise rewards the player did not plan.
How many piece colors should a match-3 game have?
Five or six is typical. Fewer makes matches too easy; more makes the board feel random.
Keep exploring
- How to make a mobile game
- How to make a 2D game
- How to make a game on your phone
- How to make a game on iPhone
- How to make a horror game that actually scares people
- How to make a game for free
More on Roam: All Roam games Games to play, by kind

