Beetmash
Docs > Beet > Guides > Utility Ai

Utility AI

Beet currently supports a very simple form of Utility AI.

You can create your own score providers, see the implementation of ScoreProvider or SteerScoreProvider for examples.

ScoreFlow

The ScoreFlow action is an example of a Request / Response mechanism. It sends RequestScore to each child and will only select one when it has received an OnChildScore from every single child. This example requests a score from two children and runs the second one, returning RunResult::Success

main.rs
world.spawn(ScoreFlow)
.with_children(|parent| {
parent.spawn((
ScoreProvider::new(0.4),
EndOnRun::failure()
));
parent.spawn((
ScoreProvider::new(0.6),
EndOnRun::success()
));
})