The phrase “loosely based on” has never been more appropriate than when used to refer to “Big Hero 6,” Disney’s animated family movie. Its ultimate source is a Marvel comic-book series, but Robert L. Baird and Daniel Gerson have taken the basic premise and turned it into something quite different, sweetening the tone and accentuating the humor. The result is a movie that, especially in the first half, is basically a genial, good-natured boys’ adventure; and if it stumbles somewhat in the second hour, when it becomes more derivative and action-oriented, it remains likable to the end.

This version of the title, set in a colorful amalgam of San Francisco and Tokyo called San Fransokyo, begins with fourteen-year old Hiro Hamada (voiced by Ryan Potter), an engineering whiz who graduated from high school early the year before, shunning further studies in favor of hustling competitors at underground robot-fighting meets. His parents are dead, and he lives with his Aunt Cass (Maya Rudolph), a café owner, and his older brother Tadashi (Dennis Henney), a university science student anxious to get the kid onto the right path. Tadashi brings Hiro along to the campus lab and introduces him to his fellow students GoGo (Jamie Chung), Wasabi (Damon Wayans, Jr.) and Honey Lemon (Genesis Rodriguez), as well as to Fred (T.J. Miller), a slacker hanger-on. Most importantly, however, Tadashi arranges a meeting with his mentor, the great Professor Callaghan (James Cromwell), who encourages him to audition for admission to the school.

Seized by a desire to join Tadashi’s class, Hiro invents the micro-bot, a tiny pin-shaped entity that can be ordered to join with millions of its fellows to make up whatever its master telepathically commands. Though entrepreneur Alistair Krel (Alan Tudyk) offers big bucks for the device, at Callaghan’s suggestion Hiro refuses to sell it, preferring instead to continue developing it in the university lab. Unfortunately, a fire and explosion soon destroy the place, and in the conflagration Tadashi dies.

A bereft Hiro falls into depression, lifted only by the intervention of Baymax (Scott Adsit), a puffy vinyl caregiver robot that Tadashi has been working on and had programmed to his brother’s wavelength before his death. Baymax, who looks rather like a cross between the Pillsbury Doughboy and the Michelin Man, becomes the reluctant boy’s companion, and the movie’s comic centerpiece as certainly as Robin Williams’ Genie was in “Aladdin.” But he’s very different from Disney’s earlier motor-mouth, hyperactive creation. Childishly literal and obsessively attuned to serve Hiro’s physical needs, Baymax is like a puffy nanny, tottering about on balloon-like legs when he doesn’t have to be stuffed back into his case for battery recharging. And his naivete and eagerness to please become a source of gentle amusement. The interaction between Hiro and Baymax will be the movie’s main attraction—just watch for the running gag about their fist-bumps, which remains fresh even when repeated.

So far, so good. But after fifty minute or so, “Big Hero 6” goes back to its source with the introduction of a super-villain, wearing a kabuki mask, who has gained control over Hiro’s micro-bots and is manufacturing many more. His identity and ultimate purpose are unknown, though it’s immediately suspected that he’s the greedy Krel, but his malevolent designs on the boy quickly become clear. So Hiro improves Baymax’s programming to transform him into an armored, high-flying superhero with a master’s prowess in karate. And when Tadashi’s friends show up, he uses his programming skills to give the four of them super-powers as well. With him, that makes for the titular sextet.

The key to the film’s second half is the confrontation with the unnamed villain, during which his identity and motivation are of course revealed. All of the six heroes are engaged in the fight, but the major part of it is Hiro’s collaboration with the new, improved Baymax—he’s propped on the big fellow’s shoulders as he goes through his paces, honing his talents and encouraging him to fight on. The obvious inspiration is “How to Train Your Dragon,” which “Big Hero 6” comes to resemble closely in these action-oriented segments. As a result it grows increasingly conventional, losing some of its early charm in the process. But happily enough remains to keep it aloft, though not at the altitude it once possessed.

“Big Hero 6” is blessed with attractive animation, in terms of both the characters and the backgrounds, that’s enhanced by the 3-D format rather than becoming a slave to it. The voice work is excellent, too, though frankly the females—Chung, Rodriguez and even Rudolph—come across as rather pallid compared to Miller’s Fred, Wayans’ Wasabi, Potter’s Hiro and especially Adsit’s delightful Baymax, whose singsong delivery, together with the visual rendering, proves utterly winning. The score by Henry Jackman, expanded with some pop tunes at critical points (like the inevitable montages), is by contrast fairly ordinary. But that’s hardly a serious flaw.

It doesn’t take a Nostradamus to foresee sequels on tap here, or perhaps a cable television series of the sort spun off from “Dragon.” One hopes that the offshoot will be able to preserve the cheerful mood of the first part of this movie, and not devolve further into conventional superhero mode.

In theatres, by the way, the picture is preceded by a delightfully imaginative short called “Feast,” a nearly wordless montage about a rambunctious dog that enjoys sharing meals with its bachelor owner and reacts disagreeably when the guy finds romance, but eventually comes to appreciate the new situation. It tells a simple but touching story in a few deft strokes, and provides an exceptional curtain-raiser for the feature—which doesn’t represent too much of a let-down from it.