Make a Puzzle Game With AI and Keep Every Level Solvable
A good puzzle game is one rule explored deeply, so start with a single rule and five levels you designed yourself. Then have your AI work out the shortest solution to every level, because a level it merely says is solvable may not be.
Why can your AI not just make the levels?
It can make them. They just may not work. A level can look perfectly reasonable and have no solution at all. It can also have a solution so short that the clever idea you built it around never comes up.
Take a game about a railway junction at night. You flip track switches so that three coloured carriages reach their matching platforms. The rule is simple: a switch changes the route for every carriage that crosses it after you flip it. Ask your AI for twenty levels and it will give you twenty pictures of tracks. Some will be impossible. Others will be solved by flipping one switch.
So do not trust the look of a level. Trust a list of moves. With a small rule set, a computer can try every possible sequence and report two things: whether a solution exists, and how few moves it takes. That second number is the closest thing you have to a difficulty rating.
How do you pick the one rule?
Try this test: can you explain the rule in one sentence, and does it surprise you after ten minutes of playing with it? The railway rule does, because flipping a switch for the red carriage also reroutes the blue one behind it. All the puzzles live inside that one surprise.
If you need a second rule to make things interesting, your first rule may be too thin.
What is the order of work?
- The rule alone, in one empty practice level.
- Undo and restart, before any more levels. Puzzle games are about trying things, and trying has to cost nothing.
- Five levels by hand, each showing one new consequence of the rule.
- The solver: your AI's small helper that tries every move.
- Order the levels by shortest solution, then change that order after watching real people.
- Only then, around level 15, consider one new rule.
Your levels are also your tutorial. Level 1 should be solvable by accident. By level 3 the player should have discovered the surprise alone, with no text explaining it.
What is the mistake that kills puzzle games?
Adding a new rule whenever you run out of ideas. Each one makes the game wider and shallower. Five rules you have barely explored feel like a tech demo, and one rule explored in thirty ways feels like a game with a mind of its own. When you get stuck, ask what happens at the edges of the rule you already have.
Paste this to your AI
I want a small puzzle game built around one rule. Ask me to describe the rule in one sentence, and warn me if it seems too thin.
Open with a state machine in a Mermaid diagram of the play loop: look, move, undo, restart, stuck, solved, next level. Tell me if any state can trap the player. Then build one practice level from it, with undo and restart.
For each level we add, go through every possible sequence of moves. Give me the exact moves of the shortest solution and how many moves it takes. Never tell me a level is solvable, easy or hard without showing that list. If you could not go through them all, say how far you got, and say you do not know.
Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
How to check it worked
- Follow the AI's solution by hand. Play its exact moves. If the level does not end, it was wrong, whatever it claimed.
- Hunt for shortcuts. Try to beat each level with fewer moves than it says is possible.
- Undo everything. Undo all the way to the start. The level should look exactly as it began.
- Trap yourself. Reach a position you cannot get out of. The game should let you recover at once.
- Hand level 3 to a friend. Give no hints. Note where they stop and frown.