If you believe middle school to be one of the more nightmarish times of life, then Jeff Kinney could well be considered the biggest horror writer going.

As he inches toward middle age, the still boyish-looking Kinney has an uncommon appeal with the common grade-schooler, mining the quiet indignities and larger embarrassments of burgeoning adolescence for laughs, for perspective and, especially, for truth.

Through clever lines and line-drawings, Kinney created the underdog publishing phenomenon that is the “Diary of a Wimpy Kid” book series, which according to its imprint has sold more than 40 million copies since its launch four years ago. And this weekend, Kinney’s new film sequel — “Diary of a Wimpy Kid: Rodrick Rules” — threatens to challenge Hollywood’s bigger-budget bully, “Sucker Punch,” for the top spot at the box office.

It’s been a whirlwind since Kinney’s breakout in 2007, yet the author and executive producer says he was able to take on his latest project with a certain calm.

“I approached the second film with a more relaxed state of mind,” says Kinney, whose first film — 2010’s “Diary of a Wimpy Kid” — grossed $75 million globally on a modest $15 million budget. “Casting was such a big part of the first film, and we knew going into the second that we were well-armed.

“I remember meeting up with the kids in the cast in Vancouver, when we gathered for the table read. I looked at them all standing together and thought, ‘Wow, this looks like an iconic group of kids.’ We all felt pressure to deliver the goods, but we had a good script that improved during filming.”

Missing from the new film is Chloe (Grace) Moretz, who followed last year’s “Wimpy Kid” with a breakout role as a purple-haired kid ninja in the far-more-adult “Kick-Ass.” But most of the same faces have returned, including stars Zachary Gordon (who plays lead character Greg Heffley) and Robert Capron (who is Greg’s affable, unembarrassable best friend, Rowley).

“Both Robert and Zach are natural comic talents,” says Kinney this week from Los Angeles, days before the debut. “Zach has a gift for making you root for a character who doesn’t always make the best choices. Robert’s talent is a mix of charisma and expressiveness. My favorite scenes are when the two actors are together in a scene, alone. There’s a sweetness to their friendship that’s very believable.”

This time around, the script also gives more screen time to Greg’s prank-loving elder brother, Rodrick — as portrayed with smirking evil by Devon Bostick.

“Devon Bostick was a terrific find as Rodrick,” Kinney says. “He didn’t have a huge role in the first film, but he had to carry big parts of the second. My hat goes off to the casting director, who saw the potential in Devon as a comic actor with great range.”

Kinney saves his highest praise, though, for the veteran actors who play Greg’s parents. “What most surprised me on this film was the performances of Rachael Harris and Steve Zahn,” the producer says. “I can’t believe we landed who I consider to be two of the best comic actors around.”

For years before landing a publisher and then a studio deal, the Massachusetts-based Kinney worked as a designer and game developer at the online educational company Pearson — yet he still dreamed of being a cartoonist. He graduated from the University of Maryland in the early ’90s after drawing a popular campus comic, “Igdoof.” But as other cartooning alumni of the school’s newspaper, the Diamondback, began to find mainstream success — including “The Boondocks” creator Aaron McGruder and comic artist Frank Cho — Kinney struggled for that right opening. Finally, in 2006, his “Wimpy Kid” concept was discovered at New York Comic Con.

Besides his book series, Kinney would also help launch another hit in 2007: Poptropica.com, a virtual world for children that now calls itself the most popular kids’ site on the Web, with 130 million fans. Yet writing was still an act of solitude — it’s Hollywood and the soundstage that provide a communal experience.

“I think the most satisfying part about filmmaking is seeing a production in full bloom,” Kinney says. “When I write, I write in isolation. It’s very exciting to see, for example, a roller-skating rink that was built from scratch just for a single scene in the movie. It’s exciting to think that it sprang into existence from an idea.”

A foremost challenge when working with actual school-age kids, of course, is how quickly they can age out of their roles. Kinney hopes his new film will succeed well enough to warrant a full series, and he has a cinematic eye on what may be on the horizon.

“We’re laying the groundwork for a third film now,” Kinney says. “Of course, you never know if you’re going to get the green light, but if we do, we’ll be ready to go. Everyone involved with these films hopes to be able to tell as many stories as possible.

“What’s exciting is that these kids are actually the age of their characters. In fact, both Robert and Zach missed their first days of real-life middle school to shoot the first film. But the inconvenient thing about middle-school kids is that they tend to change quickly. We’re all aware of this and there is an urgency to film while the kids are the age of their characters.”

Meantime, Kinney continues to write “Wimpy Kid” books for the series’ millions of swing-set fans, and still works at the Web site that has invigorated him for so long.

“I’m keeping my day job, because Poptropica is something that really energizes me,” he says. “I’d love to create a TV series or write a film that’s not in the ‘Wimpy’ universe, but I know it will be difficult to create something from scratch.

“But I love creating good comedy for kids, so I hope to have another successful venture in the future.”