beet icon indicating copy to clipboard operation
beet copied to clipboard

Planning Implementation (htn, goap etc)

Open mrchantey opened this issue 1 year ago • 1 comments

Here's a proposal for a beet-style implementation of planning algorithms.

Overview

The key to planning in Beet is to maintain a second mutable planning world, kept in sync through the replication capabilities of beet_net. This work should be in a seperate beet_plan crate.


graph TB
Behavior --> Goal1
Behavior --> Goal2

subgraph Goal Pool
Goal1
Goal2
end

subgraph Task Pool
Task1
Task2
end

Behavior[
*Planning Behavior*
ScoreFlow
Planner
]

Goal1[
*Goal 1*
ScoreProvider
GoalStatusProvider
]

Goal2[
*Goal 2*
ScoreProvider
GoalStatusProvider
]

Goals

Goals are entities that are expected to respond to two triggers:

RequestScore

Similar to the ScoreFlow, goals must trigger an OnScore for a given world state.

RequestGoalStatus

Declare whether this goal is satisfied. If so it will not be a valid option as it is already achieved.

Tasks

A Task is a behavior that contains two actions:

ScoreProvider

An action with an observer that listens for RequestScore and returns OnChildScore<BoolScore>, indicating whether this action could run given the current world state.

EffectProvider

This action will modify the Planning World, appling the expected resulting state, should its behavior run in the main world.

For instance, the task 'Go forward 10m' may set Velocity.z = -1 (m/s) in the main world, but in the planning world will set Transform.translation += 10 (m) and Time += 10 (s). Actions have no notion of whether moving was good or taking 10 seconds to do so was bad, those are determined by Goals.

Planning

todo

Plans

A plan is a list of behavior entities representing the order in which they are to be run.

References

Bevy Planners

mrchantey avatar Aug 10 '24 13:08 mrchantey

I'm a bit on the fence about this, traditional planners feel in a grey area between hand-authored techniques like behavior trees, and more modern and flexible techniques like agentic AI. Our time might be better spend researching agentic AI and implementing that, particularly now reasoning llms can conceivably be run locally.

mrchantey avatar Feb 18 '25 00:02 mrchantey