“It was beautiful,” says Prince’s sister Tyka Nelson of the birthday party at the center of “Empire’s” upcoming episode themed around the artist. “I was so blown away by the set — it really looked like one of Prince’s parties, every little itty-bitty detail was the way he would do something. I did a lot crying that day.”

Fans can get an exclusive sneak preview of the party — with the cast and some adorable little kids dressed in picture-perfect Prince-themed outfits — along with a brief clip of the show’s characters Hakeem (Bryshere Y. Gray) and Jamal (Jussie Smollett) performing “Let’s Go Crazy” from the show, which premieres on Fox Wednesday, Oct. 18 at 8 p.m. ET/7 p.m.CT/9 p.m. PT.

The segment, which is built around the birthday party for Hakeem’s young daughter Bella’s birthday, was conceived by director and executive producer Sanaa Hamri, who was a close friend of Prince’s and his creative director for several years.

“The writers of the episode wanted to do a princess theme for Bella’s birthday and they wondered if they could use Prince as a kind of thematic notion, purple balloons and things, and I kind of expanded it so Jamal and Hakeem would sing a remake of ‘Let’s Go Crazy.’ I dressed everybody in costumes from different eras of Prince’s career [designed by Paolo Nieddu], smattered with a Mozart rendition of princes and princesses, because ‘Amadeus’ was one of Prince’s favorite movies. He was a very dear friend of mine and I thought it was a great opportunity to celebrate his life and his artistry.”

While the experience was an emotional one for many on the set, “I will say it was more cathartic than anything,” recalls Hamri, who first met Prince in 2000 and collaborated with him on the visual elements of his 2004 “Musicology” album and tour, among other projects. “I had the support of my cast and crew and Fox, who obviously went through the hard time with me when he passed and I wanted to give him my own type of tribute as a filmmaker.

“And Taraji [P. Henson, who played Cookie in the show] is such a huge fan — she said she was the president of the Prince fan club in high school! Everyone was dedicated to making it the best possible show.

The show also plays off of an element that would be known only to deep Prince fans: He didn’t celebrate birthdays. “He just didn’t,” Hamri says. “It was part of [him being a] Jehovah’s Witness. In the storyline it’s Hakeem’s idea to celebrate Prince, and of course [true to his character] Hakeem didn’t do his research, and Cookie is like, ‘Don’t you know Prince don’t celebrate birthdays? Ain’t that right, Tyka?’” (See that scene below.)

Three former members of Prince’s most recent band appear in the performance — longtime keyboardist and musical director Morris Hayes, keyboardist Josh Welton and his wife, drummer Hannah Ford. “It was great seeing the bandmembers react to the set,” Hamri says. “They said, ‘It’s like one of the parties we used to throw, but bigger!’”

Nelson, who is one of the six heirs to her brother’s estate, appears in the scenes as well, shaking an official Prince tambourine. “The first couple of times they shot it I just sat there with my mouth open — they probably couldn’t use that part of the footage!” she laughs.