This article contains spoilers for the “Death in the Family” mission of “Hitman 3.”

When playing “Hitman,” it’s easy to lose yourself in the theatrics of a kill. You can don a chef’s outfit to slyly poison someone’s meal. Or steal the identity of a barber to slit the throat of an unsuspecting customer. But IO Interactive’s latest, “Hitman 3,” introduces a mission so inventive and enticing — in which you put on a detective’s hat to solve a mystery — that you may forget you’re there to commit murder at all.

At least, that’s what happened when we played “Death in the Family,” the second mission in “Hitman 3” that sends you to a British manor in Dartmoor, England, to kill one of the villains of the series, Alexa Carlisle, a member of the antagonistic, shadow government Providence. You can kill her immediately, or you can take a more creative approach: subdue or kill a private investigator to take his place and solve a mysterious murder — all to get closer to your target undetected.

It’s one of the most impressive Hitman levels to date, with a fun flip of the script in which an assassin solves a murder. But creating the manor, filled with secret rooms and tiny details, and making the murder mystery click within the confines of “Hitman” were no easy feats for developer IO Interactive.

Building the level required a lot of “experimentation," lead and senior level designer Toke Krainert told The Washington Post. Once they settled on a manor — a decision made fairly early — the next question was gameplay and story. They wanted to provide insight into Providence, as Alexa Carlisle would be the main target. A murder mystery felt like the perfect way to do that, giving players backstory on the Carlisle family as they uncovered clues and interrogated suspects inside the mansion.

But the structure of a murder mystery proved problematic. “Hitman" encourages players to replay levels, offering diverse approaches to murdering targets. The story of a murder mystery is fairly linear, and that came into conflict with design pillars — particularly replay value and player freedom. IO Interactive had to rethink certain systems, mechanics and narrative paths to make it work.

“It was a bit of a gamble to make this level," writer Crystal Graabeak said. "And I think we all felt that.”

To add versatility, IO Interactive considered randomized culprits for the murder mystery, instead of a single murderer, as it is in the final product. But the idea was scrapped.

“The problem with that was obviously story — you can’t build as deep a narrative if parts of the story are randomized," Krainert said. "Also, it messes with the whole canon of the plot. If your Carlisle family is not the same as someone else’s family, that becomes a mess.”

The gothic mansion takes inspiration from decades-old detective fiction, particularly Agatha Christie novels. Contrary to popular belief, “Knives Out” wasn’t a direct inspiration. The trailer came out when the team was “well ahead” with production, and some members of the lead development team, including Graabeak, still haven’t seen the film.

With three fully explorable floors and many, many rooms, the estate is considerably large. IO Interactive needed to find a clear way to nudge players in the right direction, all while introducing clues in the right order to make sense. One solution was adding a subtle draft of wind that rolls through a room that acts as a hint. A sound of ruffling paper, for example, directs players to a relevant item.

“The location of dialogues between guards and staff members is strategically placed to ease you into the story, so you didn’t run into someone talking about something very obscure before having heard something that led you to that point in the story,” Krainert said.

As the team navigated making the story digestible and comprehensible within an open sandbox, another question popped up. Could a murder mystery story — one with a single killer — somehow be replayable?

IO Interactive decided to keep the major beats of the story nonmalleable, but let players choose the final accusation. After interrogations and compiling clues, players can approach Alexa, present their evidence and indict a suspect of the crime. It’s always the same story and the same murderer, but player agency comes in with whom they decide to pin the murder on, each leading to different outcomes.

The team also toyed with adding a secondary target. Once you blame the true killer in the murder mystery, you could reveal your true identity to Alexa, who would ask you to kill the culprit on her behalf. This was cut because the sheer amount of content was becoming unruly.

I think that would have also conflicted with the overall story, because when you complete all the objectives, the whole mood of the mansion changes because [Agent 47′s handler] Diana goes missing," sound designer Gabriel Johannesson said.

As it was, the story was already complicated, involving a fake funeral and generations of deceit. The level went through many evolutions, and was at one point much bigger than it is now.

“This was the digestible, simple version of the murder mystery,” Krainert said. "We had talks about making it even more complex, but it might have been a good thing that we stuck with this.”

Developing “Death in the Family” spurred an evolution of gameplay systems too, including minor changes to the user interface and how the camera was developed for “Hitman 3.” Presenting the intel menu differently was key, now with relevant information presented more clearly and divided by categories, in comparison to the messier version in “Hitman 2.”

The camera, a new tool, is used to scan areas and items that can then be hacked, like opening a locked window. In Dartmoor, it’s also one of Agent 47′s main methods for collecting clues.

“When we were early in design for the murder mystery, we knew there was going to be a camera, but we didn’t know exactly how it was going to work," Krainert said. “And so the [murder] mystery and that level design became part of the premise for developing the feature, and the feature informed how we did it.”

Playing detective in the murder mystery isn’t the only way players can interact with the story — it’s just one of three “mission stories," which are mission markers that kickstart mini-narratives inside levels, offering players different ways to kill. Designing one of the opportunities, in which you steal the identity of an undertaker to push Alexa into her own grave, took an unusual approach where the team worked backward.

“I think one interesting aspect of the burial was that we started with like, ‘we want you to be able to push Alexa into her own grave,’” level designer Viktor Rasmussen said. “And I think that was the basic pitch of it. We started from the end of the story and had to figure out the challenges and what it is that makes you come to this end.”

Solving the murder mystery at the end of the mission isn’t integral to success: So long as you kill Alexa, you can progress the story. But IO Interactive became so compelled by the murder mystery, that they thought players would feel the same — even if that meant the objective doesn’t perfectly align with Agent 47′s motives.

“It would make much more sense for [Agent] 47 as a character on this mission to just use this opportunity as a chance to get close to Alexa,” Krainert said. "He could even have claimed that he had solved it and then just met her to eliminate her right away. But it’s so alluring to actually solve this thing and to try and play the reverse assassination.”

Read more: