Public Group

# Node Tree Search Help

This topic is 3330 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I have currently built a structure in C++ with a two dimensional array, with each cell stating whether there is a wall present or not. A search is then done through the array to add edges if the adjacent cell is not a wall, this is done looking norh, north east, east etc. The image shows an example of the connections. When searching through my depth first algorithm on a on a 30 x 30 grid, the destination node is found after 1518 steps, I guess this is because there is so many combinations to get there. Any suggestions on other algorithms that could be used to find a destination node? I have an image - how do I get this attached to the forum post?

##### Share on other sites
Hey pawikan!

Quote:
 A search is then done through the array to add edges if the adjacent cell is not a wall, this is done looking norh, north east, east etc.The image shows an example of the connections. When searching through my depth first algorithm on a on a 30 x 30 grid, the destination node is found after 1518 steps, I guess this is because there is so many combinations to get there.

I don't quite understand what you are trying to accomplish. Are you trying to generate data describing where walls are, or are you trying to get to a goal node?
If the former, I would probably try to search for walls and turn it and so many adjacent tiles to intraversable. If you do not have diagonal walls, you could implement your algorithm to try and "hug the wall" to hasten the process. Even better, you could just use an image map to directly describe which areas are blocked and which are not.

If you are trying to reach a goal node, implement the A* algorithm.

To attach an image, use the following syntax.
<img src="Image URL goes here" />

Cheers!

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 17
• 14
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634096
• Total Posts
3015504
×