Toady Posted June 12, 2007 Author Share Posted June 12, 2007 @kirby - Thank you @Secure - Well I wouldnt go there hehe Thank you. UPDATE: Added an example in the source code to help people get started very easily. I also got rid of that pop up box displaying the time and put the time in the gui instead. I improved speed by ~20%. Good right? hope so. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
James Posted June 12, 2007 Share Posted June 12, 2007 I would. AI as I know from when I programmed some small games in a different language was hard work, although you make it seem easy. 20% more speed? WOW. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Toady Posted June 13, 2007 Author Share Posted June 13, 2007 I would. AI as I know from when I programmed some small games in a different language was hard work, although you make it seem easy.20% more speed? WOW.Yes, I optimized a part of the algorithm that was part of the searching. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
Aces Posted June 13, 2007 Share Posted June 13, 2007 Updated - Now Faster!I optimized this algorithm by making a lot of changes. Now there is less comparisons and less searching. I also modified the GUI example a little to fix everyones confusion they may have.kuk-bot creator uses this for mm.BOT baal/meph/andy bots on diablo 2 ~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public Link to comment Share on other sites More sharing options...
Toady Posted June 13, 2007 Author Share Posted June 13, 2007 kuk-bot creator uses this for mm.BOT baal/meph/andy bots on diablo 2I wouldn't doubt it, diablo 2 is a good example for this being used. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
JavaCupiX Posted June 13, 2007 Share Posted June 13, 2007 Another interesting technique exists in finding paths and maybe faster depending of the situation: Begining : You created a 2 dimensionnal matrix of the field where the start position equals 1, the end position equals -2, every "wall position" is -1 and every "free position" is 0 Main : Loop through the matrix positions If you hit the a position wich value is greater than 0 then add the value of the current position + 1 to all the surrounding fields equal to 0 If you hit -1 don't do anything If you hit -2 check if any surrounding field is greater than 0, if this is true a path has been found, to get the path you just follow the decreasing values until you hit the 1 value This is a good exercice to practice basic pathfinding, you can even add constraints like sand, mud by adapting the basic algorithm... Link to comment Share on other sites More sharing options...
Toady Posted June 13, 2007 Author Share Posted June 13, 2007 Another interesting technique exists in finding paths and maybe faster depending of the situation:Begining : You created a 2 dimensionnal matrix of the field where the start position equals 1, the end position equals -2, every "wall position" is -1 and every "free position" is 0Main :Loop through the matrix positions If you hit the a position wich value is greater than 0 then add the value of the current position + 1 to all the surrounding fields equal to 0 If you hit -1 don't do anything If you hit -2 check if any surrounding field is greater than 0, if this is true a path has been found, to get the path you just follow the decreasing values until you hit the 1 valueThis is a good exercice to practice basic pathfinding, you can even add constraints like sand, mud by adapting the basic algorithm...Is this going to get you the shortest path with the least amount of energy and the least amount of nodes searched? I doubt it from the way you described it. This might work well for none maze like matricies with small amount of nodes to check. Sounds like a good idea though. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
JavaCupiX Posted June 13, 2007 Share Posted June 13, 2007 Is this going to get you the shortest path with the least amount of energy and the least amount of nodes searched? I doubt it from the way you described it. This might work well for none maze like matricies with small amount of nodes to check. Sounds like a good idea though.Yes it finds the fastest path to the maze though in my example it doesnt take the "least energy", we used to study pathfinding and compared the topic way and this way described here... They all had their weak & strong points... I will try to post the autoit code to my algo so you can compare/understand it Link to comment Share on other sites More sharing options...
Toady Posted June 13, 2007 Author Share Posted June 13, 2007 Yes it finds the fastest path to the maze though in my example it doesnt take the "least energy", we used to study pathfinding and compared the topic way and this way described here... They all had their weak & strong points... I will try to post the autoit code to my algo so you can compare/understand itk sounds cool www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
Toady Posted June 13, 2007 Author Share Posted June 13, 2007 UPDATE Openlist is now a priority queue. This speeds up the searching dramatically. You will notice a difference between this and the last version. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
Toady Posted June 15, 2007 Author Share Posted June 15, 2007 UPDATE Added option to make the bot move diagonal if needed. The bot will not cut around corners, the bot moves in a smooth more human-like manor. Searching nodes is animated now. You can see how the bot searches for the path node by node. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
James Posted June 15, 2007 Share Posted June 15, 2007 Dude, this is amazing! You just astound me everytime. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Toady Posted June 15, 2007 Author Share Posted June 15, 2007 Dude, this is amazing! You just astound me everytime.thx! now make a game out of this lol www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
jokke Posted June 16, 2007 Share Posted June 16, 2007 (edited) I love what you have done with this!! Great Work!! I have to admit iwe not read the souce and dont know how you work out you'r "magic", but i still wounder how you determine the path, do you use connections, or do you use hinders ? Edited June 16, 2007 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
Mast3rpyr0 Posted June 16, 2007 Share Posted June 16, 2007 Thats awesome. wish i had the time to go through the code, i bet i could write a game after reading it. My UDF's : _INetUpdateCheck() My Programs : GameLauncher vAlpha, InfoCrypt, WindowDesigner, ScreenCap, DailyRemindersPick3GeneratorBackupUtility! Other : Bored? Click Here! Link to comment Share on other sites More sharing options...
fisofo Posted June 16, 2007 Share Posted June 16, 2007 nicely done Toady... I remember studying A* when I was in college, you've optimized it quite nicely! Now I'm just waiting to hear of someone becoming a programming prof at a university teaching AutoIt Your example will be something like chapter 15, "A* searching and AutoIt" Shoot, I'd teach it, anyone want to pay my tenure? Link to comment Share on other sites More sharing options...
idusy Posted June 16, 2007 Share Posted June 16, 2007 (edited) Found a little flaw.When searching for a path down a column, it skips a row each time, meaning when there's a path it could take, it skips over itThe first takes 28 nodes, second only 26 on a path the first could have taken.That is, it's a flaw if the objective of the program is to find the absolute shortest path to the goal. Edited June 16, 2007 by idusy Link to comment Share on other sites More sharing options...
Toady Posted June 16, 2007 Author Share Posted June 16, 2007 (edited) Fixed, I forgot to change something back in my code after the last version. The priority queue was inserting values in places it shouldn't. Edited June 17, 2007 by Toady www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
Toady Posted June 17, 2007 Author Share Posted June 17, 2007 (edited) I love what you have done with this!! Great Work!!I have to admit iwe not read the souce and dont know how you work out you'r "magic", but i still wounder how you determine the path, do you use connections, or do you use hinders ?As the search progresses each node points back to its parent node. The node with the lowest F cost is chosen to be the the current node.F = G + Hwhere G is the cost of the path from the starting node to the current node. Each node has its own weight to be added to G, a blank space has a weight of 1, sand = 2, water = 3, and hill = 4. So trying to walk across a hill is like walking 5 moves. Thats why the bot will find it easier to just go around the hill.H is the heuristic cost from the current node to the goal node. Two H heuristics can be selected, one is Manhattan and the other is Euclidean. Manhattan will cause the path to be in a L shape while Euclidean causes the path to be in a zigzag. Edited June 17, 2007 by Toady www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
nfwu Posted June 17, 2007 Share Posted June 17, 2007 Some pointers: Overestimating Heuristic Cost: Using a heuristic that routinely overestimates (the distance cost) by a little usually results in faster searches with reasonable paths. If making the world bigger you could decouple the path finding data from the search space. This would reduce memory consumption. #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now