On Wednesday, January 14, at 3 a.m., sleep-deprived Saturday Night Live writer James Anderson asked a fellow writer, Kent Sublette, “What about this idea?” Anderson, recently obsessed with the video game Dragon Age: Inquisition, proposed a sketch about a medieval castle beset by a huge fire-breathing dragon and the ­castle-dwellers who pause to sing about their imminent deaths instead of just running away.

By Wednesday evening, following a pitch meeting and a huddle with executive producer Lorne Michaels and the show’s host, Kevin Hart, Anderson and Sublette’s script was approved. Titled “The Journey,” the skit would require an elaborate castle set, and a dragon, to be built in less than 48 hours.

Related Stories SNL Recap: Kevin Hart Storms the Stage

Around 9 p.m., SNL’s four-man production-design team sprang into action. Keith Raywood, a 30-year veteran of the show, was tasked with drafting blueprints for “The Journey.” Steve Paone drove the designs to the Brooklyn warehouse where they were to be built, a process that started at 7 a.m. Thursday.

“On paper, most of the sets look impossible,” says Leo Yoshimura, a designer who has been with SNL — which celebrates its 40th anniversary with a special episode on February 15, from 8 to 11 p.m. — since the beginning. “But I don’t remember any instance when we said we couldn’t do it. We always do it.”

According to designer Joe DeTullio, this week has been less impossible than most. “We’ve built a lot of castles over the years,” he says. Castles are nothing compared to, say, the exploding whale built for a show in May. (“I was really worried about that one,” says Raywood. “There was going to be guts flying all over the place. But it worked out.”)

The scene shop, located in the Brooklyn Navy Yard, a little over seven miles from Rockefeller Center, looks like the warehouse at the end of Raiders of the Lost Ark and is filled with the remnants of sets from every era of SNL. Over here is the wall from “What’s Up With That?”; over there is the game board from “Celebrity Jeopardy!”

In a more difficult week, most of the sets might still be unfinished come Friday afternoon. This week, there are just a couple — including “The Journey.” Before long, ­DeTullio has built a structure of interlocking walls that can be assembled and disassembled during commercial breaks. Then the pieces are trucked to Studio 8H in ­Rockefeller Center to be painted.

But there’s still more to be done. The bones of the “Journey” set may be in place, but there’s nothing on them, so Raywood has to rent props from his supplier in Long Island City. Inspecting some curtains, he barks, “It’s too late, seems 17th century.” Eventually, Raywood concedes that there weren’t actually dragons during the Middle Ages, so the sketch can reasonably be considered a fantasy — which gives him some wiggle room for anachronisms. Raywood says that he’s often left trying to interpret the sketch creator’s vision. “A writer will write ‘old-timey,’ ” which he says could mean anything from the 19th century to 1974.

At 11:15 a.m. on Saturday morning, the sets are sprawled across Studio 8H in the sort of controlled chaos that only someone with decades of experience could comprehend. Adding to the atmosphere, the Saturday Night Live house band is already deep into a midday jam session.

“The adrenaline rush starts at 11 a.m. when they come in to rehearse,” says Yoshimura. “That’s when I feel the circus tent has been put up and we’re ready to do our acts. It’s magical.”

Mostly. “I usually walk out of here feeling I totally failed,” says designer Eugene Lee, who started in 1975 and hired the other three designers. “But, wait, it’s not as bad as that. We’ll be smarter next week. We’ll learn from the mistakes we made this week, and it will be better.”

When the show ends at 1 a.m. on Sunday morning, the set for “The Journey” has reached the end of its short life. It will be sent back to Brooklyn and stripped, its materials reused for something else.

“People say, ‘Well, the writers had a dream one night and then you built it,’” says Raywood. “There’s something poetic about that.”

*This article appears in the January 26, 2015 issue of New York Magazine.