

Systems outside the AI control which of these tasks are active at a given time, and task groups allow these systems to ask multiple characters to perform some action.
Stonehearth mods unit frame activity how to#
Ready to be executed and what relevant state it expects to change if executed, (3) and how to "run" it, i.e. how good it is, (2) how to "think" it, i.e. An action is responsible for telling the AI system (1) its "utility", i.e.
Stonehearth mods unit frame activity code#
In the code we express this by saying that the action "does" the given activity string. At its core, all the AI component does is to continuously try to perform the stonehearth:top activity.Īction - A specific implementation of an activity. the stonehearth:find_path_to_entity activity takes the entity to path to as an argument. A not-necessarily-up-to-date list of activities can be found in stonehearth/ai/a. Activities are represented as strings, conventionally in the form mod_name:verb, e.g. For example, if "get food" is an activity, "get food from stockpile", "get food from backpack", and "hunt wild animal" may all be implementations of the "get food" activity. Intelligent entities include hearthlings, enemy mobs, pets, critters, and even turrets, although the rest of this page uses "character" to refer to any of these entities.Īctivity - A behavior that can have multiple implementations. This component runs a Lua thread (a coroutine managed by the thread class), which continuously evaluates a tree of plans and executes a branch of it. Intelligent entity - An entity that has a stonehearth:ai component. Let's unpack that formal definition and map it to the terms used in the implementation: Many potential plans are typically being considered at a time, most of which are not ready to execute, or are suboptimal, and the AI constantly selects the one best plan to execute at any given time. Intelligent entities in Stonehearth run a hierarchical task network to perform activities by making, comparing, and executing plans made up of actions. They're still mostly valid, and might help you understand how the AI works with a practical/visual example. There's also the old notes about AI in this other PDF. You can find all the information from this page in this PDF.
