When comedian Pete Holmes separated from his then wife years ago, he continued living in her house for two weeks.

“It was terrible,” he told a room full of journalists at a hotel in Los Angeles recently.

At that time, Holmes was struggling to make a name for himself as a stand-up comedian. One day, he came home from a disastrous show only to hear that his wife wants a divorce. He was devastated.

Now his tragedy is the subject of a new comedy series on HBO called Crashing.

Holmes, 37, plays Dave, a happy-go-lucky man who has to find himself again after discovering his wife Jess (played by Lauren Lapkus) has cheated on him with another man. With no place to call home, Dave has to crash in the homes of other comedian friends.

Holmes explained why Crashing doesn’t show his character Dave living with the ex-wife just like what happened in real life. “If we wanted to make a hostile-style thriller, then we could show the audience that,” he said.

Crashing has some big names attached to the project, one of which is Judd Apatow, director of hit comedies like The 40-Year-Old Virgin, Knocked Up and, most recently, Trainwreck.

Funnily enough, in 2014, Apatow appeared as a guest on Holmes’ late night talk show The Pete Holmes Show. On the show, Holmes performed a sketch where he pitched movie ideas to Apatow.

“His character would keep saying, ‘What is your real idea?’. Then I told him this idea about a show where my wife left me for another man. And he said it was too sad.”

A well-suited Apatow, 49, who was at the interview with Holmes remembered the sketch well: “That’s the whole joke. I said, ‘It’s so sad, your wife cheated on you’. Who wants to watch that? That’s awful.”

The Pete Holmes Show was eventually cancelled in 2014 and Holmes said he started thinking about that idea again.

Apatow eventually agreed to help Holmes develop the show as one of the executive producers. He also directed the pilot episode. The show will feature appearances by comedians like Artie Lange, TJ Miller and Sarah Silverman, essentially playing themselves. Their characters help Dave navigate his post-divorce life and hone his craft as a comedian. But to be a comedian, as Dave would discover, is not easy.

“I’m interested in how when things go wrong, it could be funnier than when everything is just going smoothly. For Dave, doing comedy is a compulsion,” Holmes said.

Apatow explained that just because Dave gets booed by the audience or is told by his ex-wife that he is not good, doesn’t mean he should stop pursuing his dream.

“That’s part of the process. In the beginning, everyone tells you that you’re going to be bad. You just got to keep trying and learn how to be better,” Apatow said.

For Holmes, Crashing is a story about the human spirit: “Why do we keep running into a wall? How do we keep doing? We’re going to explore that in the show.”

So what does Holmes’ ex-wife think about the idea of Crashing? Holmes has not spoken to his wife since the divorce 10 years ago but he explained that he is not trying to paint his ex-wife in a bad light. He said on the show, Dave’s wife Jess is “an interesting three-dimensional character” that the audience can root for as well in Crashing.

“It would be my hope that (my ex-wife) would see in Crashing that there is no Disney villain hurting a good person. Good people break up with good people all the time. And there is a certain amount of compassion and empathy for the people that we break up with,” Holmes explained.

Determined to be positive, Holmes is trying to see the plus side to his divorce.

“It’s funny how the things you wouldn’t wish upon your enemies lead you into discovering and developing your passion (in Holmes’ case, doing comedy). Without the suffering, you wouldn’t figure out how to change your life,” he stated.

Crashing premieres on Feb 20 at 11.30am on HBO (Astro Ch 411).