0 Favourites

Reset enemies' pathfinding/LOS when unlocking doors?

  • So I am making a stealth game (sort of), and I created these doors with locked & unlocked frames. When the player goes near it and holds E, the door unlocks & disables its Solid property if it is locked, and vice versa if it was unlocked.

    However, I cannot get individual enemy objects to change its pathfinding to be able to go through the unlocked doors, or see through them (with line of sight). Is there a way to fix that somehow?

    Thanks in advance!

    Ps. An example capx file for the solution would truly make my day.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Here you go.....Only a basic function...but it should help

    includes basic patrolling enemy ..that will search /hunt the player when door is unlocked

    arrow keys to control player and E to open RED door when standing next to it...

    https://www.dropbox.com/s/1p1sa9xbjpnzapb/PATHFINDING%20THROUGH%20DOOR%20EXAMPLE.capx?dl=0

    Also...The main reason why a pathfinding object may struggle to pathfind through an opening is due to its Cell size.

    If the cell size is too large..

    Some of the gaps between obstacles will have been closed off due to the cell size being relatively large compared to the size of the gap. BAsically what I mean is that the cells borders overlap creating the appearance of a solid obstacle.. This will make the pathfinding behavior find paths entirely around the obstacles, and never through them. You can help fix this by reducing the cell size but doing so often massively increases the computation time...Best method is to play around with cell size and Cell Border...Generally they should be the same...but often you can solve problems by altering these values in relation to each other..

    Also ..its worthwhile to note that placement of obstacles can either streamline pathfinding or inhibit it.

    Taking more care when designing your levels by making sure that gaps are large enough or as less complicated as possible will really speed up pathfinding computation time..

    And never perform 'pathfinding' calls or 'Regenerate obstacle map' Calls Every tick....it will slow down your processing drastically.

    For a better explanation...see here https://www.scirra.com/manual/154/pathfinding

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
55 14,327
cingee's avatar
cingee
Unread hot topic
33 1,783
Apox Inc's avatar
Apox Inc
Topic
0 Favourites
Door to Door transportation
15 406
KSLR's avatar
KSLR