x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I make AI have less impact on performance?

Hello,

I have created a basic AI (This one -> UE4 Wiki). 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

alt text

Product Version: Not Selected
Tags:
more ▼

asked May 17 '15 at 04:26 PM in Everything Else

avatar image

ERuts
471 16 25 39

avatar image undercover May 17 '15 at 04:31 PM

What does your behavior tree look like or is it the one in the tutorial?

avatar image ERuts May 17 '15 at 04:38 PM

Exactly the same as in the tutorial

avatar image undercover May 17 '15 at 05:20 PM

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.

avatar image ERuts May 17 '15 at 05:27 PM

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

avatar image undercover May 17 '15 at 05:46 PM

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.

avatar image ERuts May 17 '15 at 05:53 PM

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.

avatar image undercover May 17 '15 at 07:21 PM

What is does is that it prints some kind of call trace log in the console output.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered May 25 '15 at 12:49 PM

avatar image

MieszkoZ STAFF
7.3k 223 57 412

avatar image John Alcatraz Jul 19 '15 at 01:09 AM

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 :)

avatar image Slavq Jun 13 '16 at 02:54 PM

I'm also interested in this, does the CharacterMovementComponent still have that big performance impact?

avatar image aWinter Jun 24 '16 at 01:09 PM

"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.

avatar image UnexpectedSquirt Jun 24 '16 at 04:34 PM

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?

avatar image MieszkoZ STAFF Jun 24 '16 at 05:46 PM

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.

avatar image UnexpectedSquirt Jun 24 '16 at 07:34 PM

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) :/

avatar image Jeramy Cooke Feb 11 '18 at 06:18 AM

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?

avatar image Notion Feb 14 '18 at 04:11 PM

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

avatar image gurankas Oct 24 '18 at 11:09 AM

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

avatar image ColdSteel48 Apr 03 '17 at 09:33 PM

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 ?

avatar image Starkium Sep 12 '17 at 05:07 AM

I'm struggling with ai nav mesh and vr. can't even get 60 ai in without it going down to 40 fps

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question