How to implement enemy Ai taking different paths

0 favourites
  • 5 posts
From the Asset Store
Enemy turtles pack including fifteen fully animated variations
  • Hi i have been struggling with creating the best path system for my game. The game is 4 directional and I basically spawn like 20 enemies and i want them to all search for their own path to the player. The issue with the standard pathfinding is they all take the same path , even when i give them different spawn points they all end up walking the same way.

    The methods i already tried are waypoints, i made 4 waypoints and pinned them to the player and made the enemies randomly pick a waypoint. My issue with the waypoints are that the random event picks the same waypoint a lot and then sometimes the enemy will walk past the player to get to the waypoint(which i can stop with an invisible sprite ) but most importantly all the enemies can’t get to the waypoint because they’ll just line up.

    So i tried to use easystar. Js i might be using it wrong but my issue with that is for some reason the enemies stop moving at random times unless i move the player and they don’t all take different paths like in the example i seen they seem to all group together .

    I’m looking for alternative ways to make enemies take different ways to get to the player, if two enemies go to his left side and then two above him and below and then the right then they all surround that would be ideal

  • Bump!

  • There is a pacman clone template called eat em all

    editor.construct.net

  • Hello is there any other suggestions or examples?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If all your enemies are taking the same path, is it still the best path for each enemy?

    If there is a shorter path and they're still taking the long way around with the rest of your instances, there is something wrong with your events.

    If you want them not to take the best path because another instance is already taking that path, you can pathfind for each enemy in sequence. Upon the first one finding a path, create invisible helper objects at each waypoint of that path and add cost to those objects, and regenerate the map. Then pathfind for the next enemy, ect.

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