As they were writing the pilot script for their new Max comedy series “Bookie,” co-creators Chuck Lorre and Nick Bakay thought it would be fun to add a real-life Hollywood star playing a version of themself as an inveterate gambler. The series stars stand-up comedian Sebastian Maniscalco as Los Angeles sports betting bookie, so it made sense that his character might run into a few high-roller celebrities during his travels.

In early drafts of that Lorre and Bakay script, the character was left as a “TBD” — to be determined. But Lorre couldn’t shake an idea he had for who might be perfect for the role: “It should be Charlie,” he tells Variety. “I remember Charlie was very much engaged in in sports betting and he would tell me stories about it all the time. You know, when things were good.”

That’s “Charlie” as in Charlie Sheen — and casting him on “Bookie” (which premieres Nov. 30 on Max) was an idea that came loaded with baggage. Lorre and Sheen hadn’t talked in more than a decade, following their very public falling out in 2011. That’s when Sheen, in a series of well-publicized tirades, attacked his “Two and a Half Men” boss, calling Lorre “a stupid, stupid man” and “a little maggot” — among other things, including thinly veiled antisemitic slurs that we won’t print here. After Sheen spiraled out of control (“an epic drug run,” the actor called it at the time, while also boasting of “winning” and operating with “tiger blood”), he was fired from the hit CBS comedy and replaced by Ashton Kutcher.

Popular on Variety

Bakay was taken aback by Lorre’s idea. “It was a thunderbolt,” he says. “You know when you’re onto something good, because it scared me. But also, I know Chuck well enough to know all that this meant. I knew everything that was below the waterline of that iceberg. And I knew there was a part of him that was ready to do something to turn that page on a more significant level.”

After that toxic end with Sheen, Lorre says it was years before he could watch old reruns of “Two and a Half Men.” “It was too painful,” he says. But time passes, and in recent years recovery and healing have been recurring themes in Lorre series like “Mom” and “The Kominsky Method.”

More than a decade after the firestorm, Lorre says he has “gotten to this place where it’s old news. I loved working with Charlie on ‘Two and a Half Men.’ We did 170 episodes together before it all fell apart. And more often than not, we had a good time. Assuming he’s in a good place, I’m in a good place.”

Lorre contacted Sheen’s representation — and it turns out the star (who is currently unavailable to share his experience due to the SAG-AFTRA strike) was also ready to make amends. “I was nervous, but almost as soon as we started talking, I remembered, we were friends once,” Lorre says. “And that friendship just suddenly seemed to be there again. I don’t want to be too mawkish about it, but it was healing. And he was also totally game to make fun of himself. When he came to the table read of that episode, I walked up, and we hugged. It was just great.”

Bakay, too, says he was nervous at first, given the weight that came with this reunion. “Look, there’s a wild-card factor there that you would be bullshit if you weren’t copping to,” he says. “There’s that sense of, who’s showing up? What’s this gonna be? I haven’t seen him work in a long time. But he looked great. He was easy and charming and then proceeded to put on a clinic of how you do a table read. Your first table read of your first episode of a new show, is a bit of a high blood pressure event to begin with.”

Max/Warner Bros. TV

Adds Lorre, who also directed the pilot: “He proceeded to kill it at the table read. His chops were just so finely tuned, as if we had not missed a beat.” The script doesn’t pull punches: Maniscalco’s character calls Sheen a “fuckwad” and points to Jon Cryer as the real star of “Two and a Half Men.” “That really falls on Charlie being a really good sport,” Lorre says. “He’s playing a version of himself that has shadows of past problems and he was fine with it.”

Sheen had one concern: In the original script, “Charlie Sheen” the character is staying at a rehab facility. “He was kind of like, ‘can we not do the drug-addled Charlie anymore?’” notes Lorre, who agreed to make a tweak. In the episode, Sheen is still running a poker game at the facility, but it’s in a room that he has rented out for the occasion.

“It’s a rehab that he knows, but he’s not there to dry out from drugs and alcohol — he’s just running a poker game,” Lorre explains. “And that solved that. I wasn’t seeking to do damage to the man. I wanted to hopefully take people’s perceptions and make it comedic, not dark.”

Sheen reappears later in the season, as he shares marital advice with Maniscalco’s character, while also trying to pay his debt with Joe Namath’s old fur coat. “We had some fun with Charlie’s memorabilia,” Bakay says. “Charlie was nothing but gold for us. I think this was great for Charlie and Chuck on a hundred levels. But first and foremost, he was a huge asset for the show.”

Yes, Bakay admits that the casting will also be good for driving up interest in “Bookie.” “Look, there’s an exploitive level to it, which is, it’s kind of fantastic for our first episode,” he says. “But there’s a bigger part of it, and this is what really is my takeaway throughout all of it: Through all the carnage, these guys made beautiful music together. And Charlie’s really good. There was that realization of like, Yeah, this is one of the best comedy actors. And it was like watching a guy in batting practice grooving balls over the fences again.”

“Bookie” was inspired by Bakay’s experience in the sports betting world, which Lorre thought might be fertile ground for a sitcom created around Maniscalco. The comedian, who regularly sells out arenas, also broke out in the films “Green Book” and “The Irishman,” and had been looking for the right TV vehicle.

“I’ve always been intrigued with the idea of doing a show about people who were off the grid and living and working in a gray zone,” Lorre says. “This lined up with what I was thinking of doing, which was a character who is certainly not playing by the rules. He’s not paying taxes. He’s not somebody that has got a nine to five job.”

Max/Warner Bros. TV

In “Bookie,” Maniscalco plays Danny, a bookie who knows his career may be over once California legalizes sports betting. (“That resonated with me too, because I can’t help but think that I might also be in a dying profession,” Lorre quips.) Omar J. Dorsey plays Ray, his best friend and enforcer. Jorge Garcia, Andrea Anders and Vanessa Ferlito also star.

For Bakay, who as a betting expert has been seen on ESPN and elsewhere, it was important to get it right and call out the stereotypes of the business. “The common misperception of broken legs, leaving all this sort of carnage in their wake, that is really counterproductive to running this business,” he says. “It’s a very interesting line of work. Who you trust, to do good for the money they bet. Putting pressure on people is part of it, but ultimately, the last thing you want to do is set a fire that calls attention to what you’re doing for a living.”

“Bookie” doesn’t shy away from the dangers of betting — the very first scene features an A-list cameo, as that star plays a gambling addict who is seen being thrown out of his house after his debts impact his family.

“I am fascinated by things like addiction, and recovery was very much a part of ‘Mom’ and the characters in this world,” Lorre says. “Nick and I met quite a few, all throughout the process. We’re talking to bookies all over the country. They’re a breed apart. I learned I have no business doing that.”