Description

There is a performance difference between spawning and placing AI into a level. This is causing issues when spawning/despawning AI actors in a large open world, where 4-5ms of frame time quickly builds up to a huge performance cost.

This was reported and tested in 4.21.1 (CL-4613538). This was reproduced in 4.20.3 (CL-4369336) and Main 4.22(CL-4691389)

Steps to Reproduce

Don't run any AI behavior that pathfinds, lets just measure the static cost of the actors existing in the world

  1. Open the UE4 Editor and create a 3rd Person Template project
  2. Make a new level and create an AI character based of the ThirdPersonBP
  3. Expand the level and place 100 AI Characters on the map
  4. Setup logic in the Level Blueprint to delete/spawn AI characters and to run the "stat uobjects" on Begin Play
  5. Play in Editor and monitor the values for C.CharMoveComp for the AI Character

or

  1. Download and open the attached project
  2. Play in Editor and use 'O' to delete all AI and 'R' to spawn 100 AI
  3. Monitor the values for C.CharMoveComp for the AI Character

Results: The InclusiveAvg/Max for the components will go from a value less than .11ms to a value thats 4 - 6ms higher

Expected: The InclusiveAvg/Max value won't change from when an AI is placed vs spawned

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-68207 in the post.

1
Login to Vote

Won't Fix
ComponentUE - AI
Affects Versions4.21.14.224.20.3
CreatedJan 9, 2019
ResolvedJan 9, 2019
UpdatedJan 9, 2019