Repository navigation
Behavior Tree for modelling entity behavior
Marko Koschak edited this page Oct 2, 2026
·
4 revisions
Korge-fleks offers a very flexible way to model entity behavior with Behavior Trees.
[...]
For saving some time to write BehaviorTree classes and also to make that process less error prone it is possible to use live templates in Intellij IDEA. Just open in Intellij Settings -> Live Templates. In the list choose Kotlin and press the + button at the top of the list box. Fill in below mentioned fields:
- Abbreviation:
behaviortree - Description:
Creates a new BehaviorTree Blueprint data class for a Korge-fleks game - Template text:
import com.github.quillraven.fleks.Entity
import com.github.quillraven.fleks.World
import korlibs.korge.fleks.entity.behavior.BTNode
import korlibs.korge.fleks.entity.behavior.BehaviorStorage
import korlibs.korge.fleks.entity.behavior.SequenceNode
class $BTREE_CONFIG$(
override val name: String,
// private val ...
) : BehaviorTreeBlueprint() {
// Blackboard for the behavior tree -- it needs to be set up each time when calling update
override val btree: BTNode = SequenceNode(
)
override fun World.updateBlackboard(entity: Entity) {
// Setup blackboard
}
init {
BehaviorStorage.register(this)
}
}Then click on Define and choose Kotlin from the drop-down menu. Finally press the Apply button to save the changes.
Korge-fleks framework by jobe-m is based on Korge Game Engine and Fleks Entity Component System