News Forums General Discussion Possible Bug with Random BT Node

This topic contains 12 replies, has 2 voices, and was last updated by  prime 1 month ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #34183

    Iuxeayor
    Participant

    I’m not sure if this is a Bug or a Feature, but I have a BT setup where my flying enemies use a Random node to select a new NavTarget from a selection of 6. This works perfectly fine as is.

    The problem occurs when I try to add a Constraint (without a Selector) that runs in parallel with the Random node. Basically, when the enemy sees an Asteroid, it is supposed to start shooting. I have the Detect node working properly. I want the enemy to start shooting, but to maintain course toward the random NavTarget.

    The actual problem is that when I have that Constraint added, the Random node goes haywire and keeps trying to pick a NavTarget instead of selecting one and sticking with it until success (the way it does normally).

    Does the Constraint require a Selector in order to work?
    Is there a better implementation for starting one behavior while maintaining another?

    Thanks,
    -Iuxeayor ;>

    #34186

    Iuxeayor
    Participant

    https://drive.google.com/file/d/0ByMshOYaDFucaTdfc095T1F1TDA/view?usp=sharing>

    • This reply was modified 1 month, 1 week ago by  Iuxeayor. Reason: Getting picture right
    • This reply was modified 1 month, 1 week ago by  Iuxeayor.
    • This reply was modified 1 month, 1 week ago by  Iuxeayor.
    • This reply was modified 1 month, 1 week ago by  Iuxeayor.
    #34193

    prime
    Keymaster

    How is the parallel set up? Is it set to fail on any? If so, whenever the constraint fails it will reset the parallel (and cause the random to reset.) I’d have to see more of the behavior tree to understand what you actually want to have happen.

    #34197

    Iuxeayor
    Participant

    Alrighty. I’m at work right now and won’t be able to get back to my project until another 6 hours or so. I will get you that information at that time. If it helps any, I left everything on the Parallel as its defaults. Repeat should be Never, I think. I will try to get you an image of the rest of the BT, as well.

    Thanks ;>

    #34342

    Iuxeayor
    Participant

    Sorry this took so long. Originally, I had Fail set to the default which was Any. I tried setting that to All and I have been experimenting, but so far, to no avail. I will get a Screenshot of my full BT shortly. ;>

    #34343

    Iuxeayor
    Participant
    #34344

    Iuxeayor
    Participant

    I think I figured it out.
    Parallel should
    Fail:All
    Succeed:Any

    Then the Constraint needs to be set to Repeat:Forever.

    I’m assuming that the Constraint was only being checked once every time a NavTarget was hit and then not again until the next one. Setting the Repeat to Forever seems to have told it to run every frame. Correct me if I’m wrong.

    Thanks,
    -Iuxeayor ;>

    #34349

    prime
    Keymaster

    Constraints are checked every frame - that’s their primary purpose. They are used to ensure that a certain condition remains true when any child nodes try to run.

    In the BT pic you posted, I don’t know what the custom action is inside the constraint in the Move Somewhere branch. Seems strange that it is set to repeat until Failure, but would be running inside a Constraint set to repeat forever.

    #34351

    Iuxeayor
    Participant

    Yeah, I didn’t name the nodes on that part of the tree because they were still in testing. The Custom Action is to fire one blast, so that when set to Repeat:Until Failure, it shoots very rapidly. Again, just a sketch as it would adopt the same branches as shooting the player once I got it to do the simple thing first.

    Based on my tests, it looks like the Constraint was only looked at once until the Random passed a Succeed. By setting it Repeat:Forever, it was tested each frame and worked the way that I wanted it to, thereby not caring whether the Random was returning Succeed or not. Should this not be the case?

    #34358

    Iuxeayor
    Participant

    Does the Visual Aspect have to completely fit inside the Visual Sensor in order for the Sensor to see it?

    #34362

    prime
    Keymaster

    Constraints are tested each frame as long as they are active, regardless of what the child nodes are doing and regardless of what you set their repeat value to. If the Constraint was not being tested, it would be because it had already run and either succeeded or failed.

    A visual aspect is a point in space - it doesn’t have any dimensions so there isn’t a notion of “completely inside”. The point is either in or out of the sensor range. The sensor does not detect the dimensions of the object that the aspect is attached to.

    #34388

    Iuxeayor
    Participant

    One last question, then. You say that the Visual Aspect is just a point in space. Does that mean that scaling the “Visual Size” doesn’t do anything to let the sensor see it if the sensor only sees the edge and not the center of the aspect?

    #34389

    prime
    Keymaster

    That is correct. Scaling the size of a Visual Aspect does not change its visibility to sensors. Sensors will only see the center of the aspect.

    You could certainly create custom sensors that behave differently from that. The VisualSensor has a TestVisibility method that determines whether an Aspect is in range. You could extend the check to include a volumetric calculation.

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.