Pathfinding - Overlap

0 favourites
  • 14 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • 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.

    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!

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

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

  • 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!

  • 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!

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

  • 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

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

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

  • By the way, I really appreciate the help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem, hope you figure a way to deal with this.

  • http://i.imgur.com/XT0oYGL.png?1

    Now working. I used a recursive collision function on the bullet behavior.

    All is well! Thanks again!

  • Nice looking! You really seem to know what you're doing! Can't wait to see it all in action.

  • Well, I'm not so sure I know what I'm doing - but I like to think so

    The torches just illustrate the path and aren't normally visible.

    Again, thanks for all the help!

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