Hey guys, I've been working on a planning system for the enemies and npcs in my RPG and was hoping for some thoughts, especially if someone has tried something like this before and how well it worked.
Objective: I wanted the non-playable characters in the game to be able to map out and execute a plan given some actions they could perform and the opportunities/obstacles around them.
Jump off: I started with a STRIPS-like system where the agent picked a target (some other entity, ie: the player, an apple, a coin) and created a state of the world consisting of true/false values. Then, given some goal state similar in structure to the world state, using predefined 'actions' or 'moves' that had conditions and effects they operated on the world state until it equaled the goal state, resulting in a series of moves or a plan.
Progress: At this stage I have a working prototype but it is by no means finished, in fact each time I run it seems to get a little less robust.
Using the idea from the STRIPS system (but none of the code) I am now using a complex Noun Phrase and Verb Phrase pairing to describe the objects in the world and their values. The actions and goal states also consist of noun phrase and verb phrase statements. The noun-phrase is either specific, holding a unique id or pointer to an actual entity in the game world or a 'variable.' The variable (used only in the actions, rules, and goal states) can be used to perform a sort of first order logic, allowing conditions such as "If there is any entity that is (1) not me, (2) that is not on my team, and (3) that is still alive, then my goal is to kill that entity." The verb phrase, depending on which part of the statement its in, can either declare a property, check a property, or alter a property.
Hierarchical: The actions can either be compound, describing a condition and an effect but not specifically how the agent will perform it, or primitive, describing a condition and an effect with an executable block that performs the action in-game. This way, the agent can quickly (usually with two or three moves) determine broadly whether they can accomplish their goal or not. Once they have a broad plan, they can break it down, treating the compound actions as sub goals and solving those with more specific and primitive actions.
Biggest Foreseeable Problem: Processing power. Even using a heuristic, the system must basically check every action against every entity for every goal. This problem can be lessened by quickly skipping actions and entities that show zero promise or are not applicable.
I'll clean up my code and post links to it later if there's enough interest; it's all written in Java.