What does your behavior tree look like or is it the one in the tutorial?
Exactly the same as in the tutorial
Hello,
I have created a basic AI (This one ā [UE4 Wiki][1]). And as shown in the images, it has a massive impact on the performance after placing circa 30 low poly AI. How can I drasticly improve the performance?
Thank you in advance and kind regards,
Eric
With the AIcontroller the fps went from 14 to 28 fps. So still sub-optimal.
Hardware is fine
stat DumpFrame -ms=0.1 shows nothing
Just to make sure, have you isolated that itās the AI logic that is causing the performance problems? E.g. if you set the controller to the default AIController and spawn 30 of your pawns do you still experience low fps? You can also use āstat DumpFrame -ms=0.1ā from the documentation to get a better idea where the CPU time goes. It basically shows time and the call count for different methods.
Otherwise provided that your hardware is good enough it sounds like it should be reported as a bug or maybe a feature request since youāre taking the example straight from the wiki.
Iām not really sure what my be causing the issue but a drop to 28 fps sounds like there is some other problem as well apart from the AI. The default AIController does nothing basically. Still sounds very expensive though to run the behavior trees.
With risk of stating the obvious, make sure you run āstat DumpFrame -ms=0.1ā when the game is running. Otherwise I donāt know what the problem with that command would be.
How can I be sure that I ran stat DumpFrame -ms=0.1 correctly? The FPS does is not changing when stat DumpFrame -ms=0.1 is entered in the commandline wile running the game.
What is does is that it prints some kind of call trace log in the console output.
The stats on the screen clearly show that the cause of your fps drop is character movement. Iām surprised itās that much to be honest, but nonetheless thatās your cause. Thereās couple of things you might try. First of all see if you really need CharacterMovementComponent
for our AI. Itās pretty expensive, raw PawnMovementComponent is a lot cheaper (but has less features as well).
Upcoming 4.8 is shipping with ānavmesh walkingā as a optional character movement mode. This is a lot cheaper, but requires you to have navmesh on your maps, and itās quality is only as good as your navmeshās precision.
One other thing, you might want to disable overlap checks for your pawns (set GenerateOverlapEvents
to false it pawnās components). Overlap checks do show in your perf stats as well.
Cheers,
āmieszko
Hey Mieszko, you mentioned a raw āPawnMovementComponentā, sounds really interesting, but where is it? I canāt find itā¦ Profiling tells me that the Character Movement Component is taking 650ms, so itās a bit too much I think, and I donāt need many features, no jumping or anything else fancy, just being able to move from A to B and use the navmesh to find the path. I only have 300 AIs at the moment, I would like to get it smooth, and 650ms does not look smooth
Iām also interested in this, does the CharacterMovementComponent still have that big performance impact?
āthat bigā is relative to the machine its running on. It hasnāt improved really that much, I have done some extend testing on it in recent versions.
400 AIās
- Without AI: 11MS
- Without Movement: 14.5MS
- PawnMovement: 18MS
(acceptable performance, but the
quality is not suitable) - CharacterMovement: 28MS (Bad
performanceā¦) - CharacterNavmeshwalking: 27MS
(literally just as bad)
In conclusion Iām still looking for a suitable AI_Movement Solution. I hoped the MOBA AI Twitch stream would give some improvement tips in that regrads, but when I saw they just used plain character movement I quit the stream.
Thanks for these stats. Quite useful.
Iāve noticed that character movement component is just not viable for large numbers of AIs as well. Itās fine and dandy if you just want to have a couple guys running around, but for anything large scale you need an alternative.
Iāve been looking at custom variants of the āfloatingā movement component for my game , (as it is mostly underwater) but I can see it turning into abit of a rabbit hole if I want to have my pawns also walk on land , etc.
Epic, can you make a less expensive variant of character movement for large scale AI use? pretty plz?
We have an average of 200 characters at one time in Paragon, and we donāt experience huge perf hits. Using navmesh walking is the key here but it works only if thereās navmesh where AI is moving.
Yeah, thatās not gonna work for me as Iām using a custom pathing system for my underwater navigation (navmesh doesnāt work in fully 3d environments)
Is there a viable way to calculate the path (with path finding) on a separate thread and once having the path(points array I suppose) to feed it up to the AIController to narrow down the Pathfinding calculations ?
Iām struggling with ai nav mesh and vr. canāt even get 60 ai in without it going down to 40 fps
I would be very curious to see your setup that has 200 performant AI. I have stripped everything down as much as possible and 200 AI seems to cost about 8ms. Could you list out the key setup elements that allow for this performance?
I am in the same situation. 30 AIs and my game is done. An AI movement tutorial, article, even a sentence about how to go about getting 200 AIs on screen using navmesh would be great for relative newcomers like me making Twin Stick shooters etc
I am in the same situation as well. Really need to spawn around 200 AI characters roaming around the level to give the environment a crowd feel. Any guidance in this direction would be appreciated