Announcement

Collapse
No announcement yet.

Behavior Tree Documentation In Progress

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Behavior Tree Documentation In Progress

    I'm working on official behavior tree documentation right now! There's a lot to say, and I want to make sure it's clear and definitive, so I can't promise a date when it will be ready, but it's coming as soon as possible!

    Since there are now so many threads asking questions about behavior tree documentation, I thought I'd answer some of the questions in a single common place and post updates on progress as I'm able.

    First of all, note that Behavior Trees are still officially an "Experimental" feature. What that basically means is that we're still developing them heavily... i.e. changes may be frequent and significant, including new features, etc. For that reason, they're "off" by default and you have to turn them on if you want to use them.

    As for the purpose of this thread: I'm going to start by linking to some of the threads and AnswerHub questions that have significant information about Behavior Trees (both blueprint questions AND C++ questions). I might also re-post some information here, and I'll update this thread again as soon as any official documentation is available.

    Thanks!
    Daniel Broder
    Senior Gameplay Programmer
    Epic Games
    Daniel Broder
    Senior Gameplay Programmer, Epic Games

  • #2
    Awesome man. Thanks!
    |Mitchell S Lucas
    |Technical Sound Design

    |Marketplace Items
    Adaptive Binaural Wind - Demo Video
    Living Audio: Forest Critters - Demo Video

    Comment


    • #3
      So, where do we start?

      You could also do a twitch showing some stuff for us

      Comment


      • #4
        Some threads with relevant posts from various Unreal Developers:

        Behavior Tree Tutorial Post, with some Epic developer explanations about differences between UE4 Behavior Trees and standard trees. Also explains how to enable behavior trees, how to create Blackboard assets, and how to create Blueprint behavior tree nodes.
        How do you determine which Key on a Blackboard you are accessing. Includes Blueprint & C++ solution.
        UE4 Pathfinding basic AI. Includes an example behavior tree for implementing random wandering, and shows an example of how to make a Blueprint Task node.

        Some AnswerHUB Posts:
        (Some of these are fairly peripheral to the Behavior Tree issue, but they're still good AI information generally)
        How to spawn the correct AI Controller when spawning an AI Pawn
        Best method for calling animations from Behavior Trees
        Last edited by Daniel Broder; 04-03-2014, 08:29 PM.
        Daniel Broder
        Senior Gameplay Programmer, Epic Games

        Comment


        • #5
          LOL, When I posted this thread I intended to immediately follow up with some information (in addition to the links I just finally added), only to get pulled away to some other work for several hours!

          Hopefully I'll be able to add some more information tomorrow (while continuing work on the official documentation).

          FYI -- I will still be reading other threads and responding to them, so don't feel that you need to come to this thread with questions! I scan through the forums and also search for topics related to my work daily.
          Daniel Broder
          Senior Gameplay Programmer, Epic Games

          Comment


          • #6
            Originally posted by Daniel Broder View Post
            I'm working on official behavior tree documentation right now! There's a lot to say, and I want to make sure it's clear and definitive, so I can't promise a date when it will be ready, but it's coming as soon as possible!

            Since there are now so many threads asking questions about behavior tree documentation, I thought I'd answer some of the questions in a single common place and post updates on progress as I'm able.

            First of all, note that Behavior Trees are still officially an "Experimental" feature. What that basically means is that we're still developing them heavily... i.e. changes may be frequent and significant, including new features, etc. For that reason, they're "off" by default and you have to turn them on if you want to use them.

            As for the purpose of this thread: I'm going to start by linking to some of the threads and AnswerHub questions that have significant information about Behavior Trees (both blueprint questions AND C++ questions). I might also re-post some information here, and I'll update this thread again as soon as any official documentation is available.

            Thanks!
            Daniel Broder
            Senior Gameplay Programmer
            Epic Games
            + 100000000000000000000000000000000000000
            UE4 high res character modelling, rigging for facial and full body animation - HERE
            Dave Saxon/AKA Lex Luthor Channel
            Seek And Destroy Games Channel
            Our Website here.
            Download free animations here

            Comment


            • #7
              You guys are freaking awesome. I seem to be one of the people messing with BehaviorTrees at the moment
              I've run into another issue. Either my Keys are not setting, I'm not referencing my Blackboard properly, or something else is wrong here. I can't tell because DebugMessageToScreen is printing "0" from anywhere in the ReceiveTick function...and it only prints once so it doesn't seem to be looping or ticking the print function properly. Makes it hard to debug this.

              I'm trying to set a Blackboard Key from inside a class extending from BTService_BlueprintBase. Compiles fine, but Key doesn't set. Hard to debug due to issue printing.

              Thanks,

              Behavior Tree
              Click image for larger version

Name:	BehaviorTreeDetection.jpg
Views:	1
Size:	8.7 KB
ID:	1133824

              Blackboard Key
              Click image for larger version

Name:	BlackboardKeys.jpg
Views:	1
Size:	11.0 KB
ID:	1133825

              in BTService_FindAndDetectPlayer.cpp
              Code:
              void UBTService_FindAndDetectPlayer::ReceiveTick(AActor * OwnerActor, float DeltaSeconds)
              {
              	AActor * PtrToAnActor = NULL;
              	UBehaviorTreeComponent* MyComp = Super::CurrentCallOwner;
              	if (MyComp == NULL)
              	{
              		return;
              	}
              
              	for (TObjectIterator<AActor> Itr; Itr; ++Itr)
              	{
              		//any coditions on choosing which actor, such as name or other things;
              
              		if (Itr->GetName()=="PlayerDetTest")
              		{
              			//Assign your created Ptr to actual Actor in game world
              			PtrToAnActor = *Itr;
              			GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, "AM I WORKING?");  //WHY IS THIS PRINTING "0". Same result with TEXT("whatever")??
              			MyComp->GetBlackboardComponent()->SetValueAsObject(PointKey.SelectedKeyID, PtrToAnActor); //PointKey is set in the BehaviorTree to Player...I have TargetPoint named "PlayerDetTest" in level.
              			return;
              		}
              
              	}
              
              	//no actor found, return
              	if (!PtrToAnActor) return;
              }
              in .h
              Code:
              UCLASS()
              class UBTService_FindAndDetectPlayer : public UBTService_BlueprintBase
              {
              	GENERATED_UCLASS_BODY()
              
              	virtual void ReceiveTick(AActor * OwnerActor, float DeltaSeconds) OVERRIDE;
              
              	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Blackboard)
              	FBlackboardKeySelector PointKey;
              };
              Last edited by alg0801; 04-03-2014, 12:28 PM.

              Comment


              • #8
                @alg0801
                One thing I have found is the Key settings on the detail to the right in the Behavior Tree Editor unset themselves, and they all start set as the first key in the list. So, for each node in the BT Graph I need to check them that the key is set correctly in the right panel. That was one thing that hung me up, the reset sometimes when making changes in the tree.

                Also, in a BP Service, you need to make the key variable Editable, I don't know if there is any carry over to the C++ service.

                Comment


                • #9
                  Originally posted by mikepurvis View Post
                  @alg0801
                  One thing I have found is the Key settings on the detail to the right in the Behavior Tree Editor unset themselves, and they all start set as the first key in the list. So, for each node in the BT Graph I need to check them that the key is set correctly in the right panel. That was one thing that hung me up, the reset sometimes when making changes in the tree.

                  Also, in a BP Service, you need to make the key variable Editable, I don't know if there is any carry over to the C++ service.
                  It showed up in editor after I set these parameters:
                  Code:
                  UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Blackboard)
                  	FBlackboardKeySelector PointKey;
                  Code:
                  MyComp->GetBlackboardComponent()->SetValueAsObject(PointKey.SelectedKeyID, PtrToAnActor);
                  If DebugMessage wasn't printing "0" I could possibly debug it a bit better. There are many options that could be going wrong.

                  PtrToAnActor may never find my "DetPlayerTest" named object. Could be a blackboard issue in the way I am setting the key. Really unsure. Since it is printing "0" only one time from anywhere in the function I am unsure if the entire ReceiveTick function is even running. It appears to be inside the BT though...but that should make it print "0" over and over again until I stop.
                  Last edited by alg0801; 04-03-2014, 12:38 PM.

                  Comment


                  • #10
                    alg0801, I replied to your questions about your code on your original thread.
                    Daniel Broder
                    Senior Gameplay Programmer, Epic Games

                    Comment


                    • #11
                      Any update on the forthcoming documentation?

                      Comment


                      • #12
                        Yes, documentation is now being posted in first-pass form to the forums. More polish will be added soon and eventually I hope to make some nice tutorial videos (but that's a bit farther off still).

                        Go to this thread for more information on behavior tree docs. I'm declaring this thread dead. ;p
                        Daniel Broder
                        Senior Gameplay Programmer, Epic Games

                        Comment

                        Working...
                        X