How do I prevent overlapping with PathFinding behavior

0 favourites
  • 6 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hello,

    I will be short this time:

    Subscribe to Construct videos now

    So, I want to show you my solution example "how to prevent objects from overlapping each other".

    I want to say a few introductory sentences that each solution to the problem must basically be based on the individual situation.

    My solution is not perfect, but it works and solves the overlapping problem.

    Briefly about my task:

    It is necessary to make an artificial model of behavior for a zombie.

    A zombie must have several states: idle, patrol (random), chase.

    The following basic behavior libraries are used in the object: Pathfinding, Solid, LineOfSight, Timer, Bullet.

    Logic

    • If the zombie does not see the player, the zombie will randomly patrol the road.
    • If a zombie sees the player, the zombie chases the player.
    • If a zombie collides with another zombie (collide or overlapping), or an object that dynamically blocks its path (eg a door), the zombie stops for a while and recalculates its further behavior with a new one.
    • *If a zombie was chasing a player and suddenly the player hides, then the zombie moves to the point where it last saw the player.
    • If zombie are blocked by another zombie (zombie in deadEnd) then zombie rotating

    *Among other things, the behavior model can be done without the Pathfinding library. Depends on your task.

    In this case, you need to understand that the zombie's behavior will also change.

  • Sorry, forgot to mention. For the sake of optimality, I did not include *.CAPX. I don't know if such a problem is relevant at all. And at the same time, I want to improve the solution a little more.

    As far as I have searched, there is little talk about it. Therefore, if I can help you, please let me know and I will share the solution.

  • For the sake of optimality, I did not include *.CAPX. I don't know if such a problem is relevant at all.

    Please share the project file! This problem is very relevant, I've seen this question asked on the forum many times.

    Here are my attempts:

    howtoconstructdemos.com/avoid-overlapping-while-moving-with-pathfinding

    howtoconstructdemos.com/prevent-multiple-enemies-with-pathfinding-from-overlapping-easystarjs

  • Try Construct 3

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

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

    Yes, I saw your solution. An elegant idea for grouping - nice. Good for RTS games.

    My solution is more oriented towards the individual behavior of one Bot.

    There are things that can be done better. If you figure out how to improve it, I'll be looking forward to your improvement. Here are my version:

    https://drive.google.com/file/d/1m89Jtg0WOIedW7up-bmr_YEBkS5bYcfb

    p.s. I'm using Construct 2. But it should import into Construct 3. Let me know if everything is ok.

  • What solution was it? The video is unavailable!

    Hello,

    I will be short this time:

    Subscribe to Construct videos now

    So, I want to show you my solution example "how to prevent objects from overlapping each other".

    I want to say a few introductory sentences that each solution to the problem must basically be based on the individual situation.

    My solution is not perfect, but it works and solves the overlapping problem.

    Briefly about my task:

    It is necessary to make an artificial model of behavior for a zombie.

    A zombie must have several states: idle, patrol (random), chase.

    The following basic behavior libraries are used in the object: Pathfinding, Solid, LineOfSight, Timer, Bullet.

    Logic

    • If the zombie does not see the player, the zombie will randomly patrol the road.
    • If a zombie sees the player, the zombie chases the player.
    • If a zombie collides with another zombie (collide or overlapping), or an object that dynamically blocks its path (eg a door), the zombie stops for a while and recalculates its further behavior with a new one.
    • *If a zombie was chasing a player and suddenly the player hides, then the zombie moves to the point where it last saw the player.
    • If zombie are blocked by another zombie (zombie in deadEnd) then zombie rotating

    *Among other things, the behavior model can be done without the Pathfinding library. Depends on your task.

    In this case, you need to understand that the zombie's behavior will also change.

  • Pathfinding in C3 now has Path Groups feature which helps to avoid overlapping with multiple moving instances.

    construct.net/en/make-games/releases/stable/r336

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