Make enemies avoid obstacles while chasing you

Get help using Construct 2

Post » Tue Apr 30, 2013 5:52 am

Hi everyone!

Im making a top-down shooter similar to the one in the beginners tutorial, I placed a few obstacles to make it harder for the player to get around, but I would also like the enemies to avoid those obstacles as well while chasing the player.

Im using the bullet behavior for the enemies and Im setting their angle towards Player.X and Player.Y on every tick just like in the tutorial, I also set the "Bounce off solids" option to yes, the problem is when the obstacle is too large the enemy will get stuck if the player stays at the right angle (at 180 for example), so this makes the AI not very clever.

Should I use 8-direction movement? (and how?) Or pathfinding? I heard its not a good practice to use Pathfinding if there are going to be a lot of enemies doing it, and there will be a lot of enemies at once

Any help is appreciated! Thanks!
Posts: 3
Reputation: 206

Post » Tue Apr 30, 2013 11:38 am

You should use pathfinding unless your game requires some special or more specific logic that you prefer to get down and dirty with many events.

How many enemies are going to chase the player? Pathfinding could be CPU intensive. Even many commercial First Person Shooter with more complex AI got about 10-20 bad guys chasing you at maximum. In some scenes where it's like the whole village is chasing after you, the designer simply "respawn" the dead enemies somewhere nearby. This design is more CPU friendly, and things won't be too hectic for the player.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: (use Chrome on Windows for best performance)

My sites:
Posts: 408
Reputation: 7,965

Post » Wed May 01, 2013 1:45 am

I want to make an Age of Zombies clone for the moment so Im planning to have about 30 or more enemies to chase the player at once all the time.

I honestly didnt even think about the respawning enemies tactic, I think I will use it and see how things come up. There are only going to be a few small obstacles or places where the player has a narrow movement, like a bridge, so I hope it won't be too intensive for Pathfinding.

Thank you very much, your reply certainly gave me good ideas!
Posts: 3
Reputation: 206

Return to How do I....?

Who is online

Users browsing this forum: GloryF90 and 21 guests