It’s appropriate that Ben Affleck’s second directorial effort is being released by Warner Bros., because if you strip away the automatic weapons and modern cars, it’s a story that might have been told in one of that studio’s gangster movies of the forties, even though it’s based on a recent novel. “The Town” focuses on Doug MacRay (Affleck), the smart, handsome member of a Boston quartet of bank robbers, and once a promising hockey prospect—a part that might once have been taken by Clark Gable. The other major player on the team is reckless loose cannon James Coughlin (Jeremy Renner), an ex-con who did nine years in the slammer for killing a guy who was after Doug. Moreover, his family took Doug in after his mother disappeared and his dad went to prison, so they’re virtually brothers; and Coughlin’s sister, barfly and drug courier Krista (Blake Lively), isn’t just in love with Doug—she has a daughter that might be his child. Just think of somebody like George Raft, of even Jimmy Cagney, in Renner’s role.

The plot per se kicks in during the gang’s latest heist, in which James goes berserk and not only brutalizes the assistant manager but briefly takes his boss, Claire Keesey (Rebecca Hall), hostage, releasing her after a short time. But then he worries that she might be able to identify him, and talks of dealing with her. So chivalrous Doug offers to make contact with her and see if she’s really a danger to them. Naturally he falls for her, and vice versa, leading to a tiff between Doug and James over his plan to change careers and ditch crime for true love.

But that’s not all. There’s a hard-nosed FBI agent (Jon Hamm—the character might once have been played by somebody like Franchot Tone) who’ll use every instrument at his disposal, including Claire and Krista, to take Doug and his associates down. And a neighborhood crime boss—a florist no less, named Fergie (Pete Postlethwaite)—who gets a cut of every take. And Doug’s incarcerated father (Chris Cooper), who’s indomitably gruff even after years in the clink. You can cast those roles from a slew of old studio contract players. William Demarest, anyone?

This is really an old-fashioned tale, despite the addition of firearms that represent a considerable advance on tommy-guns, SWAT teams and fast-moving black SUVs. But in a way that’s the charm of “The Town.” It’s basically melodramatic pulp that breathes the spirit of an earlier time, its narrative of a brooding young man trying to escape his past essentially a replay of the “every time I try to get out, they pull me back in” business that was hoary even when it was used in “The Godfather II.” But the scenario retains its hold.

That’s especially the case because Affleck and his cohorts have mounted it well. The writer-director does a good job in the central role, even if he’s unable to bring enough sympathy to the character to make us yearn for him to get away; his redemption, frankly, comes at too little cost. (And he seems remarkably unaffected by a bullet that he takes—unless I’m mistaken—toward the close.) Renner certainly has the manic quality of Coughlin down. Hamm is fine as the straight-arrow with a darker side. Postlethwaite oozes emaciated malevolence. Cooper makes the most of his single scene. And while this is essentially a man’s movie, Hall is a convincingly vulnerable damsel in distress, and Lively does the skanky bit to a T.

What gives the picture a special feel, though, is the makers’ obvious relish in employing the Boston area to the utmost. The local lingo gets heavy play, to the extent that the meaning might occasionally escape you; but it often gives a richness to dialogue that, quite honestly, is frequently pretty weak (Affleck has a monologue, for example, that should have been rewritten). There are many—perhaps too many—establishing shots of the red-brick Charlestown neighborhood (though they’re nicely photographed by Robert Elswit); but an exciting car chase through its thin, maze-like streets is an action highlight (helped by Dylan Tichenor’s crisp editing). The capper is the final robbery of the counting-room at none other than Fenway Park, which doesn’t efface memories of Kubrick’s more clever, fastidiously staged race-track robbery of “The Killing” but is solid also-ran. (A question, though: in an age when everyone pays with plastic, would there be this much cash on hand?)

“The Town” doesn’t match Affleck’s first film, “Gone Baby Gone,” in emotional depth or impact. But as an old-school movie about an old-school culture, it’s pretty good.