Deep-Phield-Softworks / XeroSum

Isometric, Squad-Based, Real-Time Strategy RPG
0 stars 0 forks source link

When given an impassible target the entity moves incorrectly #27

Open EricFedrowisch opened 10 years ago

EricFedrowisch commented 10 years ago

When given an impassible target the entity moves incorrectly. The desired behavior would be to not move if adjacent to target. Or to move to the closest adjacent square. Instead entities seem to move "randomly", usually to the SW one space.

EricFedrowisch commented 10 years ago

Upon further reflection, this actually needs more than a quick fix. A common path finding task would be to approach a target and stand in an acceptable adjacent square. This is almost as common a need as the current behavior of "move from current location to a target location". I see the need for: -a smarter Path class constructor that looks at the contents of the target coordinate and makes a decision on how to act based upon what the it contains (approach an entity or impassible feature, go stand on a passable feature or item, etc)
-an approach( ) method that sets all the squares adjacent to the clicked upon target as goals in the Path and then finds a solution -an efficient way to update DMAPs as the goals change. I am thinking there has to be a way to calculate the area that has been lowered by a given goal, as the area surrounding it that has to eventually meet a "ridge line" of higher values that is a seam between the two goals.

EricFedrowisch commented 9 years ago

Some general progress towards this with the coding of the unboundmethods.adjacent(a,b) function. adjacent() takes two lists of the same length that represent cooridnates and determines if they are adjacent to one another.