# How can I make AI have less impact on performance?

**URL:** <https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905>\
**Category:** AI\
**Tags:** logging, unreal-engine, Performance, question\
**Created:** [May 17, 2015, 4:26pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905 "2015-05-17T16:26:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![GamesByHyper\_Eric](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gamesbyhyper_eric/32/709237_2.png) [@GamesByHyper\_Eric](https://forums.unrealengine.com/u/GamesByHyper_Eric)\
**Post date:** [May 17, 2015, 4:26pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/1 "2015-05-17T16:26:45Z")

</div>

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

 ![43076-ue4_statsafterai.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/5/3f5a66a69ff31e028325f86df9a14b03ece9db67.png)

---

<div class="post-metadata">

**Author:** ![undercover](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@undercover](https://forums.unrealengine.com/u/undercover)\
**Post date:** [May 17, 2015, 4:31pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/2 "2015-05-17T16:31:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GamesByHyper\_Eric](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gamesbyhyper_eric/32/709237_2.png) [@GamesByHyper\_Eric](https://forums.unrealengine.com/u/GamesByHyper_Eric)\
**Post date:** [May 17, 2015, 4:38pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/3 "2015-05-17T16:38:39Z")

</div>

Exactly the same as in the tutorial

---

<div class="post-metadata">

**Author:** ![undercover](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@undercover](https://forums.unrealengine.com/u/undercover)\
**Post date:** [May 17, 2015, 5:20pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/4 "2015-05-17T17:20:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GamesByHyper\_Eric](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gamesbyhyper_eric/32/709237_2.png) [@GamesByHyper\_Eric](https://forums.unrealengine.com/u/GamesByHyper_Eric)\
**Post date:** [May 17, 2015, 5:27pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/5 "2015-05-17T17:27:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![undercover](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@undercover](https://forums.unrealengine.com/u/undercover)\
**Post date:** [May 17, 2015, 5:46pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/6 "2015-05-17T17:46:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GamesByHyper\_Eric](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gamesbyhyper_eric/32/709237_2.png) [@GamesByHyper\_Eric](https://forums.unrealengine.com/u/GamesByHyper_Eric)\
**Post date:** [May 17, 2015, 5:53pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/7 "2015-05-17T17:53:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![undercover](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@undercover](https://forums.unrealengine.com/u/undercover)\
**Post date:** [May 17, 2015, 7:21pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/8 "2015-05-17T19:21:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [May 25, 2015, 12:49pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/9 "2015-05-25T12:49:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![John\_Alcatraz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@John\_Alcatraz](https://forums.unrealengine.com/u/John_Alcatraz)\
**Post date:** [July 19, 2015, 1:09am UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/10 "2015-07-19T01:09:11Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Slavq](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Slavq](https://forums.unrealengine.com/u/Slavq)\
**Post date:** [June 13, 2016, 2:54pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/11 "2016-06-13T14:54:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aWinter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@aWinter](https://forums.unrealengine.com/u/aWinter)\
**Post date:** [June 24, 2016, 1:09pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/12 "2016-06-24T13:09:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![UnexpectedSquirt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnexpectedSquirt](https://forums.unrealengine.com/u/UnexpectedSquirt)\
**Post date:** [June 24, 2016, 4:34pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/13 "2016-06-24T16:34:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [June 24, 2016, 5:46pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/14 "2016-06-24T17:46:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![UnexpectedSquirt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnexpectedSquirt](https://forums.unrealengine.com/u/UnexpectedSquirt)\
**Post date:** [June 24, 2016, 7:34pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/15 "2016-06-24T19:34:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_e5d5c0bf7d300728867097ff79906dbe](https://forums.unrealengine.com/u/Anonymous_e5d5c0bf7d300728867097ff79906dbe)\
**Post date:** [April 3, 2017, 9:33pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/16 "2017-04-03T21:33:10Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Starkium](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/starkium/32/1194588_2.png) [@Starkium](https://forums.unrealengine.com/u/Starkium)\
**Post date:** [September 12, 2017, 5:07am UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/17 "2017-09-12T05:07:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a830416f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a830416f](https://forums.unrealengine.com/u/anonymous_user_a830416f)\
**Post date:** [February 11, 2018, 6:18am UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/18 "2018-02-11T06:18:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Notion](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Notion](https://forums.unrealengine.com/u/Notion)\
**Post date:** [February 14, 2018, 4:11pm UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/19 "2018-02-14T16:11:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gurankas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gurankas](https://forums.unrealengine.com/u/gurankas)\
**Post date:** [October 24, 2018, 11:09am UTC](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905/20 "2018-10-24T11:09:02Z")

</div>

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

[Next page](https://forums.unrealengine.com/t/how-can-i-make-ai-have-less-impact-on-performance/318905.md?page=2)
