-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C pathfinding and chokes #111
C pathfinding and chokes #111
Conversation
spudde123
commented
Dec 23, 2020
- Implementing pathfinding and map analysis in C, allowing to remove pyastar and sc2pathlib as dependencies
- Implementing smoothed pathfinding
- Fixing choke objects in the mapanalyzer so they have sides etc that better reflect reality
- Fixing ramp objects that come from burnysc2 if the info is broken due to destructables
# Conflicts: # MapAnalyzer/MapData.py Not a problem to fix the conflicts
some ramps have broken data in burnysc2 (same top_center and bottom_center) for instance. by filtering them away they get detected as regular chokes instead if they are real
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work, i posted some comments, mostly regarding naming conventions and how the lib is going to treat the c ext, as its main feature, and not some added feature (in my opinion features from Cext shouldn't be names specially, only features from external sources should)
MapAnalyzer/Debugger.py
Outdated
@@ -209,6 +209,56 @@ def plot_map( | |||
tick.label1.set_fontweight("bold") | |||
plt.grid() | |||
|
|||
|
|||
def plot_influenced_path_c(self, start: Union[Tuple[float, float], Point2], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably the default method for plotting from now and on,
i would rename the old function to have a pyastar postfix. especially since its life span is is not much longer in this project
MapAnalyzer/MapData.py
Outdated
@@ -835,6 +852,26 @@ def plot_influenced_path(self, | |||
fontdict=fontdict, | |||
allow_diagonal=allow_diagonal) | |||
|
|||
def plot_influenced_path_c(self, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, the C method is going to be the Supported method by the lib, there is no reason to give it a specific name, any other method that might join , should have a specific name to differentiate it
MapAnalyzer/Pather.py
Outdated
@@ -184,6 +170,39 @@ def pathfind(self, start: Tuple[float, float], goal: Tuple[float, float], grid: | |||
logger.debug(f"No Path found s{start}, g{goal}") | |||
return None | |||
|
|||
def pathfind_c(self, start: Tuple[float, float], goal: Tuple[float, float], grid: Optional[ndarray] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just marking the places for convenience
here also a method that is considered the Flag method of the library doesn't need a special name
size_t used; | ||
} MemoryArena; | ||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work !
pf_perf.py
Outdated
print("extension astar time: {}".format(ext_time)) | ||
print("div: {}".format(ext_time / pyastar_time)) | ||
|
||
map_data.plot_influenced_path_c(start=p0, goal=p1, weight_array=arr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be used for benchmarks , right ?
* feat: use custom implementation of pyastar downgrade numpy to 1.19.3 for windows users * feat: fix pyastar ref in requirements feat: Rewrote add_cost function: - Changed open disk to closed disk (add 0.001~) - Removed bounds safety check (disk should already do this) - Changed order of safe/np.any call to improve performance feat: Changed all input from ints to floats for better accuracy * Added 0.01 to find lowest cost points to match add cost * Improved filtering on nonpathables (#108) * C pathfinding and chokes (#111) * add cmapinfo to map_data object * refactor: change test function names * refactor: change pathlib choke to cmapchoke in constructs * refactor: remove sc2pathlib references, use only c extension * doc: adding comments to extension * add docs, remove stuff from choke init that is set in the parent class * changing the way ramp sides are calculated for chokes * fix wrapper init file * refactor: moving raw chokes into their own class * fixing ramps coming from burnysc2 * fix: int cast fix * test: add a dummy test for the c extension * feat: changing memory management, remove stretchy buffer dependency * fix: missing max and min definitions on linux * remove ephemeronLE from the test maps for now #110 * remove stretchy buffer * remove sc2pathlib * changing cext functions to default, removing old test and making a new one * adjusting small things in pathfinder * feat: adding overlord drawing * fix: bug in choke sides * fix: exception text * test: that for each choke a main line actually exists * Improve find_lowest_cost_efficiency Directly evaluates set of points in numpy array instead of creating a whole new map grid to compare against Cost is floored to int Co-authored-by: shostyn <74581079+shostyn@users.noreply.github.com> Co-authored-by: shostyn <sashahostyn@yahoo.ca> Co-authored-by: spudde123 <msandhol@gmail.com>