Make enemies avoid obstacles while chasing you

0 favourites
  • 3 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • Hi everyone!

    I�m 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.

    I�m using the bullet behavior for the enemies and I�m 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 it�s 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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 want to make an Age of Zombies clone for the moment so I�m planning to have about 30 or more enemies to chase the player at once all the time.

    I honestly didn�t 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)