From time to time, Hollywood feels the need to make fun of itself. People outside the system take shots at the big machine all the time, but there is a unique pleasure in seeing Hollywood-sized dollars and connections gleefully applied to the task. “Tropic Thunder,” directed by Ben Stiller, makes use of $100 million and a strong cast for an exercise in this brand of self-deprecation. And, in the best Hollywood fashion, it puts a huge amount of effort into entertaining the hell out of its audience.

The movie-within-a-movie is a Vietnam War film shot on location, with rookie Englishman Damien Cockburn (Steve Coogan) directing a shoot filled with explosions and troublesome personalities. Action star Tugg Speedman (Ben Stiller) struggles to revive his career, while comedian Jeff Portnoy (Jack Black) battles an escalating drug habit. To make matters worse, Australian actor and “five-time Oscar winner” Kirk Lazarus (Robert Downey, Jr.) darkens his skin to play an African-American sergeant, causing problems with genuinely black rapper Alpa Chino (Brandon T. Jackson). Effects specialist Cody (Danny McBride) doesn’t help matters with his enthusiasm for explosives. Adding a final, destabilizing element is the presence of Four Leaf Tayback (Nick Nolte), who wrote the book being adapted into the movie, and insists that the actors need to immerse themselves in the reality of Vietnam if they want to capture the experience.

As in all movie situations, once they take Four Leaf Tayback’s advice, everything goes to hell, and the actors find themselves lost in the jungle. Speedman thinks the filming is still in progress, even when he’s captured by armed drug growers and held for ransom. His confused agent (Matthew McConaughey) tries to organize studio efforts to save him, while Lazarus and the rest of the actors try to decide if it’s worth risking their lives to rescue an idiot.

Fake trailers before the opening credits introduce the lead actors, and the film shoot is as over-the-top as it gets. This full-on parody can exhaust its strength if stretched too long, which the filmmakers recognize. Past the opening half-hour, after the actual making of the movie goes off the rails, “Tropic Thunder” eases up into a gentler satire focused on the actors. The prevailing tone of balls-out absurdity carries over, thankfully, even as the overt gags soften.

Some remnants of its opening parody wind up hobbling the movie, whether it’s the downright lazy “funny names” jokes or the necessity of revolving around the film shoot plotline. For the most part, however, the film navigates this difficult shift. The visuals assist considerably, with the shadows and atmosphere on some shots achieving all the humor of a longer sequence, without knocking you over the head with the joke. The camera earns smiles before the actors have to say a word.

Several scenes of the characters sitting and talking — a challenge in any comedy — succeed beautifully. These work thanks to Downey, Jr ., who provides a reliable anchor for the main group of actors, investing Lazarus with a confidence bordering on the fanatic. Black, who at first appears unnecessary, slow-burns Portnoy’s drug withdrawal marvelously. He brings his full mania to the fore precisely when the film needs the energy, rather than expending his charm early.

The supporting cast also shines. McBride follows up on his scene-stealing role in “Pineapple Express” with more of the same energy, while Nolte is fantastic. And one guest turn by an actor I won’t name should restore some of his tarnished credibility. Even the perennially inconsistent Stiller gives his best in his scenes of isolated lunacy. “Tropic Thunder” channels the particular talents of the ensemble as well as it can.

It’s evident that the filmmakers understood the limitations of its concepts and characters, and they employ the available tricks at a careful pace. The care and self-awareness is both endearing and effective. Even the near-total absence of women is more a comment on the consequences of hyper-masculine attitudes than an absent-minded omission. Calculated and resourceful, it’s a Hollywood product to the bone, but “Tropic Thunder” succeeds by being smarter than most loud, dumb comedies about being a loud, dumb comedy. In turning the guns on themselves, the actors and filmmakers don’t forget what Hollywood does best.