Inside the bucking Army helicopter Louis C.K. was going from nervous to terrified.

The raunchy stand-up comedian and divorced father of two who stars as a similar character on the FX comedy “Louie,” which he also writes and directs, was shooting a scene in which he takes a USO tour of Afghanistan.

“(As part of the storyline) a helicopter malfunctioned. It was easy to sit and write that at my desk, but when I had to sit in a helicopter that was bucking and chopping, it was horrible,” he says. “I hated it. I was anxious and upset but it was the best thing for the show.”

Being fearlessly “all in” — writing, starring, even enduring scary whirlybird rides — for the sake of quality has allowed a small group of showrunners to create some of today’s most critically acclaimed and original television comedies.

Besides Louis C.K., there is former “SNL” head writer and Emmy winner Tina Fey as nerdy TV sketch-show boss Liz Lemon on “30 Rock”; longtime feature film (“School of Rock”) and TV series (“Freaks and Geeks”) scribe Mike White as sidekick office drone Tyler on “Enlightened”; and indie screenwriter and actress (“Tiny Furniture”) Lena Dunham as book-smart but not boy-smart aspiring writer Hannah Horvath on “Girls.”

Not only do they write and act, they often direct and even edit one or more episodes each season.

“I like the singer-songwriter version of comedy,” says Fey, who early in her career admired comic performers who allowed their personalities to show through, even while in character. “Watching Lily Tomlin or Gilda Radner, you felt like you were seeing not just an actress cast in something but you were watching that person goof around in their own specific way.”

You get the same feeling watching one of Fey’s I-am-nerd-hear-me-roar speeches; Dunham’s awkward yet ultimately grounded responses to bizarre situations; White’s emotional repression when he should probably be screaming his head off; or Louis C.K.’s everyman blunders.

All clearly put a lot of themselves into the characters: Fey, after all, runs a comedy show, Dunham is a New York twentysomething writer, and Louis C.K. shares a name and bio with his character, but none is doing straight autobiography.

“I make much worse choices on the show, and also there are things that happen in the show never happen to me,” Louis C.K. says. “I try to show collective flaws.”

White, who has spearheaded many daring creative projects, is probably the least like his character, a beta male unlikely to lead anyone anywhere. But he says, “I am kind of neurotic, the character is obviously neurotic.”

There are pitfalls to being so closely associated with a role. When Hannah on “Girls” said she wanted to be the “voice of a generation,” that label was suddenly slapped on Dunham. It generated hand-wringing op-eds about the state of twentysomething girls’ sex lives and whether the show was ethnically inclusive enough.

The newbie showrunner, who shares exec producing credits with Judd Apatow and Jenni Konner, coped with it thanks to a trait she shares with her character. “There’s always a pretty strong feeling about who I am and what I want, which helps with the reception of the show,” Dunham says. “I try not to read every ounce of criticism but when there is a lot that’s circling around me, that feeling can help me keep moving towards my goal.”

Despite the fact that writing and starring in your own TV show can be a bit like standing naked in Times Square, none considered casting someone else. For Louis C.K. and Fey, that was because of their already-established comic personas.

Fey cracks, “My thinking was that I’m just trying to continue an ongoing scam. It’s fun to be on TV.”

She’s not so far off. All four say one reason they’re motivated to act because it’s so enjoyable.

“You write something and people are like ‘cool.’ Then they go and have fun and you get sent back to the cave to go write more stuff,” says White, whose first onscreen role came into being when the director of a feature he wrote called “Chuck & Buck” suggested he play the part of Buck O’Brien.

White had acted in plays he wrote in college, but only because he was too nervous to sit in the audience and watch. Louis C.K. earned chops as a stand-up but only got an acting coach while he was doing sitcom “Lucky Louie” for HBO. Dunham took a few acting classes as a child.

Fey has had the most schooling as a performer due to her training with improv troupe Second City. She echoes what the other writer-actors say about their on-camera skills: “The caliber of acting I do is not that challenging. I don’t think anyone is hiring me to go deep into character and be unrecognizable. I’m still supposed to bring some version of myself to it. Writing is more challenging because I continue to learn story shape and that kind of stuff. That is a lifelong learning process.”

That writing cave is where these showrunners really sweat it, but in different ways. Fey and White work with staffs. Louis C.K., with his standup career, and Dunham, with her feature-writing background, write mostly alone although both bounce ideas off colleagues.

“I’ve been doing writing and acting in tandem for so long that it’s hard to differentiate the two jobs,” says Dunham. “Writing, you solve problems that come up over a season and fit the puzzle together. It’s an acrobatic brain exercise, but there’s privacy and solitude. Acting, you solve problems on the spot and everybody’s watching the wheels in your brain work. They feed each other. The fact that I’m going to be performing helps me write something that I at least hope the actor can do.”

If the actor can’t do it, a huge benefit of being a writer-performer is you can make changes on-set — and not from a chair off by the monitors.

“Being in the scene gives you an incredible amount of insight into what is or isn’t working,” Dunham says. “You can kind of be a thermometer and take the temperature of your scene partner.”

When something doesn’t feel right, Dunham says, “we’ll introduce a little improv to give something a little more light. Also our executive producer is on set letting me know if something’s not making sense. We’ll brainstorm. I’m not married to the script.”

Louis C.K., on the other hand, makes few changes.

“I usually stay with what’s written. It’s just easier. I get the script on the set that I wrote, and I’m able to look after it. It’s like passing the ball to myself. I can’t blame anybody if I drop the ball, and I can’t blame anybody if I overthrow.”

No matter how good the passing game, some scenes are tougher to perform than expected. That helicopter ride turned out to be a lot different off the page than on it, and so can a simple argument.

White describes one such moment: “The scene was Tyler and Laura Dern’s character, Amy, in a car. She’s basically giving me a Dear John brush off. Laura got emotional and I was like, if she’s sad, Tyler’s got to be more sad. I have to step it up. By the end of the night we were both bawling. That was not how I saw the scene originally playing out. It wasn’t something I was expecting to be able to do.”

Dunham, too, has had to stretch as a performer to meet the unexpected needs of scenes she wrote.

“Especially the sex scenes. Those always are different but, at the same time, you’re like, you couldn’t quite imagine them when you were writing them. You just kind of roll with whatever they are because you’d like to be clothed as soon as possible.”

Just rolling with it is what these auteur comedy showrunners will have to do in their upcoming seasons when all will add untested elements to their shows.

In “Enlightened,” White has given Tyler a love interest played by Molly Shannon.

“I’ve had to do kissing scenes and be in my underwear,” White says.

Louis C.K. will add more seasonal arcs so that episodes are less stand-alone, and Dunham won’t shy away from incorporating the new experiences of her sudden fame into her scripts.

Expectations may be highest among fans of “30 Rock,” who want the final 13-episode season, airing this fall, to go out with a blast
. After “30 Rock” wraps, Fey, who is shooting a feature, will continue writing and performing.

“I would love to try to get another show on television because it’s so satisfying for writers,” Fey says. “It’s nice to write features but TV writers are just so much more immediate and they have so much more say in what they do. Whether or not I would be in it I don’t know. Maybe I would have it put in my contract that they have to do my hair anyway.”

So which will she keep doing longer, writing or acting?

“With acting, your face kind of gives it up for you,” she laughs.

Even with Fey soon to exit the smallscreen, at least for now, it’s likely we’re entering an era of more writer-actor led TV shows, Dunham says.

“We’re in a very oversharing time. There’s a performative aspect, everybody’s on Facebook, has a YouTube account and they upload videos of themselves singing a guitar cover of Rihanna. Not that everybody would want to do what I’m doing but there may be more people like me brewing.”

Road to the Emmys 2012: The Writer
The audacity of Knope | It’s all-in or nothing for TV’s auteurs | Aging scribes still a sticky subject for TV | Cross-cultural exchange yields hits — and misses | Showrunners can’t wait for pickup lines