content: 
  ===Writing===
  The episode was written by series co-creators David Benioff and D. B. Weiss.
  "Battle of the Bastards" was written by the series' creators, David Benioff and D. B. Weiss. Elements of the episode are based on the sixth novel in the ''A Song of Ice and Fire'' series, ''The Winds of Winter'', which author George R. R. Martin hoped to complete before the sixth season aired. In an "Inside the Episode" segment published by HBO shortly after the episode aired, Benioff and Weiss said that the final battle was primarily inspired by the Battle of Cannae and the American Civil War. According to Weiss, "We went back to the Roman fight against the Carthaginians in the Battle of Cannae where the Romans got caught in an encirclement by Hannibal and just slaughtered to the man. We used that as our model". Benioff said, "The 'Battle of the Bastards' becomes incredibly compact. All these men, all these combatants, crammed into this incredibly tight space on the battlefield. You read accounts of the battles in the Civil War where the bodies were piled so thick it was actually an obstruction on the battlefield". Episode director Miguel Sapochnik said in an interview that the Battle of Agincourt was the original inspiration but the concept was adapted to fit budgetary constraints.
  Weiss said that they wanted to depict a full-fledged battle, "From the beginning we knew that one thing we'd never had on the show was a true medieval pitched battle where two sides bring all the forces they can into play in some battlefield that's somehow negotiated or agreed upon and they go at each other until one of them wins and the other one loses. This is a staple of human history, and we started to look through film samples of it. There really wasn't one that both made you feel what it was like to be there on the ground and gave you a sense of the geography of the battle." According to Benioff, they also wanted to demonstrate the role luck plays in battle, "Just to feel the kind of randomness of it where there's arrows falling from everywhere, people are getting killed, people are getting trampled by horses, and so much of it is just luck. Jon Snow is a very skilled combatant, but part of the reason he survives this battle is just he gets lucky".
  In the "Inside the Episode" featurette Benioff said about Daenerys Targaryen's transformation during the series, "I think Dany's been becoming a Targaryen ever since the beginning of Season 1". According to Weiss, "She's not her father and she's not insane and she's not a sadist, but there's a Targaryen ruthlessness that comes with even the good Targaryens". Benioff concluded, "If you're one of the lords of Westeros or one of her potential opponents in the wars to come and you get word of what happened here in Meereen, you have to be pretty nervous because this is an unprecedented threat. You've got a woman who has somehow formed an alliance where she has a Dothraki horde, a legion of Unsullied, she's got the mercenary army of the Second Sons, and she has three dragons who are now pretty close to full grown. So if she can make it all the way across the Narrow Sea and get to Westeros, who's going to stand in her way?"