   Getting from A to B
  So I have an item which I have to get from one point on a Map to another. The items position and map "blockers" are stoired in a 2D array with a different number representing a different item.I can place arrows and the item always moves right on collision and continues this movement in the direction it ends up in.What is the quickest way to know where to place arrows inorder to get from one point to another?avoiding the obsticles...I tried a long chain of arrows but was very unefficient as it was basicly bruteforced.Thanks   
  Sounds like homework to me, yea?What have you tried?  Did it work?  What other approaches have you tried?-me   ;  Basicly I have this:All the imsge detection is done and i have an array with the positions of the boxes so i can clickand like the top left those red pices need to go into the other cannon like that, Thats the only approach ive tried so far as I started thinkign A* but then if the pieces are moving is this efficient?So this is sort of a game solver im doing for some experience and fun but im stumped.   ;  Yeah A* is probably a good approach; it can be done pretty quick especially for such a small board.Just make sure that you only explore forward and right from each node when putting nodes on the open list.  Then just go through your generated path and everywhere that there was a turn, place an arrow dealio.I wrote that I think mis-reading your description of the game.  That's true if you can only place things that make the dudes turn.-me   ;  A* seems like the way to go here, yep!If you try it out and find that yes, A* is too slow to use on a frame by frame basis, what you could do is keep your A* search information persistent across frames.If no object moves, your A* information from the last frame is still good isn't it?If an object DOES move, what you should do is "erase" everything in the A* "search tree" that is affected by that movement.Then perhaps you can use the partial data you still have of A* to do your search, that way you dont have to start completely from scratch every frame.Your game might be able to do A* every frame just fine though.Something else to consider...I'm not sure how many of those objects are moving every frame, but if you have a lot of objects moving all the time that all need A* movement would be to stagger the A* calculations so for instance, you only allow one A* search to happen each frame.You could have a list of people waiting for A*, and each frame, only one of them get it.The other guys just sit still and wait til their path finding information is ready.Also, im assuming objects don't INSTANTLY move from one tile to the other, that they take a little time to move to a new square.During this time period, if you have a list of people waiting for A*, hopefully most objects are MOVING, not searching for where to move to every frame.Hope that helps!   ;  Do you ahve anymore information on how to achieve this with the 2D array, Ive seen alot about nodes but dont fully understand how this works with that if you get me.   ;  It occurs to me that the complexity of this game is probably that entities spawn at different times and other players can also place arrows and such that affect your units?  If that's the case, this becomes a much more difficult AI problem.-me   ;Quote:Original post by CatkillDo you ahve anymore information on how to achieve this with the 2D array, Ive seen alot about nodes but dont fully understand how this works with that if you get me.It's just a terminology thing.  Each position on the board (one of your 2D array slots) is a "node".  A node has pointers to all the nodes to which it connects.  This is your "graph".  A* is a graph solver which finds the most efficient path through a graph given certain conditions.You can find a good description of the A* algorithm here:http://en.wikipedia.org/wiki/A*_search_algorithmLike most Wikipedia CS entries it's pretty dense. but skip to the pseudo-code section and you should be able to make sense of it.  If not just google "A* pathfinding"This is not a trivial algorithm to implement correctly if you're a beginner.(performance tip: Represent the Open List as a binary heap)-me   ;  All the shapes up the top move, the balls, buckets, powder and meshy stuff there always moving and continue there movement in the direction until they hit one of the "wooden blocks " which are the obsticles.How would this be done?   ;Quote:Original post by CatkillAll the shapes up the top move, the balls, buckets, powder and meshy stuff there always moving and continue there movement in the direction until they hit one of the "wooden blocks " which are the obsticles.How would this be done?Still not enough information.  What is the win condition?  What are you trying to to as the player?  When do balls spawn?  How many?  Are there other players? etc.  We don't know anything about this game so you have to explain exactly what the goal is and exactly what you are trying to do with your AI.-me   