Hi there gamedev community,
I'll go directly to the question.
How is the best way to handle A LOT of enemies without slowing my game process?.
I am currently testing, i have a vector of an "enemy" class, and its fine for my testing purposes. The problem is, imagine i have +3000 enemies in my map, how can i manage to execute their IA Behavior, and test who the player attacked, etc.
Im currently using a for loop from 0 to MAX_ENEMIES_IN_GAME, but with +3000 enemies my fps will drop to almost zero hahaha.
Sorry for my bad english, i'll re-write the question if needed, just ask!
Thanks
for (int j = 0; j< MOBS_EN_JUEGO; j++)
{
_mobs[j].run(_pj.getX(),_pj.getY(),&_pj); //Make the enemy walk to player position
}
EDIT: I thought something like, only test the enemies who are close to the player, but for selecting those enemies, i would have to do the same for loop, so... haha.
The only way i can think of it, its to make a bunch of 100x100 areas instead of a full map, so i can forget about the enemies that are not in the area