[Suggestion] Is it feasible to have 2 preset obstacle maps?

0 favourites
  • 8 posts
From the Asset Store
Obstacle Impacts and Cartoon voices, will makes your game more funny!
  • I recently found out that C2 only has one obstacle map for all the pathfinding behaviors on the layout, meaning you can't have two different objects avoiding different types of obstacles. No problem, I thought, maybe I can jerry-rig some workarounds using other behaviors, path cost, etc.

    Anyway, everything is working well enough, it's just that it took more work than I expected, and I think I lucked out because my project isn't very complex at all. All the hassle could've been avoided easily if only I'd had just one more obstacle map, so obviously I was wondering, how system-intensive would it be for the Pathfinding behavior to have 2-3 obstacle maps to choose from?

    Every object having its own personal map sounds taxing, but what I had in mind was maybe an extra parameter in the behavior, a drop-down menu where you can select "Map 1", "Map 2", "Map 3", etc. This way you can at least have different groups of objects avoiding different obstacles. Or is having even 2 maps too intensive?

  • The way to do it is to set the object with the pathfinding behavior in the properties to Obstacles = Custom

    Then at the start of the layout you use the "Add pathfinding obstacle" action to add all of the obstacles you want for just that object to avoid. Then make sure to use the "Regenerate pathfinding obstacle map" action afterward so it knows where to move again.

    Simply set up each pathfinding object with a different set of obstacles to avoid, and voila!

  • Well I tried that originally, but as it turned out it just isn't doable currently. C2 only has one obstacle map per layout for all objects that use Pathfinding behavior, i.e. they will all avoid the same obstacles. For example if I set

    [Object A avoid X]

    [Object B avoid Y]

    ... both A and B will avoid only X (because it came first). If I set B to regenerate its map then both A and B will avoid only Y.

    My workaround just contains hidden barriers that are impassable/high path cost. It works, but I feel it's limited in its scope, hence I was wondering if it's possible to have multiple maps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sup with that?

    I think that you 4get 1 important thing: The obstacle map is ready the NEXT tick.

    Construct a flow that waits for it to be ready, and it should work.

    https://www.dropbox.com/s/7m9kgq2rf7atz ... .capx?dl=0

    As you can see, a call to finding a path happens here the tick after the obstacle map is changed.

  • I think that you 4get 1 important thing: The obstacle map is ready the NEXT tick.

    Isn't the obstacle map generation happens in the background and not necessarily available at the next tick (with more complex, detailed obstacle maps)?

  • Then you would have a 'on obstacle map ready' condition, as you have for all the other stuff that is not necessarily ready to use in the next tick.

    The things that Asley does are very consequent, i have found.

    Complex maps just drop fps.

    I have also no idea how one can deal with both actors beeing asynchronous, path finding and generating the map. Behind the scenes of C2. Lucky that i am not a programmer.

  • Then you would have a 'on obstacle map ready' condition, as you have for all the other stuff that is not necessarily ready to use in the next tick.

    The things that Asley does are very consequent, i have found.

    Complex maps just drop fps.

    I have also no idea how one can deal with both actors beeing asynchronous, path finding and generating the map. Behind the scenes of C2. Lucky that i am not a programmer.

    Thanks for clearing this up for me. Seems like I was mistaken about that.

  • I recently found out that C2 only has one obstacle map for all the pathfinding behaviors on the layout, meaning you can't have two different objects avoiding different types of obstacles. No problem, I thought, maybe I can jerry-rig some workarounds using other behaviors, path cost, etc.

    Anyway, everything is working well enough, it's just that it took more work than I expected, and I think I lucked out because my project isn't very complex at all. All the hassle could've been avoided easily if only I'd had just one more obstacle map, so obviously I was wondering, how system-intensive would it be for the Pathfinding behavior to have 2-3 obstacle maps to choose from?

    Every object having its own personal map sounds taxing, but what I had in mind was maybe an extra parameter in the behavior, a drop-down menu where you can select "Map 1", "Map 2", "Map 3", etc. This way you can at least have different groups of objects avoiding different obstacles. Or is having even 2 maps too intensive?

    Its a known (Scirra knows) limitation or design flaw with the obstacle map and from what I know, from former discussions about it. It is not something that will be fixed in C2 due to it being some very core changes that need to be made with how it works. However I would be surprised if C3 doesn't solve this issue, as im pretty sure Scirra knows its not really working optimal at the moment. Which is of little help now, but at least it should be fixed at some point.

    From dealing with this problem my self as many others have, I don't think there are any workarounds for it.

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