Skip to content
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

Support for 3D grids #21

Closed
AdamJamesNaylor opened this issue Jan 1, 2019 · 4 comments
Closed

Support for 3D grids #21

AdamJamesNaylor opened this issue Jan 1, 2019 · 4 comments

Comments

@AdamJamesNaylor
Copy link

AdamJamesNaylor commented Jan 1, 2019

I noticed in your previous versions of this library that it supported 3D pathing.
Is that something you are considering for this version?

If not, I'm wondering if it's something I could 'fake' by connecting 2D grids in layers and adding sensible costings between them. But not sure how best to achieve that?

@roy-t
Copy link
Owner

roy-t commented Jan 1, 2019

Hey Adam,

I'm not planning on adding 3D pathing since it adds a lot of computation complexity really fast. For example a 10x10 grid has 100 cells to check (worst case) while a 10x10x10 grid already has a 1000 cells to check (worst case again). But if you really need A* path finding in 3D, the algorithm is exactly the same. All you have to do is expand the grid into 3d, add a third dimensions to the movement patterns and expand the heuristic here

private static float ManhattanDistance(Position p0, Position p1)
to also account for the 3rd dimension.

So I think its easier to fork this library than trying to fake it. However in some scenarios faking it would also be a good idea. For example if your 3D map is a map of a house. Where each floor is 2D grid and there are only a few place where you can go up or down (at the stair cases). In that case you could use this library to path from the current position to a stair case.

@AdamJamesNaylor
Copy link
Author

AdamJamesNaylor commented Jan 1, 2019

Thanks for the quick reply (and great work on the library).

I'll certainly look into making the modification myself.
As for the faking option, the grids will need to support layouts as complex as this: https://www.reddit.com/r/starcitizen/comments/9wqv0r/lorville_map/
I certainly think there is a way to logically simplify the grid so that it works. Perhaps by scaling sections and modifying the costings so that it works?

@roy-t
Copy link
Owner

roy-t commented Jan 1, 2019

I think you could make that work with 7 2D grids and a few staircases :)

@roy-t
Copy link
Owner

roy-t commented Oct 20, 2019

Closed, No more actions needed

@roy-t roy-t closed this as completed Oct 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants