Creating Elizabeth, BioShock Infinite's AI companion character, was one of the toughest challenges Irrational faced during the game's development.

The complex, eye-catching companion who partners Booker DeWitt during the course of the game was left out of early builds because Irrational's designers didn't know how to manage her, Ken Levine told Eurogamer.

As the Boston-based studio got to grips with Elizabeth, the 20-year-old woman Booker travels to the flying city of Columbia to rescue, staff repeatedly recommended she be cut from the game - but Levine resisted, setting up the Liz Squad, a team of staff from multiple disciplines charged with meeting the challenge of creating the best AI companion character since Alyx Vance from Valve's Half-Life 2.

We knew that was going to be incredibly challenging, Levine said, but the more we thought about it, either the more excited or the more terrified we got.

BioShock 1 wowed critics upon its 2007 release. While the atmospheric shooter won plaudits for the underwater city of Rapture, its main character was a silent protagonist - a cypher, as Levine describes him.

As part of his desire to challenge himself and the team, Levine decided he wanted a main character who spoke, hence Booker DeWitt. The decision to create an AI companion character was sparked by the fact that it hadn't been done well since Alyx in Half-Life 2, a game released eight years ago.

There's not a lot of great AI companions. I really think Alyx was the last one Irrational Games creative director Ken Levine

There's not a lot of great AI companions, Levine said. I really think Alyx was the last one. It's okay. People are generally okay with it - Skyrim is a great game, but their expectations are fairly low. We knew if we were going to have the player have a voice like we wanted to because we had done so many cyphers, we wanted somebody for him to interact with.

BioShock 1's iconic Big Daddy and Little Sister AI characters would prove the groundwork for Elizabeth. These wandering enemies, who could be avoided if the player so wished, were governed by complex algorithms that allowed them to interact with the world under their own steam. According to Levine, Elizabeth is an evolution of the Big Daddy and Little Sister.

The Big Daddy and the Little Sister were a very very rough prototype of that AI who is just around you in the world that you can observe, who aren't scripted, Levine said. Because most of the time when you see an AI either they're doing nothing or they're just coming at you guns blazing.

They have a bunch of behaviours. Sometimes they interact with objects off a script but you don't know where it's going to happen and you don't know when it's going to happen. You don't know if the player is going to get in the way. All those things were the very rough training grounds for Elizabeth in the sense that she had to be present and observable and not breakable. But of course the content bar for her was infinitely higher. She wasn't mute, for instance.

After deciding that BioShock Infinite would feature an AI companion, Irrational set to work creating what it hoped would be a believable, likeable character that reacted to the world around her and to the player's actions.

Elizabeth talks to the player, issues supplies, such as health and ammo, can draw supplies into the world through her special tear power, and can revive the player after death. Outside of combat, Elizabeth often comments on the world, her facial expressions reflecting her emotional state. In one sequence the player can end up in a toilet. There Elizabeth covers her mouth, desperately trying to block the awful smell.

One thing AIs generally don't do is react to what's around them, Levine said. They don't observe what's around them. They have no interest in what's around them. So we spent a lot of time making Elizabeth notice the world and react to the world and engage with the world. That was heightened by the fact she's been locked up. But even so, people are always looking at stuff. When you walk down the street you don't walk down the street like a robot, which is generally what companion AIs do.

So we had to seed the world with things she was interested in and things she could interact with. We had to seed her with various emotional states that are primarily an overlay on the animation she does. And she has sounds to go along with all of those things. Making her present in the world was one of the most difficult things and one of the most important things.

Elizabeth as she was following BioShock Infinite's 2011 reveal.

Much of BioShock Infinite's development was spent seeding the world with things for Elizabeth to do. Programmers give her her general heuristics of behaviour, but much of it is custom, built room by room by room, giving her things she can be interested in.

And then there are objects you seed with points of interest, Levine said. Because we don't know where the player is going to be or what he's going to do, Elizabeth is drawn to different things by a various set of algorithms.

An actor comes with certain software that just works. You say to an actor, come into a room. They're going to go into a room. Say, go into the room and sit down. They'll go into the room and sit down. They'll know how to do that. They'll know to do what people do, look around. Somebody goes by they'll wave at them. Somebody smokes and they might cough. There are things people do. Elizabeth has to be helped with those things. So she does all of those things because we worked very hard as a team to give her that life.

On top of the technical challenge was the challenge of creating a likeable character. This relied less on the skills of programmers and AI technicians, more on voice acting, writing and directing - Levine's speciality.

Elizabeth is voiced by Courtnee Draper, who Levine said Irrational lucked out in finding for the role. In terms of making her likeable, the challenge is you have to write her well, he said. That's hard to do. How do you make somebody likeable? You write characters and you try to make a good character you like.

But also, we determined early on making her your partner in the experience, not just an observer, her throwing you weapons and supplies, to make the player feel she is there for them, not either a burden, somebody you protect, or a parallel, like a kill-stealer, which quite a lot of AIs do. We determined right away she wasn't going to do anything the player did, that Booker and Elizabeth were going to do totally different things in the world. There's no overlap, because why should there be overlap? What's the point? Why doesn't the player do it?

One thing you notice about Elizabeth is that she doesn't get in the way. AI companions are often criticised for annoying the player, either in a spacial sense or sticking their head in the line of fire just as you're about to pull the trigger. Elizabeth doesn't do that.

It's super hard, Levine said. We have no way of knowing what the player's going to do. Liz is running behind you and you turn and want to run where she is and she's standing there - that's bad, right? So you have to think very carefully.

You have to watch player behaviour. We do a lot of observation of the player. There are a lot of little machines running Elizabeth's behaviour that work very hard to keep her out of your way, to keep her as a partner and not a hindrance.

One of the great joys of the game for me playing it is catching Elizabeth doing something interesting out of the corner of my eye

The slightly redesigned Elizabeth, as revealed by the Spike VGA 2012 trailer.

Earlier this month Irrational released a new trailer for the Spike Video Game Awards. In it fans saw a slightly re-worked Elizabeth and noticed her almost Disney-like expressiveness.

We knew right away we wanted her movements and her face to be somewhat exaggerated because quite often you observe her at a distant, Levine explained. You have to be consistent, so when you're close to her, when you're far away from her, you see her doing stuff.

One of the great joys of the game for me playing it is catching Elizabeth doing something interesting out of the corner of my eye. To make those things read sometimes you stylise them and exaggerate them.

Levine said Elizabeth's exaggerated expression and movement provides an interesting contrast with the flat Booker. The very first moment when she observes you in combat she's horrified, he said. To have that contrast between this woman who's lived this little Disney life locked in this tower like Rapunzel, and then suddenly be out in this Tarantino world - not in terms of the dialogue but it's very bloody - Booker comes from that world. He's the opposite. Troy [Baker, US voice actor] plays him very flat, intentionally. He's seen all this before and she hasn't. We really wanted to get that across. All those things play into how we created her.

Throughout development Irrational staff suggested Elizabeth should be cut from the game - this, Levine said, was similar to what had happened on BioShock 1 with the Big Daddy.

A million times during the course of the game, because it was so hard to get right, there were people who said, 'we really should cut Elizabeth.' When we started working on it, we'd do level reviews and I'd say, 'So where's Liz right now?' They'd say, 'Well, she's back in the closet over there,' Nobody knew how to manager her.

You were trying to build a level but you also have to think of this whole other thing. In most first-person shooters you don't have to think about another entity with you in the world unless they're just walking behind you and shooting.

Levine said he had to put his foot down and insist Elizabeth make it into the game. Fortunately in both cases, or unfortunately for the people who were involved, I get to say, 'No, we're doing this.'

It was really tough. We eventually had a group we called the Liz Squad, who owned her. That's a multi-disciplinary group, led by John Abercrombie, who did the AIs on BioShock 1, with me on the writing and directing side, artists and animators and the motion capture.