pathfinding with dynamic obstacles

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

    i know there were a topics like this,

    but i can precise my needs more exactly then my predecessors.

    Im working on the game in which

    the player is moving around with his avatar,

    in top-down view.

    There are some enemies, and when they see avatar

    (line of obstacle) they follow him.

    Making enemies find path to hero beetween static obstacles

    like walls etc. is easy. But how to make them avoid each other?

    They are dynamic, so when they colide, there is a need

    to stop them, regenerate obstacles map, refind paths and

    once again put them in the motion. This should be simple,

    and good-working with few enemies, right?

    It's not. The reason is that the enemies are copies of the same

    instance - and when we try to regenerate map for enemy to make

    it avoid other enemies, it sees itself as obstacle. Then he blocks,

    or starts moving in funny ways. So here is my question - how to make

    instance not see itself as obstacle, but see as obstacles other instances of same object? Is there any way?

    PS

    I know someone is gonna to put here link about steering behaviors.

    Its not gonna work with this type of game, and i think its very hard to implement in construct made game.

    Im sure that it can be done better with regenerating map after collision.

  • Same question for me!

  • Same question too

  • I think you can select the objects you want to not affect pathfinding, move them out of the layout boundary (as pathfinding only checks inside the boundary of the layout), regenerate the obstacle map, then move them back.

    I haven't tried it yet, but it seems like it should work.

  • The problem I ran into with regenerating the obstacle map is that it is not optimized for moving objects. So it chugs through everything, even objects that have been in the same place forever, and it causes a little pause in your game that's noticeable.

    However, placing such objects outside of the layout may just work like Arima said. It's worth a shot.

    The only real issue I see even with using a properly optimized obstacle map is that your enemies will consistently move in odd directions to avoid each other while moving, or not move at all.

    So you would need to make them move only a bit at a time.

    For instance, say you have two enemies, one behind another in a back alley, with only room wide enough for one enemy.

    If they both use pathfinding to get to the player, both set to avoid colliding with other enemies, the one closest to the player will continue to move towards the player as expected, however, the one behind the enemy is now blocked from access to his destination, and will not move.

    It's extremely tricky in C2. I had to abandon one project for now because I simply don't have the experience in pathfinding enough to overcome these obstacles, and because the pathfinding plugin isn't quite up to par when you have any dynamic obstacles.

  • Yeah, pathfinding is a very difficult thing to get working in all circumstances properly if objects aren't allowed to overlap. It's on Ashley's todo list to make it so user-defined areas can be updated on the obstacles map rather than the whole thing at once, so that should help, but I don't know when it will be implemented.

  • Do you mean something like this:

    http://www.red3d.com/cwr/steer/LeaderFollow.html (more examples here)

    I've been struggling with obstacle avoidance too, I think it's clear that the pathing behaviour is really not designed to be used with with dynamic/moving objects.

  • Based what I have seen on real, released games during years. If you'll make nice working solution, there will be a lot companies willing to buy your code.   <img src="smileys/smiley38.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Pathfinding will help determine the destination, but you also need to figure out a steering behaviour that will avoid any obstacles that popup before you get there (which there is no plugin/behaviour for).

    Subscribe to Construct videos now
  • Yeah, it would be awesome to have a plugin to do something like the technique listed on this page: http://gamma.cs.unc.edu/DenseCrowds/

    However, it probably can't happen until webCL becomes a standard.

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