Skip to content

GOAP Module

AHelper edited this page Aug 27, 2015 · 2 revisions

(Note, this page is being updated while the module is being designed and written, things may be wildly different in the end)

The GOAP module (Goal-Oriented Action Planner) controls the thinking process on how to get things done. Goals are created and queued up, processed, and tasks are issued.

Goals

Goals represent a high-level (could in fact be low-level, but not the lowest level) concept of something to accomplish. A goal can range from "Build a Wonder!" from the very start of a game to "transfer 3x item #149, ... from unit #X to unit #Y". A goal is made up of 4 parts that get processed in order:

  1. Requirements
  2. Child Goals
  3. Actions
  4. Results

Requirements

Goals consist of a list of requirements that must be satisfied to start resolving. Requirements are used to ensure anything needed by actions in the goal can be done. Requirements claim resources and hold them for exclusive use by actions.

Note, for now, requirements will get unclaimed when the goal gets child goals.

Note2, variable requirement needs to go kinda. VariableRequirement shouldn't change variables. Either get rid of it or change it to add utility functions to Requirements.

Child Goals

When a goal gets resolved, its requirements and checked if they can be readily claimed. Any of them that can't be claimed will be used to pick child goals. These child goals can be added and removed while the goal is being resolved (Note, I use resolve to mean 2 things, resolving the needed child goals, and running all actions and achieving the results).

Actions

Actions are low-level tasks that use generalized data for the goal to do something. These tasks can either be an action for a turtle to perform or something for the backend.

Actions use the goal's variable data to specialize what they do. For example, if you have a move action, you can use that action for moving to a unit, moving to build something, etc. by having the requirements specify these parameters.

Results

When a goal is finished, the results specify what should have changed in the system from invoking the actions. These are used to find the actions that will satisfy a certain requirement.

Variables

TODO

System

TODO

Clone this wiki locally