🎮 Ninegems: A Strategic Puzzle Game Reimagined with AI and Love2D
Jigar Maheshwari

Jigar Maheshwari @jigarmaheshwari

About: Cloud & Devops Engineer

Joined:
Jun 22, 2025

🎮 Ninegems: A Strategic Puzzle Game Reimagined with AI and Love2D

Publish Date: Jun 22
1 0

Ninegems is a modern digital remake of the classic Nine Men’s Morris board game, built using Love2D, Lua, and Amazon Q CLI. This project blends timeless game mechanics with AI-powered development workflows, delivering a refreshed strategy experience for modern players.

👉 Now available for Windows (64-bit) on itch.io:
🔗 https://jigar-maheshwari.itch.io/ninegems

📸 Screenshots
Here are some visuals of Ninegems in action:

Home Screen

Player GemsStone Selections

GameBoard1

GameBoard2

Mill Formed

Victory

Setting

How To Play

🎯 Why Nine Men’s Morris?
I've played this game many times growing up, and its tactical depth always fascinated me. The goal is simple—form “mills” (three-in-a-row) to remove your opponent’s pieces—but the layers of strategy and timing make it endlessly replayable. I wanted to reimagine this logic-heavy board game into a playable digital form with clean visuals, animations, and ambient sound.

🛠️ Tech Stack

Game Engine: Love2D
Programming Language: Lua
AI Assistant: Amazon Q CLI
Visual Assets: Generated with Layer AI : https://www.layer.ai/
Background Music: Created using Suno AI : https://suno.com/

💡 Prompting Techniques That Worked

Amazon Q CLI made development incredibly productive. Here are a few effective approaches I used:

Prompt by feature scope: Instead of broad asks like

“create movement logic,”

I used focused prompts like

“check if a player can move based on adjacent positions in Lua.”

Edge-case-driven instructions: Highlighting rules like

“if player has only 3 pieces, allow free movement”

helped generate correct logic.

Debug-friendly code: Asking for built-in logging and validation helped trace issues quickly in gameplay flow.

🤖 AI Solutions to Classic Challenges

✅ Mill Detection

function Logic.checkMillsAtPosition(game, position, player)
    for _, mill in ipairs(mills) do
        if table.contains(mill, position) and
           game.board[mill[1]] == player and
           game.board[mill[2]] == player and
           game.board[mill[3]] == player then
            -- Mill formed
        end
    end
end
Enter fullscreen mode Exit fullscreen mode

✅ Victory Logic

function Logic.checkWinCondition(game)
    if Logic.countPieces(game, opponent) < 3 or not Logic.hasValidMoves(game, opponent) then
        return currentPlayer
    end
end
Enter fullscreen mode Exit fullscreen mode

✅ Movement Conditions

if pieceCount == 3 then
    -- Can move to any empty position
else
    -- Restrict to adjacent positions
end

Enter fullscreen mode Exit fullscreen mode

⚙️ Automation That Saved Time

AI accelerated development by handling:

  • Board-state updates across phases
  • Turn logic and piece switching
  • Animation triggers on mill formation
  • Valid move detection and game-over conditions
  • Debug printouts for tracing game flow

🎨 Visual & Audio Experience

Artwork: Gem tokens, layered board backgrounds, and mill glow effects were generated using Layer AI.

Sound Effects: Added for placement, movement, and mill events to enhance feedback.

🧠 How to Play – Rules & Strategy

🎯 GAME PHASES

1. PLACEMENT PHASE (9 gems each):

  • Take turns placing gems on empty positions
  • Click any empty circle to place your gem
  • Each player has a 10-minute timer
  • Continue until all 18 gems are placed

2. MOVEMENT PHASE:

  • Select your gem by clicking it (yellow ring will show)
  • Move to an adjacent empty position connected by a line
  • Timer continues during movement

3. MILL FORMATION & REMOVAL:

  • Form a mill by aligning 3 of your gems in a straight line
  • Beautiful visual effects celebrate your mill
  • Remove 1 opponent gem (highlighted in red)
  • Gems in mills are protected from removal
  • Mill events do not consume additional time

⏳ TIMER SYSTEM

Each player starts with 10 minutes

  • Timer counts down only during your turn
  • Orange warning: under 2 minutes
  • Red flashing: under 30 seconds
  • Game ends immediately if timer hits 0

🎮 CONTROLS

  1. Left Click: Place, select, move, or remove gems
  2. R Key: Restart game (after game over)

🏆 WINNING CONDITIONS

  • Opponent has 2 or fewer gems left
  • Opponent has no valid moves
  • Opponent’s time runs out

💡 STRATEGY TIPS

Manage your time wisely—balance speed and planning

  • Control central spots for more mill opportunities
  • Keep your gems in mills to protect them
  • Watch your opponent’s setup and block mills
  • Think 2–3 moves ahead to reduce decision time

🧩 Final Thoughts

Ninegems is a turn-based puzzle game combining timeless gameplay with modern tools. Built with the help of AI and a deep love for strategy, it offers a clean, colorful experience for anyone who enjoys thoughtful board games.

🖥️ Play now on itch.io (Windows 64-bit)
🎮 https://jigar-maheshwari.itch.io/ninegems

Comments 0 total

    Add comment