You may not know who Shane Black is, but the odds are that you already love him. Or hate him.

That's because a goodly number of the blockbusters, actual and wannabe, that make their way into America's multiplexes every year follow a schematic that Shane Black helped engineer. Black may not have single-handedly invented the Hollywood action movie, but his scripts for the Lethal Weapon franchise have for the past few decades pretty much defined what an action movie is supposed to be.

That's a heavy cross to bear, and Black, who is too smart a cookie for the corner he's been painted into, has sometimes seemed to wither under the load. More than a few of his screenplays have seemed either half-hearted or nearly out of control, as if they were written by someone who would clearly rather be somewhere else. His nasty, overblown script for 1991's The Last Boy Scout felt like the ranting of a writer attacking his audience for being stupid enough to lap up his crap.

In his saner moments, though, Shane Black can be a formidable talent, and his new movie Kiss Kiss, Bang Bang, which he not only wrote but also produced and directed, exorcizes some old demons into one of the year's sharpest and most entertaining films. It's an awfully clever project — maybe even a touch too clever, in a smug, look-at-me sort of way — that feels a lot like Black making amends for all the cinematic junk he's been responsible for over the years.

The name alone tips you off to the fun and games (and to the fact that, should we choose to look for them, there are some actual brains behind this operation). Kiss Kiss, Bang Bang is a title lifted from a rather famous collection of writings by the late, legendary film critic Pauline Kael, who claimed that the words (which she happened to glimpse on an old Italian movie poster) succinctly summed up the basic appeal of the movies. Or as another intellectual heavyweight and film snob's dream date, Jean-Luc Godard, put it, "To make a movie, all you need is a girl and a gun."

There's a lot more to KKBB than just a girl and a gun, but everything starts from that point and spirals out in all directions. Our hero, of sorts, is Harry Lockhart (Robert Downey Jr. in his juiciest performance in years), a petty thief and all-around loser who, while frantically evading the police, stumbles into an audition for a Hollywood movie, gives all the right responses for all the wrong reasons, and winds up being flown out to L.A. for a screen test.

Since Harry is supposed to be playing a detective in his motion picture debut, the studio hooks him up with a consultant, a real-life detective named Perry van Shrike (Val Kilmer), whose sexual orientation has earned him the nearly perfect moniker of Gay Perry. Kilmer (bulked up here to near-Travolta-esque proportions) is a poker-faced treat as the stereotype-busting, pistol-packing Perry, and once he and Downey start interacting, the movie takes off big time. Like some Bizarro World reconfiguration of Mel Gibson and Danny Glover, Kilmer and Downey's odd couple act is a refreshing slap in the face of formula, almost never playing out quite like we think it should.

Kilmer is a marvelously droll straight man (pun unavoidable) to Downey's fidgety ball of nerves, and the first half-hour or so of KKBB almost completely forgoes plot in order to set these weirdly mismatched characters loose in what is essentially a wicked little satire of the Hollywood scene. Deals are struck, parties are crashed, bars hopped, and the eminently quotable quips come so thick, fast and funny that the movie sometimes seems to be channeling the Marx Brothers through the reinvented L.A. pulp of Robert Altman's The Long Goodbye.

When the plot does finally kick in it hardly matters, since Kiss Kiss, Bang Bang turns out to be modeled on those wonderfully convoluted, classic Raymond Chandler noir mysteries where even the writer isn't sure who killed whom and why. Suffice to say that the dead bodies begin piling up, the frame fills with beautiful dames and hard-boiled creeps, and Downey's character, who is only playing a detective, pretends to really be one in order to help his dream girl locate her missing sister.

The scrambled plot is amplified by scrambled narration from Harry himself, who turns out to be as inept a narrator as he is a human being. Harry's voice-over guides us through action that stops and starts, backtracks and digresses, all according to the whims and failings of our easily distracted narrator. It's all very smart and silly and terribly ironic, with an all-seeing meta angle (bad criminal pretending to be bad actor) that allows KKBB to simultaneously skewer and pay homage to Hollywood, while re-stitching the seams between movies and real life. As you can probably tell, the set-up isn't all that dissimilar to certain aspects of Be Cool; the difference is that Kiss Kiss, Bang Bang does it all much better.

Black seems to literally be having a blast here, riffing on genres, turning conventions inside out, piling on outrageous gag after gag, and spoofing the buddy movies and action flicks that have made him rich and famous. There are no explosions or extended car chases in KKBB, but at one point we do get a character shooting someone with his penis (don't ask), as well as a super-sized finale featuring a reluctant action hero dangling from an overpass while blasting away at scores of bad guys beneath him.

That finale is just the sort of absurdly overblown moment that might be mistaken as high drama in a "normal" Shane Black movie. In Kiss Kiss, Bang Bang, however, the scene is revealed as one more sublimely ridiculous component in a story told with a nod, a wink, and — its author happy for the moment not to be churning out Lethal Weapon 5 — almost certainly a sigh of relief.