Pathfinding unpredicatable

0 favourites
  • 10 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Please look at the attached CAPX file to see what I mean. Currently the enemy tank is set up to move towards player 1 (controlled by arrow keys) when player one is in line of site. I have two issues:

    1) The tank often moves through the solid walls instead of going around

    2) Sometimes only one enemy tank seems to discover player 1

    Because the process is temperamental you may need to refresh the screen a couple of times until you see it happen.

  • I haven't looked at you're capx yet, but make sure that solid walls have solid behavior. and for tanks attacking you got to make them to be a group trough variable and then with events make that group move together if one of them has player in sight.

  • Also I found that for stability it's best to re-build your obstacle scene on start of layout.

  • Hi, the walls have solid behaviours enabled but the enemy tanks still go through them.

    I have re-uploaded the CAPX file as the original had a bug w.r.t. movements.

    [attachment=0:2a7urdmr][/attachment:2a7urdmr]

  • You are calling Has line of site & Find path every tick - that won't work. It takes more than a tick for the find to kick in. Add "Every 1 second" to "Has LOS" and you'll see it works much better.

  • Thanks for that but my real problem is that the red tanks sometimes drive through the walls. Any ideas as to why that happens?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Does it do it after my suggestion?

  • Ok.. I understand... yeah that fixed it. Thanks

  • I answered too quickly.. It still goes through the walls.. will up load updated CAPX now

    [attachment=0:12qv1qem][/attachment:12qv1qem]

    Just to note, the red tanks respawn when they land in the middle of a wall - this is a simply way to make sure that they respawn off the the walls.

    However when they drive around they go through the walls and are therefore respawned.

  • I think this has to due with your cell size. Your walls/blocks are multiples of 44(ish) but your pathfinding cells are 30+6, so 40. I would suggest sizing everything appropriately, turning on the grid, aligning with the grid, so that everything is lined up with the grid. Reread the documentation on the cell mechanism. I did a quick experiment and it did seem to improve (I did see the overlaps you were seeing prior to these changes.)

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