Ellie's AI in The Last Of Us was a little on the flaky side at the best of times, with lots of immersion breaking jogs past politely oblivious enemies. Naughty Dog's Max Dyckhoff reveals that 5 months before the game shipped the studio stripped out all the AI and started over. That's right, at one point it was worse.
Remember the demo in the tilted building where Joel leaves Tess and Ellie behind to take on some infected? That wasn't a narrative choice initially. It was part of the first public demo back in January 2013 and the decision was made to keep the other characters out of the way because the AI was "unacceptable". That led to Max's involvement, moving over from enemy AI to Ellie. At the point he took over, five months before release, there was a "pretty comprehensive" AI system but as he puts it, "it wasn't where we wanted it to be".
So he decided to rebuild "core behaviors and skills" and "take everything down", effectively starting over. Combat was stripped out and just the basics were worked on with director Bruce Straley, focusing on a core strategy: "keep her close, make her useful and make her interesting".
Much of this was built on simple ideas such as how to decide where Ellie should stand: the basic mechanics decide a zone she can inhabit, then draws a series of lines between her and Joel, the direction she's looking in, and where she could potentially move to. If any of those lines hit a wall or obstacle (the red ones in the picture) then Ellie can't stand there.
Ellie: Buddy AI in The Last of Us - [GDCVault.com]