pathfinding with dynamic obstacles

Get help using Construct 2

Post » Wed May 15, 2013 1:45 am

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.
B
2
Posts: 1
Reputation: 152

Post » Mon May 27, 2013 3:44 am

Same question for me!
B
13
S
3
G
1
Posts: 60
Reputation: 1,828

Post » Tue Jan 21, 2014 10:58 pm

Same question too
B
5
S
2
G
1
Posts: 2
Reputation: 651

Post » Tue Jan 21, 2014 11:21 pm

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.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Tue Jan 21, 2014 11:42 pm

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.DatapawWolf2014-01-21 23:43:23
ImageImageImageImage
B
50
S
18
G
51
Posts: 633
Reputation: 30,021

Post » Wed Jan 22, 2014 12:32 am

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.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Wed Jan 22, 2014 12:34 am

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.
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Wed Jan 22, 2014 12:35 am

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.   
Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560

Post » Wed Jan 22, 2014 1:46 am

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).

http://www.youtube.com/watch?v=VMI2nLC7i5walspal2014-01-22 02:09:07
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Wed Jan 22, 2014 2:35 am

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.Arima2014-01-22 02:36:47
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Next

Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, Yahoo [Bot] and 20 guests