- Home /
A* Huge terrain
I have a 10000x10000 unity terrain, and I plan to use A* as a AI Solution. The problem is that the terrain can't contain that much detail, it has a limit of 1024x1024, does anybody that use A* have a solution to this. I know that it is possible to move the grid as the player moves, but that creates conflicts, when the AI isn't inside the player's grid.
Answer by HenryStrattonFW · Feb 25, 2015 at 08:46 PM
Depends on what solution you're using, a common technique is to use a hierarchical approach, in which you have multiple levels of path finding.
E.g. your large grid is broken into a coarser grid (say 64x64 spanning the whole terrain) knowing which of those regions your start and end is in lets you path at that higher level, requiring fewer things to check, then that resulting path contains the regions in which you then do the more detailed search.
You can then do this at as many different levels as works best for you project.
Unfortunately I can't recommend any specific asset solutions for this as I've not got any experience with the store offerings, but I'm sure there are some solutions out there that would properly handle this.
That gives me a problem with memory, with 4x(1024x1024) it uses about 1300mb which is over the limit of 1024mb on a 32-bit program (AFAI$$anonymous$$), so I can't use multiple big terrains, the solution with 25x25 grid around the AI, should work but I am not sure how to achieve this with Arongranbergs AI system, which I am currently using. (This should make pathfinding alot more optimizied than before, and a use around 40x less memory) The grids would of cause be moved which requires some proccesing power, but with some optimization, this should be a fine solution.
Ok think there's been a misunderstanding. I didn't mean to suggest having multiple large terrain items. In most systems I've come across, the navigation data is separate from the terrain itself, and so would not take up nearly that much memory even for several layers. But I've not got any experience with the unity terrain system so I have no idea how they manage any navigation data in the built in systems.
I would suggest looking around at the various pathing solutions on the asset store, there is sure to be one that is designed to handle large terrain.
I have been using Aron Granberg's A* for a while now. I have actually made the above work, where each AI Controller has its own Small grid, and for longer path's it will keep updating to the nearest point on the map. This doesn't seem to take that much proccessing power even though the grid are moved as the controller moves.
Your answer
Follow this Question
Related Questions
A* Can't Scan GridGraph 0 Answers
How to find a circle (radius) in grid tiles around another tile 1 Answer
Allign grid with Splatmap 0 Answers
Paint Grid Texture 1 Answer
Allign grid with Splatmap 0 Answers