Pathfinding - Overlap

Get help using Construct 2

Post » Fri Jan 22, 2016 9:03 pm

Hey there all,

Possible stupid question, so feel free to chastise if I've gotten this wrong.

I'm making a game where I attempt to get customers in a coffee shop to take a seat. Everything works, but I'm having the hardest time with the pathfinding. I was wondering if you have any general suggestions beyond just what's in the available article.

Image

If you take a look at the above, the customer (little man with orange shirt, dark skin) will attempt to find his way to the couch (there are imagepoints on the cushions). However, when I use "find path to..." and I specify those image points, he kind of just... stands next to them.

Is there a creative way to get him to get ON the couch with his own image points?

I also have some other pathfinding snafus that I'll ask about later, but this one is really puzzling me!

Thanks!
B
21
S
6
Posts: 77
Reputation: 1,445

Post » Mon Feb 01, 2016 4:02 pm

Don't mean to bump my own thread but... I'm having all kinds of pathfinding issues, and I think they're basically related to it being very hard to debug.

Is there any way to visualize the pathmap that the actors create? Or waypoints? At the moment, pathfinding is the biggest thorn in my side.

Appreciate any help you can give.
B
21
S
6
Posts: 77
Reputation: 1,445

Post » Mon Feb 01, 2016 4:14 pm

Given the fact that your game looks tile based, you might to take a look at my EasyStar behavior. It might be easier to implement in your particular case.
B
75
S
31
G
27
Posts: 1,014
Reputation: 20,763

Post » Mon Feb 01, 2016 4:23 pm

Looks like it's an A* implementation - I was thinking something like this as an overhaul.
Right now it's actually *not* tile based, believe it or not. (But it could be with an overhaul).

I'm looking at implementing something like that, considering the internal pathfinding doesn't look like it's gonna do it. Do you have any particular attribution requirements for your plugin?

Thanks for letting me know!
B
21
S
6
Posts: 77
Reputation: 1,445

Post » Mon Feb 01, 2016 4:32 pm

Even if it's not tile based per say, you could use the behavior with an invisible tilemap so you don't have to overhaul everything.

You're free to use my plugin however you see fit, I simply wrapped the excellent EasyStarJS library in a C2 behavior. That library itself is under the permissive MIT license, so go ahead and use it! ;)
B
75
S
31
G
27
Posts: 1,014
Reputation: 20,763

Post » Mon Feb 01, 2016 4:41 pm

Hey thanks, you've made my life quite a lot easier :)
I'll look into implementing this this afternoon and let you all know how it works out.
B
21
S
6
Posts: 77
Reputation: 1,445

Post » Tue Feb 02, 2016 12:58 am

Running into a few snags here.

First, there are multiple entities walking around (customers) pathfinding about. I would expect them to 'avoid' each other, and I'm not sure how to do that since they won't occupy the tilemap. Additionally, I'm not sure there's a movement behavior native to C2 that would allow the customers to actually *move* along anything :(
B
21
S
6
Posts: 77
Reputation: 1,445

Post » Tue Feb 02, 2016 1:55 am

You can "make" your customers occupy tiles by adding an obstacle to the tilemap at the customers position. If customers move, you will have to make sure the custom obstacle is removed and then added again at the new position. Don't forget that paths must be recalculated as the obstacle map changes.

rexrainbow's MoveTo is particularly useful to move sprite from one point to another. Check out this demo for inspiration on how you could use it.
B
75
S
31
G
27
Posts: 1,014
Reputation: 20,763

Post » Tue Feb 02, 2016 2:44 am

I gave that plugin a shot but it doesn't seem to want to work with current incarnation of C2.
I'm currently trying an implementation that piggybacks on the bullet behavior. I'll let you know how that goes.
B
21
S
6
Posts: 77
Reputation: 1,445

Post » Tue Feb 02, 2016 2:44 am

By the way, I really appreciate the help :)
B
21
S
6
Posts: 77
Reputation: 1,445

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests