The Cookie Jam Game: How It Plays and How to Build One

By Arron R.10 min read
The game Cookie Jam is a free-to-play match-3 puzzle from Jam City (then called SGN), launched in 2014. You swap cookies to line up three or more and clear leve

The game Cookie Jam takes the oldest rule in casual puzzle games, line up three of the same thing, and wraps it in a bakery theme that made it one of the most downloaded mobile puzzlers of the mid-2010s. This guide covers what it is, how a level works, where to play it, why it succeeded, and then the part most guides skip: how to build your own Cookie Jam style match-3 game, with working code you can run today.

Cookie Jam is a match-3 puzzle game. “Match-3” is the genre name for games where you swap pieces on a grid so that three or more identical pieces line up in a row or column, at which point they disappear and you score. In Cookie Jam, the pieces are cookies, cakes and other sweets, and each level asks you to reach a specific goal within a limited number of moves.

The game was released in 2014 by SGN (Social Gaming Network), a Culver City studio that rebranded as Jam City in September 2016. According to Jam City’s Wikipedia history, Cookie Jam was named Facebook’s game of the year, passed 100 million downloads with 5 million active players at the time, and sat among the 20 highest-grossing mobile games on both Google Play and the App Store. Its success was a big part of why Netmarble invested $130 million in SGN in July 2015.

The name is busy. Some game development events have used “Cookie Jam” as the title of a game jam: a short, time-boxed event (often a weekend or a few days) where people build a game from scratch, solo or in teams. If that is what brought you here, the build sections below are written for exactly that situation.

And if you were after a different “jam” entirely, we have separate guides on the Kan Jam flying disc game and the Def Jam Fight for NY fighting game.

A level in Cookie Jam follows the same loop as most match-3 games, so once you understand it here, you understand the whole genre.

  1. Swap. You drag a cookie one space up, down, left or right, trading places with its neighbour. Diagonal swaps are not allowed.
  2. Match. If the swap creates a line of three or more identical cookies, the move counts. If it does not, the cookies slide back and nothing happens.
  3. Clear. Matched cookies vanish from the board and count toward your goal.
  4. Drop. Cookies above the gap fall down, and new ones drop in from the top to refill the column.
  5. Cascade. If the falling pieces form new matches by themselves, those clear too, and the chain continues. A cascade is free progress: it does not cost a move.

Each level has a goal, typically filling an order by collecting a set number of particular sweets, and a move limit. Run out of moves before the goal is met and you fail the level. That tension between “how many moves do I have” and “what do I still need” is the real game. Matching any three cookies is easy; matching the right ones efficiently is the skill.

Tips that actually help

  • Work from the bottom. Matches low on the board shift more pieces, which creates more chances for cascades.
  • Look for four and five before three. In most match-3 games, longer matches create special pieces that clear rows, columns or whole colours. Spending one extra second scanning for them saves moves.
  • Read the goal first. Before your first swap, check exactly what the level wants. Clearing random cookies feels productive but often wastes moves.
  • Save boosters for genuine walls. Power-ups are more valuable on a level you have failed several times than on your first try.
Four-step diagram of a match-3 turn: swap, match, clear and drop
Every Cookie Jam style turn is the same loop: swap, match, clear, drop, then check again for cascades.

Cookie Jam is a mobile game first. You can get it on Google Play for Android phones and tablets and on the App Store for iPhone and iPad. It also built a big early audience on Facebook. Some web game portals host browser versions of cookie-themed match-3 games, so if you play in a browser, check who made what you are playing.

Is it free? Yes, it costs nothing to download. Jam City’s games are generally free-to-play with microtransactions, meaning optional purchases of in-game items that speed up progress, such as extra moves or boosters. You can play through levels without spending money, but expect harder levels where the shop is nudged in front of you. If kids are playing, set purchase limits in the device’s app store settings.

One practical warning: match-3 is a crowded genre, and the app stores are full of games with similar names, similar cookie art and similar icons. Before you install, confirm the developer is listed as Jam City.

From a designer’s point of view, Cookie Jam is worth studying because it did not invent anything. Match-3 already existed. What it did was execute familiar ideas cleanly, and that is a lesson every indie developer can use.

  • A rule you learn in five seconds. Swap two pieces, make three in a row. There is no tutorial wall. Small games live or die on how fast a new player understands what to do.
  • A theme that matches the action. Cookies crumbling and popping feels like what the mechanic is doing. The art is not decoration, it is feedback.
  • Goals per level. Instead of chasing an abstract high score, every level asks for something specific. That gives players a reason to think before swapping.
  • Short sessions. A level takes a couple of minutes, which suits phones, commutes and coffee breaks.
  • Juice. “Juice” is game-dev slang for the small effects that make actions feel good: particles, squash-and-stretch, little sounds, screen shake. A match-3 board without juice feels like a spreadsheet.

The takeaway for a beginner: you do not need a new mechanic to make a satisfying game. A well-known mechanic, a clear theme and strong feedback will carry a small project a long way, especially in a game jam.

Here is the good news: the logic behind a match-3 game is small. The board is a 2D array (a grid stored as rows of values), and four functions do almost all the work: make a board with no starting matches, find matches, clear and drop, and try a swap. The example below is plain JavaScript with no libraries, so you can paste it into a file and run it with Node, or drop it into a browser console.

const ROWS = 8;
const COLS = 8;
const TYPES = ['choc', 'sugar', 'oat', 'jam', 'mint', 'ginger'];

function randomType() {
  return TYPES[Math.floor(Math.random() * TYPES.length)];
}

// Build a board that starts with no ready-made matches.
function makeGrid() {
  const grid = [];
  for (let r = 0; r < ROWS; r++) {
    grid.push([]);
    for (let c = 0; c < COLS; c++) {
      let t;
      do {
        t = randomType();
      } while (
        (c >= 2 && grid[r][c - 1] === t && grid[r][c - 2] === t) ||
        (r >= 2 && grid[r - 1][c] === t && grid[r - 2][c] === t)
      );
      grid[r].push(t);
    }
  }
  return grid;
}

// Return a Set of "row,col" keys for every cell in a run of 3+.
function findMatches(grid) {
  const hits = new Set();
  for (let r = 0; r < ROWS; r++) {
    let run = 1;
    for (let c = 1; c <= COLS; c++) {
      if (c < COLS && grid[r][c] && grid[r][c] === grid[r][c - 1]) {
        run++;
      } else {
        if (run >= 3) for (let k = c - run; k < c; k++) hits.add(r + ',' + k);
        run = 1;
      }
    }
  }
  for (let c = 0; c < COLS; c++) {
    let run = 1;
    for (let r = 1; r <= ROWS; r++) {
      if (r < ROWS && grid[r][c] && grid[r][c] === grid[r - 1][c]) {
        run++;
      } else {
        if (run >= 3) for (let k = r - run; k < r; k++) hits.add(k + ',' + c);
        run = 1;
      }
    }
  }
  return hits;
}

// Remove matched cookies, let the rest fall, refill from the top.
function clearAndDrop(grid, hits) {
  for (const key of hits) {
    const [r, c] = key.split(',').map(Number);
    grid[r][c] = null;
  }
  for (let c = 0; c < COLS; c++) {
    let write = ROWS - 1;
    for (let r = ROWS - 1; r >= 0; r--) {
      if (grid[r][c] !== null) {
        grid[write][c] = grid[r][c];
        if (write !== r) grid[r][c] = null;
        write--;
      }
    }
    for (let r = write; r >= 0; r--) grid[r][c] = randomType();
  }
}

// Swap two neighbours. Returns how many cookies were cleared (0 = invalid move).
function trySwap(grid, r1, c1, r2, c2) {
  const inBounds = (r, c) => r >= 0 && r < ROWS && c >= 0 && c < COLS;
  if (!inBounds(r1, c1) || !inBounds(r2, c2)) return 0;
  if (Math.abs(r1 - r2) + Math.abs(c1 - c2) !== 1) return 0;

  [grid[r1][c1], grid[r2][c2]] = [grid[r2][c2], grid[r1][c1]];
  let hits = findMatches(grid);
  if (hits.size === 0) {
    [grid[r1][c1], grid[r2][c2]] = [grid[r2][c2], grid[r1][c1]];
    return 0;
  }

  let cleared = 0;
  while (hits.size > 0) {           // cascades keep going for free
    cleared += hits.size;
    clearAndDrop(grid, hits);
    hits = findMatches(grid);
  }
  return cleared;
}

const grid = makeGrid();
console.table(grid);
console.log('Cleared:', trySwap(grid, 0, 0, 0, 1));
console.table(grid);

What each piece does

  • makeGrid rerolls any cookie that would complete a line of three as the board is built, so the first screen does not resolve itself before the player touches it.
  • findMatches scans every row, then every column, counting runs of identical cookies. A Set stops a cookie that sits in both a horizontal and a vertical match from being counted twice.
  • clearAndDrop handles gravity column by column: it walks up from the bottom, shifts surviving cookies down, then fills the empty top cells with new random ones.
  • trySwap rejects non-adjacent swaps, undoes a swap that makes no match (just like Cookie Jam), and loops until no cascades remain.

Turning it into a real level

To get the Cookie Jam feel, add three things on top of this core. First, a goal: count cleared cookies by type inside clearAndDrop and compare against an order like “collect 20 jam cookies.” Second, a move counter that decreases on every successful swap and ends the level at zero. Third, rendering and input: draw the grid with a canvas or a 2D framework such as Phaser, and convert pointer drags into the row and column pairs trySwap expects. A game engine or framework gives you the drawing, input and animation loop so you can focus on rules.

If you want a broader picture of what a full project involves, our guide on how to make a PC video game walks through the stages, and the traffic jam game guide covers building another grid-based puzzle.

Pipeline from cookie art to game logic to sound to a playable match-3 build in the browser
A small match-3 game breaks into four jobs: art, logic, sound and a playable build.

The code above is the skeleton. A playable game also needs rendering, animations, menus, a level structure and testing, and that is where most beginners stall. WizardGenie, the AI game engine inside Sorceress, is built for this situation: you describe the game you want, and WizardGenie writes it, runs it and iterates on it with you. This style of building by describing and testing, rather than typing every line, is often called vibe coding.

WizardGenie runs on the web at /wizard-genie/app with nothing to install, and as a Windows desktop app with an auto-updater that gives you native file access and longer agent sessions. It works with the leading AI coding models, and you can switch models with your own API key.

Here is how a session might go for a jam-sized project. Start with a single, specific request rather than “make Cookie Jam”:

Make a match-3 browser game on an 8x8 grid with six cookie types. Swap adjacent cookies; invalid swaps slide back. Matches of three or more clear, cookies fall and refill, and cascades chain. Each level has a goal (collect N of one cookie type) and a move limit. Show the goal and remaining moves at the top.

Then play what it produces and fix one thing at a time:

  1. Feel first. Ask for falling animations, a short pop when cookies clear, and a small delay between cascade steps so players can see the chain happen.
  2. Levels second. Ask for three levels with rising goals and tighter move limits, plus a win and fail screen.
  3. Specials third. Once the core is solid, ask for a line-clearing piece created by matching four.
  4. Test on small screens. Match-3 games are touch games at heart, so check that drag input works on a phone-sized window.

Keeping each request narrow matters. When you ask for five features at once, it gets harder to tell which change broke the swap logic.

Art and sound for the cookies

Placeholder coloured squares are fine for testing, but the theme is half of what made Cookie Jam work. AI Image Gen puts the top image models in one panel, so you can generate a matching set of cookie pieces in one consistent style. If you want a mascot character with animations, Auto-Sprite v2 (a Pro tool) creates game-ready 2D sprites of characters, items and effects. A sprite is a single 2D image used in a game, and a sprite sheet is many frames of animation packed into one image.

For the crunch, pop and jingle, Sound Studio covers AI music, sound effects and text-to-speech, with a built-in audio editor for trimming. A satisfying clear sound is one of the cheapest ways to add juice. For everything else in the suite, the Sorceress tools guide lists every tool in one place.

When the game is done, export the build and host it wherever you like.

Common Mistakes When Making a Match-3 Game

  • Boards that start with matches. If the opening board already contains a line of three, it clears itself before the player acts. Generate with the reroll check shown above.
  • Dead boards. A board with no valid swap left traps the player. After every turn, check whether any adjacent swap would create a match, and reshuffle if none would.
  • Instant cascades. Resolving every chain in a single frame looks like the board glitched. Animate each clear-and-drop step with a short pause.
  • Too many cookie types. More types means fewer matches and fewer cascades. Six on an 8x8 board is a sensible starting point; seven or more feels stingy.
  • Difficulty spikes. Randomness makes some levels unwinnable by luck. Playtest each level several times and loosen move limits where you fail for reasons that are not your fault.
  • Scope creep in a jam. Specials, boosters, a map screen and a shop can each eat a day. Ship the core loop with three good levels before adding anything.

The Full Pipeline at a Glance

Cookie Jam is a free-to-play match-3 puzzle released in 2014 by SGN, now Jam City, available on Android and iOS. You swap neighbouring cookies to make lines of three or more, chase level goals within a move limit, and use cascades and special pieces to save moves.

If you want to make your own, the route is short:

  1. Logic: grid, swap, find matches, clear and drop, cascade loop. The JavaScript above covers it.
  2. Rules: add per-level goals and a move counter.
  3. Game: describe it to WizardGenie and iterate one feature at a time, or wire the logic into a framework yourself.
  4. Art and sound: a consistent cookie set from AI Image Gen and pops and music from Sound Studio.
  5. Polish: animate cascades, prevent dead boards, playtest every level.

A match-3 is one of the best first games you can build: the rules fit on a sticky note, the code fits in one file, and the polish teaches you most of what game feel is about.

Frequently Asked Questions

Is Cookie Jam free to play?

Yes. Cookie Jam is free to download and play. Like most Jam City games, it is free-to-play with microtransactions, which means you can buy in-game items or extra help that speed up progress. You can play through levels without paying, but some players hit harder levels where buying boosters or extra moves becomes tempting. Set a spending limit in your app store settings if you share a device with kids.

Who made Cookie Jam?

Cookie Jam was made by SGN, short for Social Gaming Network, a mobile developer based in Culver City, California. SGN launched the game in 2014 and rebranded as Jam City in September 2016, so today you will see Jam City listed as the developer. The same company also makes Panda Pop and Harry Potter: Hogwarts Mystery. Cookie Jam was one of its biggest early hits.

Can I play Cookie Jam on iPhone or Android?

Yes. Cookie Jam is a mobile game and is available on both Google Play for Android and the App Store for iPhone and iPad. It also started life with a strong Facebook audience. When you download it, check that the listed developer is Jam City, because the match-3 genre is full of look-alike games with similar names and cookie themes.

How do you play Cookie Jam?

Swap two neighbouring cookies so that three or more of the same kind line up in a row or column. Matched cookies vanish, the pieces above fall to fill the gap, and new cookies drop in from the top. Each level gives you a goal, such as collecting a set number of certain cookies, and a limited number of moves. Hit the goal before you run out of moves to win.

How hard is it to make a match-3 game like Cookie Jam?

The core is approachable for a beginner. You need a grid, a swap rule, a function that finds runs of three or more, and a loop that clears matches, drops pieces and refills the board until no matches remain. That logic fits in under 100 lines of JavaScript. The hard part is everything around it: animation, level design, difficulty tuning and making the board feel satisfying to play.

Is Cookie Jam also a game jam?

The name is also used by game development events. A game jam is a short, time-boxed event where people build a game from scratch, often over a weekend, and some jams have used the Cookie Jam name, including a three-day marathon format. If you want to enter a jam like that, a match-3 or other small puzzle game is a realistic scope for a few days.

Sources

  1. Jam City (company) — Wikipedia
  2. Vibe coding — Wikipedia
  3. Game engine — Wikipedia
  4. Indie game — Wikipedia
Written by Arron R.·2,487 words·10 min read

Related posts