James Marsden in Sonic the Hedgehog.

Out of the gate, Sonic the Hedgehog looks like it could be one of the year’s worst films. It’s irritating; it’s unoriginal; and it features multiple jokes about cops eating donuts, as if we haven’t heard those before.

Then Jim Carrey shows up as the villain—and almost saves the whole damn thing. Almost.

Sonic—the videogame character so beloved that his fan base rallied to have his likeness corrected after an abysmal look in the original trailer—is voiced by Ben Schwartz. While this incarnation definitely looks better than the mess Paramount Pictures first tried to get past the masses, the character is still grating. Sorry, Mr. Schwartz, but your voice is nails on a chalkboard.

A brief prelude shows Sonic being sent to Earth by a heroic owl; he’s left alone in a cave with a bag of gold rings that provide gateways to other worlds. After an encounter with Tom Wachowski, a small-town policeman (James Marsden), Sonic’s gold rings are accidentally transported to San Francisco. He must join Tom—who Sonic calls the Donut Lord, because, as I stated before, this movie’s script is screamingly unoriginal—and go on a road trip.

In pursuit is Dr. Robotnik, played by a totally game Jim Carrey, who hasn’t been this manically fun in years. Whatever stupid crap the movie has him doing doesn’t matter: Director Jeff Fowler gives the comedian permission to go off, and Carrey not only riffs away, but gets behind the character with his trademark physical acting. He gets legitimate laughs that are surprisingly offbeat, considering this is a PG-rated kids’ film. (I especially liked his musings regarding Charlotte’s Web.)

Alas, Carrey’s role is a supporting one, and he doesn’t get nearly enough screen time to redeem the film. We are mostly left with Marsden trading one liners with Sonic, including, of course, the requisite fart jokes. If you were to guess where Tom and Sonic wind up on the road as a detour for strained laughs, a biker bar would be high on your probability list. And in that biker bar, you’d probably guess there are jokes involving mechanical bulls, line dancing, buffalo wings and bar fights. You would’ve guessed right.

There are a couple of scenes during which Sonic pulls a Quicksilver—that’s the character in X-Men who was so fast that he could rearrange people between blows in a fight. I have to think there’s an X-Men screenwriter somewhere who will be mighty pissed off after seeing some of the sequences in this movie.

Thankfully, Sonic does actually look like his videogame self now, and not some horrid concoction featuring small eyes and human teeth. This film’s script, added to the way Sonic looked in that original trailer, would’ve ensured box-office death. As things stand, the movie looks decent, which makes the dopey screenplay semi-tolerable.

Maybe some good things will come out of this. Perhaps the movie will give the talented Carrey the jump start his career needs after the ill-advised Dumb and Dumber To and his miserable dramatic turn in Dark Crimes, which nobody saw. It’s time to green-light another Ace Ventura or a sequel to The Mask. Either would be a better use of his talent than having him chasing lame-assed Sonic around.

The film leaves things open for a sequel … a sequel that will probably happen. With the distraction of an initially horrendous-looking Sonic out of the way, maybe a unified look from the start could lead to a stronger picture. There’s plenty of room for improvement.

Sonic the Hedgehog is playing at theaters across the valley.