Rick Posted April 1, 2012 Share Posted April 1, 2012 Has anyone done A* on a 2D grid where edges are considered being passable or not, not just entire nodes? Think original Sims where you build walls between nodes. If each node has 4 variables for edges that represent open/wall, when looking to consider if a neighbor node is walkable, would things still work if you check the current nodes 4 edges and if there is a wall there don't check that neighbor at all (this would assume the nodes share the edge value of wall). Has anyone done something like this before or the people who are more experienced in A* does this sound like it could work? If so I'll give it a shot for a small test I want to do. Quote Link to comment Share on other sites More sharing options...
flachdrache Posted April 2, 2012 Share Posted April 2, 2012 If generating a navgraph one usually removes non-valid edges between nodes in a post step e.g. if a node is inside a entity aabb remove the node or if node A cant see node B ( blocked by a wall ) dont link these nodes ( north-west-south-east ). MG had something implemented for dynamic obstacles - i dont know how he solved that, however. Quote AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3 zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5 Xxploration FPS in progress ... Link to comment Share on other sites More sharing options...
Rick Posted April 2, 2012 Author Share Posted April 2, 2012 OK, that seems like sort of what I was thinking then. When checking adjacent tiles if there is a wall on 1 edge just skip that adjacent tile (basically removing the link). I'll start giving that a go. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted April 2, 2012 Share Posted April 2, 2012 Hi Rick, I actually made this for a school project. The way you describe it is perfectly fine for this. First you check the edge which is adjacent to the tile you are coming from. When there is no wall there, you can start looking for the other 3 (if you have square tiles) walls. pseudo: Check the tile next to me is walkable (water, lava etc) Check the origin-tile edge with the adjacent-tile edge. There is a wall? Done There is no wall?Check if the adjacent tile has 3 other walls (excluded the one you allready checked). If it has 3 walls: done. If it doesn't have 3 walls: Continue search algo. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.