5th week, How to make the simple behaviour tree with the code


Hi guys, 

until today, We made the enemy characters with a new design.

        

Yeap! We have most characters now.

And We made the enemy AI with the below explains.

and continue from the previous devlog, I am gonna talk about how to reduce IF-ELSE statements. 

It is very important to avoid the spaghetti code.  most SW Engineers try to avoid the spaghetti code to improve their code quality.

The Quest to avoid Spaghetti Code | by Ryan Wallace | Medium

(Commonly, it shows why SW engineers didn't love the visual script)

We are just 2 guys indie game development team. one guy lives in LA. another guy lives in Seoul. 
(IMOH, Leap Kang who lives Seoul is the greatest animator and pixel artist in my experience. His portfolio : https://www.artstation.com/kangsihyun )

We always try to reduce the budget.  Most AI plugins' price is expensive.  and we want to manage the code easier. 

first, Let's think about Behaviour Tree.  Simply, BT has 3 big components. 

1. Blackboard: Parameters
2. Selector: It is like IF-ELSE. to find the fit condition.
3. Sequence: Tasks

and other major parts are "Wait for something to finish" and "Cancel"
- If we got multiple tasks at the same time, it is horrible.  these parts are very important to fix the code.

in the last post, We talk new C# Pattern Matching statement.

We guess it makes the code simple. 

And next problem is blocking the calling during executing the other code block.
We use the UniTask (https://github.com/Cysharp/UniTask )
When we test it, It works well.



Let's see how to make the task simple. 

Move -> Wait for reach or interrupt the Task -> Change status. 
and the animation control component has played the animation with the current status.

We have to torch the AI part to remove the bugs now :)
See you next post!

Leave a comment

Log in with itch.io to leave a comment.