Skip to content

Commit

Permalink
feat: visionblockers are now counted as pathable in the path grid
Browse files Browse the repository at this point in the history
Closes #72
  • Loading branch information
eladyaniv01 committed Sep 21, 2020
1 parent 23b63f9 commit dbaa30f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion MapAnalyzer/Pather.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,15 @@ def _add_non_pathables_ground(self, grid: ndarray, include_destructables: bool =
return grid

def get_base_pathing_grid(self) -> ndarray:
return np.fmax(self.map_data.path_arr, self.map_data.placement_arr).T
grid = np.fmax(self.map_data.path_arr, self.map_data.placement_arr).T
# steps - convert list of coords to np array , then do grid[[*converted.T]] = val
vbs = np.array(list(self.map_data.bot.game_info.vision_blockers))
# faster way to do :
# for point in self.map_data.bot.game_info.vision_blockers:
# # grid[point] = 1
grid[[*vbs.T]] = 1 # <-

return grid

def get_climber_grid(self, default_weight: int = 1, include_destructables: bool = True) -> ndarray:
"""Grid for units like reaper / colossus """
Expand Down Expand Up @@ -127,6 +135,7 @@ def pathfind(self, start: Tuple[int, int], goal: Tuple[int, int], grid: Optional
if grid is None:
grid = self.get_pyastar_grid()

# inbounds steps - convert list of coords to np array , then do grid[[*converted.T]] = val
path = self.pyastar.astar_path(grid, start=start, goal=goal, allow_diagonal=allow_diagonal)
if path is not None:
path = path.tolist() # this make the mapping not override the int boolean with numpy boolean
Expand Down

0 comments on commit dbaa30f

Please sign in to comment.