Basic Pathfinding
I'm wondering if there's a really simple algorithm to do what I have planned. Basically i need to move a robot along a 30 x 30 grid (for my game). The robot can stop at any cordinates eg (23,10) or (0, 12) etc. Now the AI cannot go directly from eg (1,1) -> (2,2). Instead it must go (1,1) -> (1,2) -> (2,2) or (1,1) -> (2,1) -> (2,2).
Well you get the point, it cannot go diagonally along this grid. It can only go vertically and horizontally. There's also one other simple addition, the AI can also encounter a wall. In this event it needs to go around it. Is there a well known algorithm for this?
Here's an example.. lets just say my AI is at (1,1) and I need to move it to for example(6,6) (a strategic move in my game where there's a power-up) and there's a wall blocking the obious path. How would I make some algorithm to get to (6,6)?
I don't have much AI experience so it would be great if some of you guys can help me with this part of the game. I'm completely lost :s
A* and dijkstra's are only valuable if the robot has a complete knowledge of the grid though [knows where all the walls are]. They are both means of determining the shortest path through a known area [A* works better if the target is known, dijkstra's works nicely if you just want to know how to get to anywhere].
Gets a lot more interesting if the map isn't known.
You mentioned that you want the robot to go around the wall when it encounters it. You should keep in mind that the both the above mentioned methods will not use any sort of trial and error method of getting around the wall 'in the event of a collision', since they will both give paths that will never collide with the wall in the first place. What I mean is, if you want your robot to find a path, then A* is great, if you want your robot to respond to an obstical, and attempt to discover a way around it, then A* assumes too much knowledge, and you need to look into steering behaviours like wall tracing.
Gets a lot more interesting if the map isn't known.
You mentioned that you want the robot to go around the wall when it encounters it. You should keep in mind that the both the above mentioned methods will not use any sort of trial and error method of getting around the wall 'in the event of a collision', since they will both give paths that will never collide with the wall in the first place. What I mean is, if you want your robot to find a path, then A* is great, if you want your robot to respond to an obstical, and attempt to discover a way around it, then A* assumes too much knowledge, and you need to look into steering behaviours like wall tracing.
October 18, 2006 09:24 AM
About the not diagonally problem you could just try doing axis based movement.What i mean is that evry new tile you would toggle between horizontal and vertical movement.
Theres a great A* tutorial here on gamedev. I found it really explains it well.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement