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

Discussion and feedback on Construct 2

Post » Thu Jan 19, 2017 9:31 pm

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?
B
49
S
23
G
17
Posts: 291
Reputation: 12,407

Post » Thu Jan 26, 2017 4:45 am

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!
B
83
S
40
G
15
Posts: 987
Reputation: 16,847

Post » Fri Jan 27, 2017 4:33 am

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.
B
49
S
23
G
17
Posts: 291
Reputation: 12,407

Post » Fri Jan 27, 2017 1:44 pm

@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.
B
33
S
18
G
27
Posts: 2,454
Reputation: 20,372

Post » Fri Jan 27, 2017 6:57 pm

99Instances2Go wrote: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)?
B
128
S
33
G
17
Posts: 1,551
Reputation: 20,488

Post » Fri Jan 27, 2017 8:36 pm

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.
B
33
S
18
G
27
Posts: 2,454
Reputation: 20,372

Post » Sat Jan 28, 2017 11:25 am

99Instances2Go wrote: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.
B
128
S
33
G
17
Posts: 1,551
Reputation: 20,488

Post » Sat Jan 28, 2017 11:46 am

Sup with that? wrote: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.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828


Return to Construct 2 General

Who is online

Users browsing this forum: Glyfos and 9 guests