Why do we need the index in the Blackboard?

Hi,

why do we create the next waypoint index in the blackboard?

I do not see the need for this. Instead of having the variable in the blackboard, why not creating
a private int32 in the UChooseNextWaypoint class (or blueprint) and hide all the logic here?

Are there advantages despite of the fact, that we can easily see the cycling of the index in the blackboard while playing the game?

I mean …, it makes everything a little more complex. Also we have to read/write back data
from/to the blackboard from the C++/Blueprint class which also does take some time and resources.
(And it is a possible source for errors).

Thanks in advance!

Hi,
I have got the Idea too and tried it. But when I did it the problem appeared. The editor didn’t crash at once until about half a seconds later. And I noticed that the Guard didn’t go to the first waypoint but some other waypoint instead, and then the editor crashed.
I guess it is because when I used the “Index” value inside the c++ class other than deliver the value to blackboard, the program did this :
deliver PatrolPoints[0] to NextWaypoint through WaypointKey - - succeed
Index = ++Index % PatrolPoints.Num() - - succeed
BUT the error happened next !
As the these C++ code is earlier executed than higher level things like behaviorTree , and perhaps this C++ task node executed far more times than the whole behavir tree, the new Index value was used again and again and the PatrolPoints[Index] was delivered to NextWaypoint through WaypointKey again and again. So when the behavir tree tried to do flows between task node and move to , their values changes very fast and eventually caused crash.
These above are just my guesses, and I think it is because not every part of the behavir tree is executed at the same rate or say the are not executed simultaneously.
If you have found out the real reason, please tell me. Thanks advanced.

1 Like

Did you do you guys figure it out?

I’m assuming everything runs through blackboard data first. If you try to grab the NextWaypointIndex from anywhere else you are making the code do harder work!

Privacy & Terms