After the misfire of “Shark Tale” (which nonetheless scored big at the boxoffice), it’s good to see the DreamWorks CGI animation unit returning to something like form with “Madagascar,” a pleasant, periodically sharp romp about some New York zoo critters that wind up in the wild. It should please both youngsters and grownups–and, curiously, perhaps the latter even more than the former. That’s because while the littlest viewers will be amused by the slapstick action, ebullient characters and colorful backgrounds, many of them won’t catch a lot of the verbal and musical riffs, which tend to be references to pop cultural phenomena of considerable vintage. (And one wonders, for instance, how many even of the adults will understand a joke at the expense of Tom Wolfe.) But overall both groups are reasonably well served by a picture that, while it doesn’t measure up to “Shrek,” for instance, provides a pretty consistent level of inventiveness and energy.

The main character are Alex (Ben Stiller), the lion at Central Park zoo who’s filled with his own celebrity, and his pals Marty the zebra (Chris Rock), Melman the hypochondriacal giraffe (David Schwimmer) and Gloria the hippo (Jada Pinkett Smith). Marty is depressed, even when the others throw him a birthday celebration, because he dreams of life in the great African spaces. Inspired by a bunch of “Great Escape”-like penguins aiming to bust out of the place and make their way to Antarctica, Marty sneaks out one night to enjoy a brief turn on the town. But his buddies come after them and all (including the penguins, who’ve left separately) are recaptured in Grand Central Station and packed off on a ship bound for Africa. When the penguins take over the vessel, though, Alex, Marty, Melman and Gloria are accidentally dumped into the sea, winding up on the shores of Madagascar. They’re eventually adopted by a herd of singing-and-dancing lemurs headed by the oddball King Julien (Sacha Baron Cohen) and his aide-de-camp Maurice (Cedric the Entertainer), and all seems to be going reasonably well until Alex is gradually taken over by his natural urges and becomes a ravening danger to everybody, newcomer and native alike. Happily he doesn’t just gobble his chums up–his more enlightened self reemerges just in time (along with the return of the penguins, who have found Antarctica much less hospitable than they’d hoped) to save the day.

“Madagascar” is thus not much more than a premise so simple that one can imagine it having been turned into a five-minute Looney Tunes short. But the quartet of scripters have managed to flesh it out with enough gags and bits of business to justify its feature length. Alex’s swell-headedness and Marty’s exuberance can get a little tiresome at times (the lion’s shtick isn’t far from what Stiller ordinarily offers in human form, while Rock’s volubility isn’t far removed from Eddie Murphy’s donkey jive in “Shrek”), and though Melman’s whining is kept properly in the background, Gloria isn’t given anything to help her stand out at all; but to make up for the occasional pallidness of the lead quartet, the supporting figures pick up the slack. The penguins are great, and the two monkeys have some choice moments; Cohen’s Julian, with his weird accent and inflated sense of self-importance, is a scene-stealer as well, and though Cedric is stuck in straight-man mode, Andy Richter adds zest as Mort, a pint-sized member of the lemur tribe who has more than a passing resemblance to Gizmo the Gremlin. There’s even a feisty old New York lady in the early scenes modeled, it seems, after Granny of “Tweety and Sylvester” fame.

Technically the picture has a nice look, with solid character animation and stylized background art. And though it’s not a musical per se, it makes fairly good use of some oldies, particularly in the lemurs’ “I Like to Move It, Move It” number, which is repeated during the amusing final credits. The fade-out preceding the crawls, it should be noted, is nonetheless one of the script’s weakest elements. It allows for a sequel without making one seem urgently necessary.

“Madagascar” doesn’t achieve the status of an immediate classic; it’s a nice, colorful animated flick that will attract family audiences in theatres without becoming a repeat-business must, and when it wends its way to DVD and video it should become a staple. But unlike the loud, aggressive “Shark Tale,” it makes for an enjoyable trip. It’s a destination you should add to your summer moviegoing itinerary.