Bliss Code

Godot Limbo AI Conditions

2025-02-07
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

Ship a Game Using Godot in 2025

Ship a Game Using Godot in 2025

Settings goals to ship a game with Godot Engine in 2025.

How to Improve Your Pixel Art

How to Improve Your Pixel Art

A comprehensive guide to creating better pixel art through practice and technique.

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.