How do I make my pathfinding regenerate the obstacle map?

0 favourites
  • 7 posts
From the Asset Store
Obstacle Impacts and Cartoon voices, will makes your game more funny!
  • 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

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

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

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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would use custom movement for simple maps like these. Pathfinding is more for uncontrolled instances.

  • The maps are not that easy, generated during runtime, if saw that video right. Else ... yeah, 4 sure.

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