View Full Version : This one's a doosey.
Bodadem
11-14-2004, 08:57 PM
I'm not really sure if this is even possible, and if it is I don't imagine it'll be easy.
Here's what I need to do --
I need to have AI (artificial intelligence), which can get from point A to point B the quickest way, and avoid obstacles and such. I have absolutely no idea how this would be achieved, so I need your help, XGen!
Any, and I mean ANY, ideas are strongly welcomed, as they just may spring an idea in my head, or someone else's. So please, post any thoughts you have about how this could be achieved!
Hijacker27
11-14-2004, 09:00 PM
uh, make it head towards point B, and if it encounters an obsticle, make it turn, move forward, turn towards point B again, move forward, ect.. and make it more complex, but yeah, try it.
MercuryLime
11-14-2004, 09:15 PM
I'm sure it's possible, but I sure as heck can't do it myself. I think you'd have to calculate every possible option and the moves taken to get there... If it comes to a tie you could even try and figure point B's trajectory if it's moving.
yoshimitsu31
11-14-2004, 09:29 PM
I did that on a TI-83 calculator.
Bodadem
11-14-2004, 09:34 PM
Hmm...I need help from the masters. TBC!!!!! *puts up cow signal in the sky*..I'm sure TBC will know how to do this...or if not, I'm sure he can figure it out..
arkhan
11-15-2004, 08:21 AM
it depends a lot on how you have your maps built..
its a tought thing, but the main idea is to have your whole map checked for walkable places, then check every possible way to get there and move the object throught the shortest way..
http://www.tonypa.pri.ee/tbw/tut22.html
I allways have this site as reference..
Bodadem
11-15-2004, 03:12 PM
Arrrgh..Too...hard..
The Brown Cow
11-15-2004, 04:52 PM
The cow signal!
Yeah, so this is another one of those fun things that's really tricky to do.
You need to use some sort of pathfinding algorithm. The most effective (but slow) algorithm is A* (A-star).
This beast of an algorithm is guaranteed to find the shortest path between two points and can take into account different types of terrain.
Jobe Makar, author of that book with the frog (http://www.amazon.co.uk/exec/obidos/ASIN/0201770210/qid=1100558844/sr=1-2/ref=sr_1_2_2/202-5259902-1120631) wrote out A* in ActionScript, and several forms come on the CD included with the book. You can take a look at his implementation here (http://www.electrotank.com/lab/astar_iso.html), applied to an isometric world with various types of terrain and obstacles.
Do a search for A* in Flash for more information.
This does need a tile-based world (unless you're really clever), so it will still be a lot of work, but it can give some very nice results.
Best of luck. :D
Bodadem
11-15-2004, 07:47 PM
errrrrr...I have a feeling this is beyond my ability...By the way, this is for use in PixxRPG...
The Brown Cow
11-15-2004, 08:30 PM
Well, pixxRPG is tile-based already (at least I hope so), so it shouldn't be too hard to add in A*.
Bodadem
11-16-2004, 05:02 PM
Slightly Offtopic::: COW SIGNAL!!!!!!!!!!!
CLICKY!!(bigger version) (http://www.freewebs.com/bodadem/cow_signal.html)
CLICKY!!(smaller version) (http://www.freewebs.com/bodadem/cow_signal_SM.html)
arkhan
11-16-2004, 05:08 PM
I like it...there should be a smile in the forums that looks like that...
Bodadem
11-16-2004, 05:14 PM
Thank you very much..I put a pretty little bit of time into that....had to edit the background off of the image..and coundn't get it to tween properly, so i had to make it frame by frame..
eatmorchikin6464
11-17-2004, 04:28 PM
It's ok, but, whatever. Ijust felt like posting.
Bodadem
11-17-2004, 05:43 PM
Posting just for the heck of posting? That can't be legal!
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.