I 've got the need to put about 50 pedestrian entities on an exterior scene, for the base ai entity i use the character class blueprint and a custom ai class that inerith from the base ai controller class, the class of ai got a simple task
get a random point and walk to that point, i’ve got a timer that check if has passed a certain ammount of time, if it is true then get another random point to walk to and reset the timer.
this simple task impact on the frame rate between 10-15 frame per second.
Is there something i should know about?
I’m sure it is not the number of triangles because the models have 3 lod wich the smallest has about 800 triangles
and when i detach the ai from the character class the counter regain those 10-15 frames.
A late recommendation. I use hundred of AI controlled NPC´s with behavior tree and perceptions. To make this to work without network and server performance hit, some actions have to be taken.
- Use NPC trigger volume, telling players are around, and enable/disable AI accordingly.
- Enable/Disable AI with SpawnDefaultController/Unposses.
- Hide disabled NPC´s.
- Enable/Disable ticks for NPC and all it´s components.
- Set NPC mesh draw distance.
- Consider to disable dedicated server tick´s and set tick interval to other then zero.
- Sometimes you may have a low rate timer to replicate values instead of movement replication.
- Let client do calculation along with server for smooth effect, server correct client with low replication rate. i.e. a ship increase/decrease speed according to +/- difference from server.