I made a new thread for this instead of posting in another one with a different topic.
The issue I am having is when my ai reach there destination and huddle around their destination. The frame-rate starts to bomb depending on how many agents there are.
About the ai used. They are the same model and all use the same animation. Not a whole bunch of different models and animations to rule out this as a bottle neck.
Here is my code to spawn the ai. It is straight from the crowd navigation sample.
void CharacterDemo::SpawnZombie(const Vector3& pos, Node* jackGroup)
{
ResourceCache* cache = GetSubsystem<ResourceCache>();
SharedPtr<Node>jackNode(jackGroup->CreateChild("Jack"));
jackNode->SetScale(Vector3(0.025f, 0.025f, 0.025f));
jackNode->SetRotation(Quaternion(-90, Vector3(0, 1, 0)));
jackNode->SetPosition(pos);
AnimatedModel* modelObject2 = jackNode->CreateComponent<AnimatedModel>();
modelObject2->SetModel(cache->GetResource<Model>("Models/masterchief.mdl"));
modelObject2->ApplyMaterialList("Materials/zombie.txt");
modelObject2->SetCastShadows(false);
modelObject2->SetOccludee(true);
modelObject2->SetUpdateInvisible(false);
handBoneNodeAI = jackNode->GetChild("right_hand_marker", true);
AnimatedModel* sword = handBoneNodeAI->CreateComponent<AnimatedModel>();
sword->SetModel(cache->GetResource<Model>("Models/plasma_sword.mdl"));
sword->ApplyMaterialList("Materials/plasma_sword.txt");
jackNode->CreateComponent<AnimationController>();
// Commented this out. This may be an issue as well. Not sure how else to apply an animation.
// AnimationController* swordIdle = jackNode->CreateComponent<AnimationController>();
// swordIdle->PlayExclusive("Models/combat_sword_idle.ani", 0, false, 0.5);
Material* sentinel = cache->GetResource<Material>("Materials/zombie_armor.xml"); // Was tutorial ground material
sentinel->SetTexture(TU_MULTI, multi);
sentinel->SetTexture(TU_DETAIL, metalDirty);
sentinel->SetTexture(TU_SHIELD, plasmaShield);
//Color(0.122f, 0.537f, 0.122f, 1.0f)
sentinel->SetShaderParameter("MatDiffColor", Color(0.25f, 0.25f, 0.25f, 1.0f));
// Create a CrowdAgent component and set its height and realistic max speed/acceleration. Use default radius
CrowdAgent* agent = jackNode->CreateComponent<CrowdAgent>();
agent->SetHeight(1.0f);
agent->SetMaxSpeed(7.0f);
agent->SetMaxAccel(7.0f);
}
I have not tried weitjong idea yet.