About performance of Behavior Designer Pro

DeVoid

New member
Hello! I recently bought Behavior Designer Pro and decided to test it, but I’m not sure if the performance I’m seeing is expected. I think I might be doing something wrong.

I have 200 very basic agents with the following setup:

1768913476161.png
1768913481677.png
1768913485643.png

This doesn’t seem great, considering the tree is extremely simple and my custom actions take no more than 0.05 ms. I have a game already in production where I use my own state machine. I have both simple and complex enemies with lots of states, and a similar number of agents consumes little to no CPU time.
1768913493176.png

Behavior Designer is amazing in terms of visuals/debugging and how easy it is to set up behaviors, but I can’t realistically use it in my next game if it uses this much CPU. Do you have any suggestions? I think I'm just doing something wrong.
 
Can you enable the deep profiler and see what is causing the bottleneck? It looks like you are using regular GameObject actions and for the absolute best performance you'll want to convert those to ECS, though I know it's not possible in all situations.

Other options include changing the Update Mode to Manual and ticking the tree at less intervals, or changing the Evaluation Type to reduce the number of tasks evaluated. Before doing those though I would first look at what is causing the bottleneck.
 
The TaskObjectSystem is responsible for the GameObject based tasks and it looks like there are a bunch of calls getting the various objects. Are you running the most recent version? I don't think there are any specific performance fixes to the TaskObjectSystem recently but it's still good to be on the latest.

If you can send a repro scene to support@opsive.com I can see if there's anything abnormal running. Reducing the task execution count will definitely help in this case.
 
The TaskObjectSystem is responsible for the GameObject based tasks and it looks like there are a bunch of calls getting the various objects. Are you running the most recent version? I don't think there are any specific performance fixes to the TaskObjectSystem recently but it's still good to be on the latest.

If you can send a repro scene to support@opsive.com I can see if there's anything abnormal running. Reducing the task execution count will definitely help in this case.
Sorry, I forgot to mention that I increased the number of agents for deep profiling to 400. Is this still a lot of calls for that many objects? I’m running version 2.1.11p2.
 
Is the conditional abort triggering? The 400 calls are likely because of the two Stacked Actions, but I would have expected only one of them to run if the conditional abort is not triggering. In any case if you can send a repro I'll have a better idea of what is going on.
 
Okay, I made a small repro project and sent it to you. I’m getting the exact same performance results as in my main project. I also set Max Evaluation Count to 1, but it doesn’t seem to make any difference.
 
Is the conditional abort triggering? The 400 calls are likely because of the two Stacked Actions, but I would have expected only one of them to run if the conditional abort is not triggering. In any case if you can send a repro I'll have a better idea of what is going on.
I downloaded the TaskObjectSystem you sent me, set Max Evaluation Count to 1, and wrote a custom updater so it doesn’t run every frame. Now I’m getting around ~0.3 ms for 400 agents. I think that’s amazing and agents still look quite responsive. I’ll probably add a distance-based updater, so agents closer to the camera update more frequently, and so on.

Do you plan to update Behavior Designer Pro with the new TaskObjectSystem?

Anyway, thank you very much for your time and quick help!
 
Can you enable the deep profiler and see what is causing the bottleneck? It looks like you are using regular GameObject actions and for the absolute best performance you'll want to convert those to ECS, though I know it's not possible in all situations.

Other options include changing the Update Mode to Manual and ticking the tree at less intervals, or changing the Evaluation Type to reduce the number of tasks evaluated. Before doing those though I would first look at what is causing the bottleneck.
Upon rereading this comment, do I understand correctly that I can use ECS/DOTS tasks on GameObject agents?
 
I downloaded the TaskObjectSystem you sent me, set Max Evaluation Count to 1, and wrote a custom updater so it doesn’t run every frame. Now I’m getting around ~0.3 ms for 400 agents. I think that’s amazing and agents still look quite responsive. I’ll probably add a distance-based updater, so agents closer to the camera update more frequently, and so on.

Do you plan to update Behavior Designer Pro with the new TaskObjectSystem?

Anyway, thank you very much for your time and quick help!
Great news. Yes, the new system will be included with the next update.

Upon rereading this comment, do I understand correctly that I can use ECS/DOTS tasks on GameObject agents?
You can if you bake them within a subscene. This is the hybrid approach recommended by Unity. I do think that your situation could be a perfect use case for entities as long as you don't require any of the underlying Unity components that are not supported by ECS.
 
Back
Top