-
Notifications
You must be signed in to change notification settings - Fork 0
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
Supergrid based pathfinding data structure #150
Comments
Turns out the solution to this problem actually becomes quite nice. Break this down into a recursive grid The top left case will be 0 all the time, since if we land somewhere in a parent cells top left, instead of calling the parent level we call the current level in which case we will fall in 1 of the other places. The only time we fall in 0 is if we are at (0, 0) Landing in the top right or bottom left returns the value of n which is the ceiling of the log base n of the larger of the x / y coordinate position. Landing in the bottom right means we have to shift the x and y into the top left corner and try again. This has a maximum recursion depth of log(n) and that only happens if we fall on a 1. |
TODO: Add in the ability to update a nodes solidity. |
When removing a region, we need to locate the shared parent then split it into 2 parts based on what should be connected. |
I think regions need to know what regions they are adjacent to in order to determine adjacentivity without iterating through every node in the network. |
Store the world into chunks of a certain size.
These chunks will then be stored in a grid of nxn chunks, which will be stored in a grid of nxn chunks etc.
This allows us to determine if 2 points are accessible by moving up to the top level grid chunk and seeing if it is the same.
This would give us an either O(logn) or O(1) algorithm for determining if 2 points on an infinite grid are adjacent.
We need to think about only supergriding when necessary.
This is mainly for determining if 2 points are accessible to each other, the pathfinding itself will just use the A* pathfinding algorithm.
The text was updated successfully, but these errors were encountered: