I’m currently making an RPG game which will be released on mobile platforms at first, so performance is a big consideration. It’s a survival RPG and there should be many enemies. I’m currently implementing this with CharacterController and pathfinding using the free version of A*. And it works really well - the enemies avoid obstacles and surround the player, much like in Diablo 2 and 3. The problem comes when I have more than 50 enemies or so - the performance drops to 10 fps or so and I really want to support more than 100 enemies.
I have tried the following solution:
- Instead of CharacterController I added just a Sphere or Capsule collider
- Also a RigidBody component, Kinematic checked
- Still using the A* pathfinding and moving the objects with transform.Translate
It works good and the performance difference is huge. However:
- The enemies don’t collide with each other, which means they will form a perfect line when following the player or stay on top of each other when they attack him. The player still collides with them, which is good.
- Once they all bunch up on top of each other, frame rate drops below 5 fps, but I think this will go away once I figure out the local avoidance.
So here is why I’m posting this. I saw that there is Local Avoidance in the Pro version of A*. Is it well suited for such a project? Basically, I need to have enemy behavior like in Diablo 2/3 or any other RPG game for that matter. The second important thing is support for 100-200 enemies on a mobile device.