Search Unity

Studying Behavior Trees in NPCs

Discussion in 'Game Design' started by kaukkauk87, Jan 5, 2023.

  1. kaukkauk87

    kaukkauk87

    Joined:
    Jan 5, 2023
    Posts:
    3
    I have been reading publications on behavior trees in NPCs. One thing I couldn't find out is how to measure how good a behavior tree in an NPC. Do we have parameters to measure the quality of a BT? How can we tell one BT is better than another?
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    Not sure what you mean. If it does what you want then it's good. If it doesn't do what you want then it's not good.
     
  3. kaukkauk87

    kaukkauk87

    Joined:
    Jan 5, 2023
    Posts:
    3
    That is what I thought. I am exploring if there is a way to measure how good a behavior tree is.
     
  4. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    Does it accomplish the gameplay goal? Thats good

    Is it easy for you to understand the code, and fix it quickly when there is bugs? That is good

    If you change code elsewhere in the project, does it break something in the BT? That's not good

    Do behavior decisions trigger from events whenever possible, instead of polling on tick? Thats good

    It's possible to make entire game with bad code, and then you can test out the thign that is really important - the game. Is it fun? Does it accomplish what you had in mind?

    Easier to refactor bad code and turn it into good code than it is to write perfect code from nothing. And I dont think its possible to understand what is good until you've wrote all the bad stuff first.
     
    angrypenguin and kaukkauk87 like this.
  5. kaukkauk87

    kaukkauk87

    Joined:
    Jan 5, 2023
    Posts:
    3
    I agree with you.
     
  6. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Is it easy for a gameplay designer to understand and modify the BT to get results they want?

    Is the BT's code fast enough to avoid or minimise reduction to your game's overall performance?
     
  7. Devastadus

    Devastadus

    Joined:
    Jan 27, 2015
    Posts:
    80
    What does "better" mean? i don't think it can be defined. I use behavior trees. If i make a simple low level enemy that just moves an attacks. vs a high level enemy that can dodge your shots and use flank tactics and precision aims where your going. One is more complex for sure, but it's not necessary better since they both work to the requirements of the game needs. Also say you do find a measure for it, what would that accomplish? Behavioral trees are game specific and do not necessarily would work in another game