Godot Limbo AI Conditions

Godot Limbo AI Conditions

This article is all about Godot and LimboAI Behavior Tree Conditions. In previous articles I went over the basics of behavior trees and how to create a simple game with them.

If you haven't read the previous article you can check it out here:

You can check out the game here:

Behavior Tree Conditions

Conditions are a type of node that can be used to check the state of the game or the AI. They are used to determine if an action should be taken.

extends BTCondition

@export var target_var := &"target"

func _tick(delta: float) -> Status:
	var target: CharacterBody2D = blackboard.get_var(target_var, null)
	if target == null:
		return FAILURE
	return SUCCESS
  • First it extends from BTCondition as opposed to BTAction like a normal task would.
  • Then it exports a variable target_var which is the key in the blackboard that the condition will check.
  • If it has a target on the blackboard it will return SUCCESS otherwise it will return FAILURE.
  • It makes it easy to check if you have a target or not in your sequences.

Conditions typically don’t take multiple ticks to finish and return either SUCCESS or FAILURE immediately.

So in my case I have two sequences, a Wander sequence and an Attack sequence.

  • The Wander sequence will only run if there is no target.
  • The Attack sequence will only run if there is a target.

Conclusion

Conditions are a great way to check the state of the game or the AI. They are used to determine if an action should be taken.

Links


More Articles

Creating a Confirm Dialog in React and Tailwind CSS

Creating a Confirm Dialog in React and Tailwind CSS

In this article we will go over how to create a confirm dialog with React and Tailwind CSS.

Creating a Dynamic RESTful API Using Express and Sequelize

Creating a Dynamic RESTful API Using Express and Sequelize

What an API is, what it means to be RESTful, and how to implement these using Node.js.

Beginner SQL Tutorial

Beginner SQL Tutorial

In this article we will go over how to use SQL.


Newsletter

Stay up to date with the latest articles, tutorials, and news.