All writing

Writing a Murder Mystery Where the Culprit Changes Every Time You Play

By Bronson Dunbar ·

A murder mystery has a replay problem. Once you know who did it, the case is over for good. You can't unlearn that it was the butler.

Motive is my murder-mystery game: twelve cases set between 1899 and 1963, each with six locations, four suspects and five possible weapons. You search the rooms, solve their challenges to recover evidence, compare alibis, then make a full accusation: who did it, where, and with what. To make cases worth replaying, every case has five variations, and the culprit, room and weapon change between them.

This post covers how that works, and why every variation is written as a complete story rather than shuffled at random.

Why not randomise?

The obvious approach is to shuffle the solution: pick a random suspect, room and weapon, and assign clues to fit. I rejected it quickly. Randomly assigned clues produce mysteries that are technically solvable but don't make sense. Why would a torn ledger page in the library point at the cook? A good mystery needs every clue to belong to one story: a motive, a method and a cover-up, in which every piece fits.

So a variation in Motive isn't a shuffled solution. It's a complete rewrite of the case's evidence around a different story.

What a variation contains

Each variation is a data object:

type CaseVariation = {
  id: string
  killer: string
  murderRoom: string
  weapon: string
  sceneEvidence: string     // what ties the room and weapon together
  solution: string          // the full explanation, shown at the end
  evidence: Record<string, EvidenceVariation>  // one clue per room
  statements?: Record<string, { alibi: string; statement: string }>
  weaponRooms?: Record<string, string>         // where the weapon is found
}

Take the first case, a death at Blackthorn Manor. In one variation, a business partner poisons the victim's tea to hide embezzlement. In another, the victim's daughter uses a letter opener after learning she's been cut from the will. Same manor, same six rooms, same four suspects, but every room holds a different clue in each variation:

Room Variation: the ledger Variation: the codicil
Library A torn ledger page tracing a private transfer A half-burned codicil removing the daughter from the estate
Ballroom A pocket watch stopped at 11:42, with red wool in its hinge A pearl from the bracelet she claimed she never removed
Conservatory Footprints that never enter the manor, disproving an intruder story Garden soil on her hem matching the staged prints

Notice how both conservatory clues deal with a staged intruder, but each says something different about who staged it. That's the kind of consistency I couldn't get from randomness.

A recovered clue in Motive: "A rewritten brake entry", found in the conductor's cabin, with a case illustration and the written evidence.

The rules every variation follows

When I write a variation, it has to satisfy a few rules:

  1. Every room's clue belongs to this story. No clue is left over from another variation.
  2. The scene evidence ties room and weapon together, so the "where" and "with what" can be deduced, not guessed.
  3. Motive, means and opportunity each have their own evidence, spread across rooms, so no single room solves the case.
  4. At least one clue breaks the culprit's alibi or cover story. Mysteries are solved when a story stops adding up.
  5. The solution text explains every clue, so a player who lost can check that the case was fair.

I draft variations with AI, then review and verify each one against these rules myself. AI is quick at producing a story and a set of clues. Checking that every clue really fits, and that the case is fair, is still my job.

Tests enforce the structural parts: every case has exactly five variations with unique IDs, and every variation has a clue for all six rooms, a killer, a murder room, a weapon, scene evidence and a solution. They can't tell whether a story is good, but they do catch a variation that's missing a room.

Wrong accusations

You get three accusations per case. A wrong one costs an attempt. The third wrong one resets the case to a different variation:

export const MAX_ACCUSATIONS = 3

export function accusationOutcome(theory, solution, attemptsUsed) {
  if (theory.suspect === solution.suspect && theory.room === solution.room && theory.weapon === solution.weapon) {
    return { verdict: 'correct', attemptsUsed }
  }
  const next = Math.min(MAX_ACCUSATIONS, attemptsUsed + 1)
  return { verdict: next >= MAX_ACCUSATIONS ? 'reset' : 'wrong', attemptsUsed: next }
}

An accusation only counts if all three parts are right. Naming the right person in the wrong room isn't solving the case.

Motive's accusation step from the practice case: pick a culprit, a murder location and a weapon. In a real case, three incorrect accusations reset the investigation with a different variation.

The reset is what stops brute force. With four suspects, six rooms and five weapons there are 120 possible theories, and three guesses won't get you there by luck. When you fail, the case changes underneath you, so what you learned from your wrong guesses doesn't carry over.

Choosing the next variation has one rule: it can never be the one you just failed.

export function nextVariationIndex(current, variations, random = Math.random) {
  const offset = 1 + Math.floor(random() * (variations.length - 1))
  return (current + offset) % variations.length
}

Adding an offset between 1 and length − 1 guarantees a different index without retrying. The tests pass in fixed "random" values (0, 0.5 and 0.9999) to check that the edge cases never land back on the same variation.

The inspector

Sometimes you're sure about two parts of a theory but not the third. Motive lets you spend an accusation on the inspector, who tells you which parts of your theory fit and which don't, without revealing the answer. It's a trade: information now, at the cost of an attempt you might need later.

Playing with friends

Motive also supports private parties, so a group can work a case together on a "case night". The host sends an invite link, and once someone accepts, a party chat opens inside the game, so everyone can compare clues without leaving the scene. Variations matter even more there: a group that has played a case before can play it again without anyone spoiling it.

Parties came from a simple idea: mysteries are more fun with other people. Solving a case together, and helping each other spot what someone else missed, felt like a natural fit for the game.

What I learned

  • Randomness isn't variety. Five complete, checked stories beat infinite random combinations.
  • Structure the content so it can be tested, even when the creative part can't be.
  • Make failure change the game, not just end it.

Try a case at motive-zeta.vercel.app, and see if you can solve it before it changes.