Please sign in to comment.
Make search_astar more stable across platforms
This function is used by slime levelgen in order to ensure level connectivity that doesn't require touching slime walls, and because of this use matters for seeding in slime (both because its behavior impacts what wall squares get removed, and because this astar implementation draws heavily on the rng. The implementation was behaving differently across platforms. Because slime is pretty independent of other branches, the instability was localized to that branch, but usually affected the entire thing. The basic problem is that the search fringe was sorted only by distance in the priority queue, so if two coordinates were the same distance, their ordering in the queue was implementation-dependent (and was differing on mac vs linux builds at least). This fix makes the sort stable in such cases by comparing coordinates as well. This won't necessarily do anything for the speed of the search (perhaps LIFO behavior would be better)... I wonder if this overall approach is really the best way to ensure connectivity in slime? And why does this algorithm need randomization (classic a-star doesn't)? But this code is complicated enough that I'm not going to mess with it further right now.
- Loading branch information...