How do I use properly the pathfinding behavior in this case?

Get help using Construct 2

Post » Wed Jan 11, 2017 9:52 pm

Do you guys have any tips for me?
I'm trying to make a flying bot that pursue the player and kill it. It's a platform game.
I made a test and it works, but i'm not sure that's the best way.

In the test, i'm updating the bot path every 0.2s, since the destination (the player) is constantly moving. But the bot movements are still kind of strange. It's not smooth.

And, of course, to make the bot movement more realistic, I was trying to put some sine too.. but looks like it conflicts with the pathfinding movement, causing even more problems.
B
20
S
4
Posts: 385
Reputation: 2,270

Post » Thu Jan 12, 2017 10:55 am

Every time you recalculate the path, the object will want to stop (or at least slow down) whilst recalculation takes place. Try performing path updates less frequently, for a start. Also, when the object's view of the player is unobstructed by pathfinding blockers, there's no need to use the pathfinding anymore - you can start to use more dynamic movements instead.

And yeah, I'd disable the sine behaviour for now until the basic movements are working.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Thu Jan 12, 2017 5:01 pm

mrtumbles wrote:Every time you recalculate the path, the object will want to stop (or at least slow down) whilst recalculation takes place. Try performing path updates less frequently, for a start. Also, when the object's view of the player is unobstructed by pathfinding blockers, there's no need to use the pathfinding anymore - you can start to use more dynamic movements instead.

And yeah, I'd disable the sine behaviour for now until the basic movements are working.

Yeah, I've tried that, but it cause bugs too..
I think I've found a good solution, but I'm having problems to make this work. Instead of using the "move along path", I want to use a lerp to make the bot travel through the nodes. There is the expressions "NodeXAt" and "NodeYAt", but I couldn't make what I want.

Can someone help me with this?
B
20
S
4
Posts: 385
Reputation: 2,270

Post » Fri Jan 13, 2017 2:34 pm

Bump!
B
20
S
4
Posts: 385
Reputation: 2,270

Post » Fri Jan 13, 2017 3:37 pm

They way I've handled this is...might seem a bit of an overkill, but in my particular situation it worked fine. I have a pather object, which has the pathfinding behaviour - seperate from the real object I want to move. When I want to go someplace, the pather objects goes in that direction(NOTE: it is invisible and moves quite faster than the actual Object), updating its path frequently, and also leaving numbered nodes (set a var to nodes.cout + 1) on its trail on every now & then. Then I make the actual object follow the nodes (by updating its position by some pixels) always picking the lowest Node No, and destryoing each upon colliding with them. This way the pather can stop on every update, but as long as the actual object does not go faster than the pather, it would move quite smoothly.

Hope this makes sense.

CHeers
B
18
S
3
Posts: 65
Reputation: 994

Post » Fri Jan 13, 2017 3:39 pm

P.S. By nodes I mean a custom sprite (and invisible in runtime) object I created for this purpose, not hte actual pathfinding node.
B
18
S
3
Posts: 65
Reputation: 994

Post » Sun Jan 15, 2017 9:25 pm

TheWindmiller wrote:They way I've handled this is...might seem a bit of an overkill, but in my particular situation it worked fine. I have a pather object, which has the pathfinding behaviour - seperate from the real object I want to move. When I want to go someplace, the pather objects goes in that direction(NOTE: it is invisible and moves quite faster than the actual Object), updating its path frequently, and also leaving numbered nodes (set a var to nodes.cout + 1) on its trail on every now & then. Then I make the actual object follow the nodes (by updating its position by some pixels) always picking the lowest Node No, and destryoing each upon colliding with them. This way the pather can stop on every update, but as long as the actual object does not go faster than the pather, it would move quite smoothly.

Hope this makes sense.

CHeers

Ha! Thank you for the answer, it helped a lot!
B
20
S
4
Posts: 385
Reputation: 2,270


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo and 24 guests