Pathfinding Behavior does not work with Unbounded Scrolling? (solved)

0 favourites
  • 10 posts
From the Asset Store
Finding the shortest path through the cells based on the A-star algorithm
  • I was having a hard time figuring out why the pathfinding behavior for my enemies wasn't working sometimes.

    I finally realized that the pathfinding behavior does not work with Unbounded Scrolling.

    Once an object with pathfinding reaches the edge of the pre-defined layout size it stops moving (even with unbounded scrolling selected). And if the object is outside the layout boundaries it won't be able to find a path at all.

    Here is a C3P I made for testing this: dropbox.com/s/2wvpbl3g6lul808/pathfinding_boundaries.c3p

    Is this intended behavior? My game generates levels of various sizes so having the pathfinding behavior work outside the pre-defined layout is critical. Is there a way to change the layout size at runtime?

    Also, does this mean that the pathfinding behavior can NEVER move to a position less than (0,0)?

  • From the documentation:

    So yeah, the obstacle map for pathfinding is limited by layout size.

  • From the documentation:

    Ah thanks! I looked through the documentation but must have missed that bit.

    So, for my follow-up - is there a way to change the size of the layout at runtime?

  • Probably not.

    You can try this addon:

    construct.net/en/forum/extending-construct-2/addons-29/behavior-easystar-js-96215

    It works with Tilemap object, and as I understand, there size of tilemap is not limited by the layout size. There is a link to C3 version on the last page.

  • Probably not.

    Ugh... of course not. I seem to keep running into limitations with C3 that really shouldn't be...

    You can try this addon:

    https://www.construct.net/en/forum/extending-construct-2/addons-29/behavior-easystar-js-96215

    It works with Tilemap object, and as I understand, there size of tilemap is not limited by the layout size. There is a link to C3 version on the last page.

    This does look like it could help, thanks. Thing is, I really don't like using 3rd party plugins, if possible, due to lack of support. I'll try it out, and maybe I'll just have create my own pathfinding code. I don't know what it is but I seem to keep bumping into edge-cases for C3 that need unnecessary work-arounds. It's really making think I need to switch to Unity.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As noted, you can't pathfind over an unlimited area, as doing so would require an infinite amount of memory.

    You could set the layout size to the largest you'd need to use, and then implement custom scrolling boundaries within that to simulate using a smaller layout.

  • You could set the layout size to the largest you'd need to use, and then implement custom scrolling boundaries within that to simulate using a smaller layout.

    Thanks! This is what I'm going to try. But is there any chance C3 will get an update to allows us to change the Layout size at runtime? This seems like it should be basic functionality.

  • Normally you don't need to change the layout size: you can just use unbounded scrolling for an essentially infinite layout area, and then implement your own scroll limits with events. Pathfinding is a special case as it uses the layout area to determine the obstacle grid. But if you have a maximum size you know is the furthest the size will go to, presumably you can just use the same approach, but working within that maximum size.

  • C3 may have gotten an update, because you can click, say, "Layout 1" on the right (by default) pane, and then go to the left (by default) pane to look through the settings to find "Layout Size. Hope this helps!

  • Jme7 Layout size can be changed in the editor, yes. The question was about changing it in runtime, via events.

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