Elements of an Anti-Hero
When I say "anti-hero" I don't just mean somebody who is a reluctant hero (like Arthur Dent or Rincewind) or a villian the audience roots for (like Freddy Krueger or Chucky). I mean a complex character who isn't comfortable being the good guy or the bad guy — a character who is conflicted. An anti-hero becomes a kind of stereotype by his active avoidance of being a stereotype.
Being an anti-hero isn't easy. It's tough to write, act, direct, and edit. Somehow the writer has to tap into the part of the human psyche that wishes we could be bad while massaging that part of our soul that has a moral/ethical imperative. The character has to do things we wish we could do while being a positive force in spite of himself. At the same time a perimeter needs to be set up showing us exactly where the character will not cross. The world the character lives in will help with boundaries. On Blake's 7, Avon could kill hundreds of faceless Federation soldiers and Mutoids, but he couldn't kill his nemesis, Servalan. He could slap her though. He could steal, but he would always find self-serving reasons not to steal the Liberator from Blake. Yes, the cool, calculating Avon seemed to have faulty logic when it came to people he actually knew, but that was what made him so believable.
A good anti-hero will push the audience just a little beyond those established boundaries from time to time to remind us that he doesn't want to be good. That's another important aspect. A hero is often self-deprecating about his nobility and heroic ways. "Aw shucks, ma'am. 'tweren't nothin'." The anti-hero doesn't want to be the savior. He doesn't want anybody to depend on him or expect him to save the day. He certainly doesn't want people to think he enjoys being a good guy! When he does do something others perceive as a Samaritan act he immediately needs to set things right by explaining his motives or being derisive about the outcome. "It has nothing to do with what's right. It has everything to do with what I need." It doesn't matter if those nearest him don't believe it.
Actually, it helps when somebody close to the anti-hero doesn't believe him. They want to believe he can be better and maybe he can be, but the audience, no matter how much they might think they want him to change, doesn't want him to be better. This is part of the emotional attachment to anti-heroes. The capacity to change is there. The will to change probably isn't. The ability to change definitely isn't. Could he change? Yes. Does he want to change? Maybe, but if he does it's for all the wrong reasons. Will he change? No. Sure, he might take a trip to the bright side, but it's more of a vacation than a move. He packed his suitcase not a U-Haul. He might go over to the dark side, but there lies madness. A skilled writer might buy the character a little redemption to get him back to neutral, but if it happens more than once the character loses his punch. A gate in the fence doesn't lend itself to the kind of boundaries you need for an anti-hero.
There are other aspects of anti-heroes that draw people to them. They are usually arrogant, with reason, that makes them seem over-confident, but capable. They are often smug or cocky, but they get by with it because they have some ability or skill that puts them above the level of other people. Computer genius, ace pilot, brilliant doctor...they can back up their claims. An offshoot of that aspect is their self knowledge. An anti-hero often has an introspective streak that may not be immediately evident until he has to come to terms with something he's done or is going to do.
The boundaries and pathos for the anti-hero are established by creating a foil for his behavior. His foil is a hero, is kind to old ladies and loves cats. The foil is an optimist who believes in change and believes the anti-hero will change. The foil often believes the anti-hero needs him in order to make the change happen. An interesting aspect of the anti-hero/hero relationship is how the anti-hero affects the hero. While the hero believes in changing the anti-hero, the hero is often the one who does the unthinkable or breaks his own moral code perhaps in an attempt to "fix" the anti-hero.
Creating an anti-hero is more art than science. Simply following a checklist won't create a good one. I think the reason anti-heroes work so well and are so memorable on television comes down to collaboration and time.