In Showtime’s new crime drama “City on a Hill,” Jackie Rohr is a cocaine-snorting, corrupt and racist F.B.I. veteran who longs for the days when the “bad men” were in power, and Decourcy Ward is a principled new assistant district attorney from Brooklyn, determined to “rip out the [expletive] up machinery” in 1990s Boston.

The characters — played with flamboyant vigor by Kevin Bacon and simmering fortitude by Aldis Hodge — shouldn’t like each other, or even be able to work together. And for much of the pilot episode, they don’t.

But one morning last April, as Bacon and Hodge filmed a scene for a later episode in Decourcy’s office — actually a set at Steiner Studios in Brooklyn — the mood was different. The characters were on good terms, maybe even kind of pals.

Decourcy shared his uneaten eggs with Jackie. (In between takes, Bacon joked about being too full to partake in the handsomely stocked craft services.) Both sported shiners on their faces but they didn’t give them to each other; Decourcy’s came from a confrontation with a church minister, Jackie’s from an “alcohol-induced haymaker” at the V.F.W. When their easy chatter was interrupted by a distressing call Jackie received on his period-appropriate oversized mobile phone, Decourcy expressed concern and moral support.