Spielerando

Behavior tree

How a computer-controlled character decides what to do: a tree of options in order of importance, checked every frame. Each frame it writes down what it tried and what came of it, so your AI can show you that record as proof of why the guard did what it did.

When you need it

For enemies, guards, pets and townsfolk that should react to what happens, drop one job for a more urgent one, and pick it up again later.

Say this to your AI

Use the behavior tree from Spielerando for my guard: chase the player when seen, otherwise walk the route, and show me the record of what it decided.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

Settings

Your AI gets the code

The finished code and math come through the Spielerando connection, so your AI can use them right away. Connect your AI

Common questions

how do i make enemy ai in my game

List what the enemy may do, the most important thing first: attack if close, chase if it sees you, otherwise patrol. Every frame the enemy goes down the list and does the first thing that fits.

why did my enemy do that

Ask your AI for the record of that frame. It lists every option the enemy tried, in order, and whether each one worked, so the reason can be read directly.

how does an enemy stop what it is doing when it sees the player

The options are checked from the top every frame. As soon as a more important one fits, it takes over, and the job below it is stopped and can clean up after itself.