Documentation: AI Tutorial

I’m complaining on a high level here, I love the quality of the documentation :wink:

In the Behavior Tree Quick Start Guide, english version:

In the screenshot of 12. Make a Task, we store the Follower_AI_CON in a branch so we don’t need to cast it on every call. However, the nodes after that use the output of the FALSE branch instead of using the GET

.

The Decorator in 13. Make a Decorator is called CloseEnough, but the code does the opposite (it is TRUE when the characters are not close enough)

Hi ,

I believe the reason for each of these is modularity. In the case of 12, the reason it is set is for use later. If you wanted to expand to include additional functionality for the task it could be used. Having said that, the immediate nodes used in the example didn’t really require it, but now those following the tutorial will have access to that additional buffer if they want to get a bit more creative! For the Decorator, you are “CloseEnough” to begin additional functionality, the branch may seem like a bit of a misnomer however the overall functionality is that once the decorator “CloseEnough” fires off you can add in functionality such as “Attack” or “capture”, etc.

Please look closely at the screenshot. From “Event Recieve Execute” follow the TRUE branch… what value is the “Pawn” input of “AI Move To”? The answer is NULL.

Actually what that says is “if Pawn != none”, which is if it does not equal Null, then it must equal AI Con as that is the reference that is made, Additionally, the task runs through the branch that, if false, checks the owning actor, casts it to AI_Con then sets the Controlled Pawn to AI_Con to prevent a NULL reference. The way this specific task is going to work is like this:

First time run: Check the value of AI_Con_Ref → returns false because AI_Con_Ref is unpopulated and therefore it does equal NULL. The false check casts the owner actor to the follower_AI_Con and if that cast succeeds (which it should or there is an error in the blueprint) it will set AI_Con_Ref to a value so that it won’t return false again. The Controlled pawn is gathered from the cast node and the blackboard value is set for the AI Move node.

Any other time the task is run: The AI_Con_Ref will return true because it no longer == null. The pawn is equally != to null because of the initial cast which set the AI_Con_Ref to a variable of type follower_AI_Con, which has access to the pawn functionality. By the time this function reaches the AI Move To, pawn should always be populated.

I know you guys have not much time, but you didn’t look at the blueprint closely. The AI Move To depends on an execution-node (the cast to) of the FALSE case, it cannot possibly work. It would be correct if the AI Move To would do a GET on the AI_Con_Ref, but it does not.
I made a test case for you:Sample Project

Here is an image with an comparison of how it should be VS the documention:

Actually, this also works and IMO it is not really well documented in the docs (there is only an hint on the node itself).
This works despite the fact that (in the TRUE case) we access an execution node of an other branch (I guess internally it’s an SET node combined with an non-execution GET node).

Hi ,

I am moving this to everything else. I have poured over the information presented and checked the documentation thoroughly. In every picture shown the logic is showing the exact same steps, the only difference is which wiring you choose to use. None of which are invalid and all retain the same exact logic as I have explained above.

Implement the solution in the documentation with print and you’ll see that you are wrong.

The pawn is equally != to null because of the initial cast which set the AI_Con_Ref to a variable of type follower_AI_Con, which has access to the pawn functionality.

This statement would be true, if the AI_Con_Ref was actually used on AI Move To - which it isn’t.

But do what you think is right, I give up.

,

Good catch! I updated the screen shots a while back to take into account changes I made to the guide, but didn’t connect the pin to the set output. I’ll get this corrected before next doc push (next week sometime).

You should be able to connect that Get Controlled Pawn to the output on the Set AI_CON_Ref node, or add a Get node for that variable.

Update:

I talked with Beach about this, because I found it odd that this works on my machine. Turns out, those output pins store their value between runs, assuming the graph isn’t cleared (like functions are). So, since this is just an event in an Event Graph, it still has a reference to the casted return value. And because the variable is set, it’s cool for it to just coast through the True portion of the branch and pull the stored reference from the “cast to” node.

That said, functionality of this could change someday as it’s a side effect of how Blueprints work, so it should connect to a variable.

The fact that you are confused too about this probably means there should be more documentation about it :slight_smile: As a programmer it doesn’t really surprise me that it works this way. But from the point of view of an end user, it’s pretty hard to see which nodes work even when the code does not flow through their execution-pins (and I hate the output of SET for that fact).