“This Is the End” is a bawdy, marijuana-scented inside joke about the Apocalypse happening during James Franco’s star-studded house party, with Franco, Seth Rogen, Jonah Hill, Jay Baruchel, Danny McBride, Craig Robinson, Michael Cera, and others playing themselves. If you don’t recognize those names, or if you haven’t seen the bawdy, marijuana-scented comedies they’ve made (often directed or produced by Judd Apatow), then the effects of “This Is the End” will be muted for you. Much of the humor stems from the actors’ exaggerated versions of their public personas (except for Cera, who decided to go the complete opposite direction and play a coke-snorting ladykiller), and from our knowledge that these guys have all worked together before in various combinations and presumably have ongoing friendships.

Those friendships are the basis of the story. Baruchel comes to L.A. to visit his old buddy Rogen, who takes him to Franco’s party even though Baruchel doesn’t know that crowd very well and doesn’t feel comfortable with them. Then the world starts to end — like, book of Revelation, it’s the Rapture, everybody panic, that kind of end. (The special effects are remarkably detailed for a comedy. I’ve seen straightforward horror films that didn’t have creatures as good as these.) An enormous sinkhole opens in Franco’s front yard, reducing several of the celebrities’ appearances to cameos. The survivors barricade themselves in the house, ration out the remaining food and water, and drive each other crazy.

Rogen and his “Superbad” and “Pineapple Express” collaborator Evan Goldberg wrote and directed “This Is the End” as a team, and the film taps into the abrasively affectionate way that groups of male friends interact: the ribbing, the outright abuse, the hug-it-out reconciliations, the trash-talking, the boastful one-upmanship. Rihanna, Emma Watson, and Mindy Kaling are here to represent the fairer sex, but their contributions (though memorable) are minor. In fact, when one of them shows up at the boys’ club, their frantic concern about how to behave around her only makes things worse.

There are plenty of laughs in McBride’s belligerent selfishness, in Franco’s weird devotion to Rogen, in Hill’s obsequious efforts to be nice to everyone (which I suspect are a Cera-like about-face from reality), and in Robinson’s smooth, soft-spoken cowardice. I like that Baruchel and Rogen’s friendship is at the center of it, even when the world is literally crumbling around them. The juvenile ribaldry flies fast and furious within the group, as fans of “Knocked Up” and “Eastbound and Down” would expect, culminating in a finale as bizarre and whacked-out as I’ve seen in a while. They’re swinging for the fences here.

My only major complaint is that this culminating doesn’t happen faster. The film’s premise is paper-thin, after all, and the story takes place almost entirely in one closed location with a small group of people. Fun is fun, but enough is enough — and 107 minutes is too much. A movie like this already runs the risk of being viewed as self-congratulatory and indulgent. It isn’t, miraculously — but not knowing when to call it quits starts to tip it dangerously in that direction.