Goal Oriented Action Planning AI Framework

Good progress! Lots of refactoring and code cleaning up done.

Planner has been completely rewritten. I’d taken a slightly wrong interpretation of the papers I’d read when researching the method, so I was constructing a graph where nodes consist of a single state Atom (e.g. HasWeapon : true). New graph build algorithm looks like


	
        FGOAPNode startNode;
	startNode.State = *aCurrentState;

	OpenNodes.Push(startNode);

	while (OpenNodes.Num() > 0)
	{
		ClosedNodes.Push(OpenNodes.Pop(false));

		FGOAPNode& workNode = ClosedNodes[ClosedNodes.Num() - 1];

		for (auto& action : controller.GetValidActionsForState(workNode.State))
		{
			if (workNode.Parent.Action != action)
			{
				FGOAPNode newNode;
				newNode.State = workNode.State;
				newNode.State = newNode.State + action->Effects;
				newNode.Parent.Action = action;
				newNode.Parent.Node = &workNode;
				OpenNodes.Push(newNode);
			}
		}
	}

This gives a graph where each node is a complete set of world state, where the state = current world state + all the effects that have led to this node. From this graph we then select any nodes that satisfy the goal state as path candidates.

Walking back up the parents from each candidate gives us a list of valid plans. Now we just have to choose which one to use.