Ever see a heuristic-based pathfinding algorithm at work? It's surprisingly similar to story-planning.