It’s nearly impossible to quantify the ways in which HBO’s “Game of Thrones” has reinvented the fantasy genre on television. Now in its fifth season, the HBO juggernaut has garnered massive ratings and millions of fans worldwide. There’s truly something for everyone, with death, romance, sex, family feuds, epic battles, and a trio of fire-breathing dragons.

But back in 2005, screenwriters David Benioff and D.B. Weiss were a pair of untested showrunners who’d fallen in love with George R.R. Martin’s epic series. They pitched themselves to the novelist over a lengthy lunch at Hollywood’s Palm that stretched out into dinner. When they passed his pop quiz — correctly answering “Who is Jon Snow’s mother?”— they won the right to convert the novels into a TV series.

Yet their road from fans to filmmakers wasn’t always a smooth one. Here, they recount their crash course in bringing the famously long novels — the shortest one clocks in at just under 1,000 pages — to the screen.

These books were considered unproduceable. Why did you think you could do the impossible?

David Benioff: It’s like that thing when somebody says something you would rather not hear. You hear it, but you don’t really process it. You just kind of skate right over that part that runs counter to your wishes.

We thought fantasy is the most successful genre in the world. If you look at the huge franchises of the last decade or two, whether it’s “Lord of the Rings” or “Harry Potter,” those movies are all built for a younger audience. (George R.R. Martin’s) books were so adult, not just in terms of the sexuality and the violence but the themes — the idea that it’s not about the conflict of good and evil. You might look at the Starks as being the noble family and the Lannisters as being the more sinister family, but Tyrion Lannister (played in the series by Peter Dinklage) is probably the most popular character, and the Starks make a huge number of mistakes. Catelyn Stark (Michelle Fairley), the beloved matriarch, is consumed with her hatred for this poor kid Jon Snow (Kit Harington), who has done nothing wrong to her. He’s just, unfortunately for him, born a bastard.

The more we read, the more we thought, God, if we could just get this going, we really think people would be addicted to the show in the way that we are addicted to the books.

But before you could move forward, you had to win over George R.R. Martin. What was his take on your meeting?

D.B. Weiss: I think he enjoyed the steak. (Laughs.) He sits down with anybody at any studio or any network, and they’re all going to tell him the same thing: “It’s great. We love your work. We think you’re a genius.”

I think with us, he understood that we didn’t have to fake anything. We had become instantly and genuinely obsessed with his books to the point where we knew lots and lots about the minutia of them — and then he asked us the question about Jon Snow’s parentage. Maybe if we had gotten it wrong, he would have let us do it anyway. It was still obvious that we love this, and that we wanted to do it more than anything in the world, and that we would respect it and honor it. I think getting (the answer) right probably helped. It’s crazy to think about how long ago that was, and that I can still see who was sitting where.

Yet once you sold it to HBO, things didn’t go as planned. Your first pilot had to be reshot.

Weiss: After you do this for a while, you get used to things not working the way you want them to. There’s a job you want, and you don’t get it. There’s a movie you’d like to get made, and it doesn’t get made. You become inured to it. With this, there was a fresh kind of terror that came with the idea that we might get so close to getting this done, and have it snatched away at the last possible minute.

HBO was really on the fence about whether or not they were going to let this go to series, and those were four of the longest months of both of our lives — sitting there thinking every day that this thing that was a once-in-a-lifetime opportunity that’s never going to come by again, and we f—ed it up. It would be one of those big fish stories, those one-that-got-away stories, you’d be telling for the rest of your life.

What did you learn from that failed pilot?

Benioff: God, we got everything wrong on a very basic level with the writing of it. We brought three of our friends over just to get a reaction from them. Watching them watch the pilot was a deeply humiliating, painful experience, because these are very smart individuals, and it just clearly wasn’t working for any of them on a very basic level.

At the very end of the pilot, Jaime Lannister (Nikolaj Coster-Waldau) pushes Bran (Isaac Hempstead-Wright) out the window. Jaime is lying with his sister, Cersei (Lena Headey), and none of (our friends) realized that Jaime and Cersei were brother and sister, which is a major, major plot point that we had somehow failed to establish.

Weiss: We’ve learned a lot about how information needs to flow effectively amongst a group of people. They need to be fed information, and it needs to be on this constant conveyor belt. The conveyor belt wasn’t moving fast enough, and people weren’t getting what they needed in a timely fashion. We learned how to make decisions more quickly and how to streamline that process.

How did you earn back HBO’s trust?

Weiss: Slowly.

Benioff: That first year felt very probationary. It was like, all right, these guys are probably not very good at this. Let’s see what they can do. We’ve already sunk a lot of money into this pilot. Might as well get one season out of it.

Weiss: We knew that a lot of the dysfunction that had characterized the initial process wasn’t there anymore. Everybody has a really great, warm fuzzy feeling and thinks they’re doing God’s work, and then they end up with a turd. So we had no idea whether or not we had a warm, fuzzy turd on our hands for a long time.

You’re now at a point where you’ve caught up with the books. What does that mean for the future?

Benioff: Season five is still very much within the books for the most part. The very first scene of the season and the very last scene of the season are book scenes. It’s more season six that’s going to be diverging a bit.

We’ve had a lot of conversations with George, and he makes a lot of stuff up as he’s writing it. Even while we talk to him about the ending, it doesn’t mean that that ending that he has currently conceived is going to be the ending when he eventually writes it.

Weiss: It’s like looking at a landscape and saying, “OK, there’s a mountain over there, and I know that I’m getting to that mountain.” There’s an event that’s going to happen, and I know that I’m moving in the general direction of that event, but what’s between where I’m standing now and that thing off on the horizon, I’m not totally sure. I’ll know when I get there, and then I’ll see what the terrain looks like around me and I’ll choose my path once I get closer to it. He figures a lot of this stuff as he goes. He always says he’s a gardener, not an architect.

You’ve had to make your own editing choices as you’ve made the show.

Benioff: One of the most common questions we’ll get asked is, “Why did you change this from the books?” The answer is always the same, really. It’s just because we thought it would be better for the series. Some of them are really fun characters but we already have the largest cast I think in television history and it just seems to grow every year.

The fact is, we can’t possibly have all the characters from the books. It would start to sink beneath its own weight. We have different colored index cards. We have to search for all of these weird colored cards. Each color signifies one story line.

Weiss: We have to go to the OfficeMax flagship store, the only place where they carry yellow polka-dotted index cards because we’ve run through every conceivable color.

Benioff: And at a certain point maybe the show can carry 13 separate story threads but it can’t carry 24. I don’t want to shortchange Arya because there are 15 other characters in a whole another country that we need to spend time with.

What’s been the biggest challenge of making the show?

Benioff: It’s the best job I could have ever imagined having. (But) it’s all encompassing. You’re never not working on the show. When I went on vacation with my family for three days in Palm Springs, I wasn’t on vacation in Palm Springs. Even when you’re in the pool with your kid, your head is half in Westeros. It’s impossible for it not to be.

Weiss: Being away from home for six months of the year and seeing your kids grow up on Skype all that time. I think I saw Molly walk for the first time on Skype. That’s not good.

Along the way, you’ve broken previously established rules of TV. You had huge ensemble casts, you killed off major characters…

Benioff: What if the hero dies — that was part of the original pitch.

Weiss: On some level, yeah, we did realize that wow, people are probably going to freak out when Sean Bean (Ned Stark) gets his head chopped off. I didn’t know if we knew the level at which they would freak out but we knew that if people cared about the show then the fact that the guy who was on the poster got his head chopped off would probably shock some people.

Benioff: Bad sign for Tyrion this season.

How many more seasons do you see this going?

Benioff: We’ve got a very definitive idea of how much longer it is, and we’re getting there. We’ve just started writing episodes for season six. I think we’re heading into the home stretch. Hopefully, we’ll have a clear answer soon.

We could go another four years — and we could come up with good stories — but the one thing that really got us excited when we pitched this to HBO was that this isn’t just a regular series. It’s a real story with a beginning, a middle and an end.

We know what the end is, and we’re barreling toward it. So the idea that we’re going to try and stretch it out by an extra couple years just because we’re all having a good time doing it and people are making money off it just feels like it would be a betrayal.

Weiss: It’s like sometimes you’ll be at a party, and you’re surrounded by people you love and you’re having a great time and it’s late and you’re like, “I should really go home, but man, this is a great party. I’m going to order one more beer, why not? When’s the next time I’m going to be in a party this great again?” And then you have another beer and you have a martini, and then it’s 6:30 in the morning, you’re like, “Why the f— am I still at this party?”

Benioff: You wake up ashamed and covered in your own feces.

Weiss: We want to go home before that happens.

What do you know now that you wish you had known at the beginning?

Benioff: I didn’t know anything at the beginning. I remember having a meeting on the pilot, and one HBO executive was saying, it’s really important that we get enough coverage on the scene. I didn’t know what coverage was. I was like, everyone’s talking about coverage, and I’m going to ask somebody later because if I ask now, people are going to stare at me (and think), “What the f— are you doing on this show?”

Weiss: I remember the first day we were on the set. There are 150 extras and another 100 various crew members. Every time I saw somebody like Michele Clapton, the costume designer, or somebody who I knew what she did, I just wanted to hold on to her like a life raft, because I didn’t know what any of these people did. If there had been a Terminator readout of what I was seeing, it would have been completely empty, except every once in a while the words “production designer” would pop up over somebody’s head. (Today), there would be all sorts of fun little circles and squiggles and indicators on there telling me what was going on, because I actually have some understanding of what these people are up to.

Do you ever take a step back and appreciate it?

Benioff: I think it’s hard to be too appreciative, because there is just the terror of f—ing it up still. It’s just so easy with a show like this to jump the shark at any moment. We’re getting close to the ending, and there is that huge desire to get it right.

A few years down the line, if we are ever masochistic enough to put in the DVDs and watch 70 straight hours of the show, we hope it will hold together. I think it’s hard to take that step back and be like, “We did it.” Because we haven’t done it yet.

Weiss: I think that everything starts to go to hell when you start smelling your own farts and complimenting yourself on how great they smell. We’re not going to turn into fart-smellers.