Anyone did a pathfinder without colision?

0 favourites
  • 14 posts
From the Asset Store
In this template the music plays without looping in your game
  • Hi, i need a pathfinder which will not have a collision without another pathfinder.

    For example 2 zombies chasing a player but the zombie should not collide or overpass ( like solid )

    Or how can i make such pathfinders ?

    Thanks

  • Do you mean they don't collide as in they avoid each other? Or take an alternate route if other zombie is already taking a route?

  • You might want to consider vector field collision avoidance. You can use it alongside existing pathfinding (if you're careful) to create the behaviour you describe.

    Read more here:

    buildnewgames.com/vector-field-collision-avoidance/

  • You may also want to look into the first capx here. I recall there was a thread asking the exact same question a few months back but I forget how that turned out. I'll try digging it up.

    Edit: has another trick you can try.

  • oosyrag

    Thank you very much

  • mrtumbles How can i do this ?

    I think that is the easy way but idk i will try it, i will come back!

  • Radulepy I would create the vector field by pre-filling an array with vectors (which are number pairs describing a 2D direction and speed of movement).

    For each zombie, find all zombies within whatever range you want them to avoid one another. For each one of these, compare its location (relative to the first zombie) to a location on the array, which will contain a vector. Add these vectors together, and apply them to the X and Y position of the first zombie, and they will all automagically avoid one another.

    For more detailed description please see the link I posted above. It describes the process far better than I can.

  • Another options is:

    Zombie is overlapping Zombie

    Pick top instance of Zombie

    Zombie: Pathfinding: Set Speed to <decreased speed>

    Might work well enough with some tweaking - although collision checks will suck if you're planning L4D/DR-style hordes

  • This question gets asked a lot and I always link to the solutions in this thread :

  • I think that is the easy way but idk i will try it, i will come back!

    I was actually asking a clarifying question. You say you don't want them to collide/overlap, which to me those are two separate things. Collide would be bouncing off each other where overlap does not. So I was asking if you wanted neither to happen and them to avoid each other in pathfinding.

    One simple thought would to be make use of the pathfinding cost. So if after one instance choose a path add cost to that path to encourage others to choose a different path.

    If your layout isn't too maze-like (not too many obstacles) I would think about ditching pathfinding behavior and make some events to avoid obstacles. Something as simple as pick nearest (obstacle) instance, if angle(player.x, player.y, obstacle.x, obstacle.y)-player.movement.angleofmovement is between -15 and 15 then alter the course could work.

    These suggestions won't make the AI look as intelligent as some of the more elaborate suggested solutions. But you may want to take that into consideration, the intelligence of your enemy, when designing the AI for it. If low intelligence or making a goofy game you can have the object change course on collision even. If this is for a zombie wouldn't you rather have it running into stuff instead of flawlessly navigating a maze-like layout?

  • mrtumbles

    Have you ever tried to make one ?

    I am not sure I can do it?

    Your idea is very inteligent but i just want a "noob" zombie to follow a man but without overlapping antoher zombie.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • mrtumbles

    Have you ever tried to make one ?

    I am not sure I can do it?

    Your idea is very inteligent but i just want a "noob" zombie to follow a man but without overlapping antoher zombie.

    Got it guys

    THANK YOU!

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