Pathfinding & Closed Doors

0 favourites
  • 8 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Scenario: A character needs to retrieve an item that is within a room with a door closed. It will not find a path because the door is an obstruction.

    Goal: Doors are not seen as obstacles if their relation matches the characters relation (Ally/Enemy)

    Issue: Physics, Line of Sight, and Pathfinding are all object-based not instance-based, so using a variable (Relation = Ally) is not useful for setting instances as obstacles, because any character can potentially be any relation, thus enabling a door for that object will negate the purpose of relations.

    Any ideas on how to approach this issue?

    Tagged:

  • I can't see exactly how your game works and how important doors are. Is there only one door to an object? If so you could give an illusion of doors being locked while pathfinding to an object that is not available. Also if the ally and enemy are separate objects then it should be easy to resolve.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is an example lionz:

    In this case, the player is automatically locating an item needed, it is located in a room with the access point being the door. I can simply disable the collisions of a door for that object type but it will allow enemies to also pathfind through doors, which is a mechanic I don't want.

  • As above then, make them separate objects which is the norm. Or change a variable on the item to give illusion that the door is locked.

  • As above then, make them separate objects which is the norm

    So I have about 70 characters in my game, are you saying I would effectively need an object per character per relation type? (If I had say an ally, neutral, and enemy, and I have 70 characters, I would need 210 character objects?)

  • Sounds like you would need 70 with the variable. My best approach would be to focus on the item/room and only allow objects to pathfind to it if their variable matches the variable of the item/room.

  • Sounds like you would need 70 with the variable. My best approach would be to focus on the item/room and only allow objects to pathfind to it if their variable matches the variable of the item/room.

    Thanks for the input, So it seems like the method you are proposing is a means of preventing the pathfinding from occurring if an object is pathfinding to an object enclosed in a room of a different relation, rather than relying on pathfinding to filter obstacles based on relations?

  • That would be my approach based on what you described about using a door to stop them, but I don't know the intricacies of the game design.

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