How do I make my pathfinding regenerate the obstacle map?

Get help using Construct 2

Post » Wed Aug 31, 2016 3:00 am

I want the first object with pathfinding behavior to be spawned to calculate the path to follow according to the way of objects defined in the layout and do not run straight to the destination. Where the first is on straight and the others follow the path, as if the first object was spawned before generating the layout through while loop.

Edit:
See on this video if you can to help me.
https://youtu.be/HJ6OduHPDjs

Edit 1:
Anyone
B
32
S
9
G
3
Posts: 280
Reputation: 4,262

Post » Wed Aug 31, 2016 9:11 am

You sometimes need to wait longer than 33 minutes for a response. That you've waited this long means you probably need to rephrase your question - maybe I can help?

As best I can work out, you are spawning multiple objects with the pathfinding behaviour and either;

- the first object you are spawning does not conform to the pathfinding behaviour, and this is the issue you want help with.
If this is the case, try using 'regenerate obstacle map', or have the pathfinding behaviour engaging after a brief delay.

- you do not want the first object to conform to the pathfinding behaviour and instead want it to head straight to the goal, and this is the issue you want help with.
If this is the case, I would use a different object with a bullet behaviour for the first object, to better distinguish it.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Wed Aug 31, 2016 9:20 am

Yes, bumping after 30 minutes is not wise and hardly tolerated on these forums.

Moreover during those 30 minutes, you could have gone in the How do I FAQ to "Understand the picking of newly created/spawn instances since R101 - LINK".

You tell it yourself, you start by spawning objects on your layout.
You then need to use the wait command (with 0 sec to skip one frame, and so have the actual instances "existing") for example before generating your obstacle map and generating your path.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
291
S
114
G
95
Posts: 7,293
Reputation: 70,144

Post » Wed Aug 31, 2016 1:28 pm

with the wait did not work so I added at the beginning
-> On the create event
-> Every 1.2 seconds:
Find Path (target.x, target.y)
Now is working fine, thanks
The problem now is for the use of CPU on calculation
for every seconds each tower find a new path in 12 secs.
B
32
S
9
G
3
Posts: 280
Reputation: 4,262

Post » Wed Aug 31, 2016 4:54 pm

I see in that video that you rebuild the obstacle map like 20 times in a row.
There is only 1 obstacle map. Rebuild the obstacle map for one object rebuilds the obstacle map for all objects. That obstacle map is ready the next tick.

For such a small map, 1.2 second is really really slow. You must be dooing weird thing, but that i can not see in a video with most of the code collapsed. Why not post the Capx ?

I can not see if you have solids ... or customs as obstacles. Non-custom obstacle maps get allready calculated on a 'find path'. I dont see the obstacles moving, why recalculate the obstacle map anyway ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Aug 31, 2016 11:47 pm

I would use custom movement for simple maps like these. Pathfinding is more for uncontrolled instances.
B
56
S
15
G
13
Posts: 826
Reputation: 17,645

Post » Thu Sep 01, 2016 10:27 am

The maps are not that easy, generated during runtime, if saw that video right. Else ... yeah, 4 sure.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: adventurist, Blendi1223, dop2000, PROxMTswatTR and 31 guests