Sci-fi movies, we all know, create unlikely heroes, and this summer's no exception.

Remember Brad Pitt as a U.N. inspector in "World War Z"? He just wanted to hang at home with his family, but he had to save the world from raging zombies. And Matt Damon in "Elysium"? He played a reformed car thief who just wanted to heal himself — and suddenly, he needed to rescue the planet.

But Simon Pegg in "The World's End," the latest work of brilliant inanity from director Edgar Wright, takes this whole reluctant-savior-of-humanity thing to a new plane. Twenty years after high school, Pegg's scruffy, unshaven, never-gonna-grow-up, substance-abusing Gary can't hold down a job. His idea of a relationship is a quick tryst in the loo of a pub. This is a guy who's gonna save us — or at least, parts of suburban England — from an alien invasion? Lord help us.

Of course, if you're a fan of Pegg's earlier two films with Wright, the 2004 "Shaun of the Dead" and the 2007 "Hot Fuzz," you'll know that such plot absurdities are not only par for the course, but crucial to the delightful sensibilities of this genre-twisting oeuvre.

Wright has called this movie the last in a trilogy, and what unites the three is that each is a sendup — though a loving one — of a genre: "Shaun" is a zombie film, "Hot Fuzz" a buddy cop movie, and "The World's End" one of those bittersweet coming-home films that show how difficult it is to really, well, go home. Because it's never the same.

We begin with a flashback: On the last day school in 1990, five mates in the nondescript village of Newton Haven attempt the Golden Mile, an epic, 12-pub crawl. But they fall short and never make it to the final watering hole, called, fittingly, "The World's End."

Flash forward 20 years, and Gary (Pegg), their onetime leader, has a plan: Rally the boys — "just like the Five Musketeers," he notes — to conquer the Golden Mile once and for all.

"It's about closure," he declares. For some reason, they all show up.

One of the film's delights is how Pegg and Nick Frost, his masterfully funny co-star in all three films, have reversed personalities since "Hot Fuzz." Whereas Pegg was an uptight, overachieving cop there and Frost the bumbling sidekick, now it's Pegg who's the bumbler — scruffy and unkempt, in a long black coat and dark shades, hilariously messed up. Frost, just as hilarious, is the pudgy, very square lawyer in thick glasses and a pressed trench coat who drinks only water on a pub crawl.

The cast of the earlier films is reunited here, along with some surprises. Paddy Considine, Martin Freeman and Eddie Marsan round out the Musketeers. There's also Sam (a lovely Rosamund Pike) — she's the sister of one of the guys, the unconsummated crush of another and a former castoff of Gary's. Gary would love to pick up where they left off — sex in the loo — but Sam isn't keen.

But something else happens in the loo. A belligerent Gary gets into a fight with a strong young man. He accidentally beheads the guy. Wait — he's a robot. Who bleeds blue ink. And has a lot of angry friends.

And the apocalypse is on. You can't go home, indeed. Not when it's being taken over by murderous aliens.

But you can have a laugh — and Pegg, Wright, Frost and company certainly give us that. The trilogy may be over, but we hope a new one is beginning. We need a lot more of these guys.

"The World's End," a Focus Features release, is rated R by the Motion Picture Association of America for "pervasive language including sexual references." Running time: 109 minutes. Three stars out of four.

NOTE: Clicking on hashtags in this stream may result in seeing adult material, such as photos or foul language, that appear elsewhere on Twitter. We do not endorse such material, but we do not have control over what items can be found in hashtag searches.