I have been deeply considering Irrlicht for a future project. However, after running some simple testing, I have come to the conclusion that collision detection used by the engine is extremely slow. For instance, if I open the ‘Collision’ example and replace the code used to create the three faeries with
Code: Select all
if (faerie)
{
for(int i=0;i<30;i++)
{
node = smgr->addAnimatedMeshSceneNode(faerie);
node->setPosition(core::vector3df(-150+rand()%300,0,-90));
node->setMD2Animation(scene::EMAT_RUN);
node->getMaterial(0) = material;
anim = smgr->createCollisionResponseAnimator(
selector, node, core::vector3df(30,50,30),
core::vector3df(0,-100,0), 100.0f,
core::vector3df(0,50,0));
node->addAnimator(anim);
anim->drop();
}
}
the famerate drops from 70 fps (70 is my default refresh rate) to a mere 40 fps. The collision detection is causing the drop – I have tested with and without active collision detection. Furthermore, if I add another 18 faeries complete with collision response animators the frame rate levels at 27 fps. Obviously, this is unacceptable (I am running an Athlon 2200+). 48 was the maximum number of characters I would ever be dealing with, but that does not take into account such things as projectiles, and more importantly, line of sight (the “getCollisionPoint” function used to check a line with the world is also very costly. If I were to use, say, 20 bots in a multiplayer death match game, 10 per side, then this would require 10*10 (100) line of sight calculations – using getCollisionPoint my framerate drops to around 15 fps. And this doesn’t include line-of-sight tied in with A* path finding to generate ‘flanking’ paths.).
Is there a reason for this slow collision detection? Are there any plans to improve it? Have others faced this problem?
Now, I know that the Quake 3 engine is an expensive, professional piece of middleware, but those of you who have played Call of Duty might notice that at some points during play hundreds of characters exist in a level at one time. How does one deal with situations such as this?