Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Alternatives to A*?

Author
Message
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 22nd Feb 2006 15:57
Hmmm. I keep searching online and every resource I find keeps mentioning alternatives to A*, but I can't find the actual alternatives. The reason why I'm looking for alternatives is because A* is a bit overkill for ODF, as the only thing the units need to negotiate is the odd building (and each other) - not complex networks of walls.

Has anyone got any names of alternative algorithms so I can hunt them down on google? Just want to get an idea of all the different methods, then maybe use the best one or come up with a hybrid. Currently I have some complex ray casting/line of sight things which I think will get too slow with too many units.

Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 22nd Feb 2006 16:05 Edited at: 22nd Feb 2006 16:07
Divide the landscape into square zones. Then run distance routines in just the zones that a tank occupies, and the zones all around it. That's 9 zones in all, so make them quite small. You could do that in just the direction that it is facing so you have just 6 zones, but you probably have reverse gear in the tanks.

IanG
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location: Cyberspace
Posted: 22nd Feb 2006 18:04
http://en.wikipedia.org/wiki/Shortest_path_problem
gots some links to some info on some path finding stuff


amd athlon xp 2600+,1280mb,FX 5200 128mb,200gb,xp pro sp2
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Feb 2006 19:06
A simple 'move forwards, but if you can't, move sideways' may work for you:



You might also want to try a line-of-sight type system. Scan forwards until you hit the target or an obstacle. If it was an obstacle, scan again, but 5 degrees left until you are past it or hit it. If you hit it again, try 5 degrees right, then 10 degrees left, 10 degrees right etc. Once you are past it, scan towards your target again. You will end up with a set of waypoints to your target. The attached png might make this a little clearer ... certainly that isn't the best explanation I've ever made

For free Plug-ins and source code http://www.matrix1.demon.co.uk

Attachments

Login to view attachments
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 22nd Feb 2006 19:34
Thats an algorithm that might be worth trying. Its raycasting. If you adopt a grid system then the raycasting can be optimized and quicker.

WE SHALL BECOME ALL POWERFUL! CRUSH THE LESSER RACES! CONQUER THE GALAXY! UNIMAGINABLE POWER! UNLIMITED RICE PUDDING ! ! ! ETC. ! ! ! ETC.! ! !
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 22nd Feb 2006 19:47
Fallout:
i checked you WIP thead and watched all the videos... very very very professional looking


This just in: White lab coats cause cancer in mice. Details comming soon.
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 22nd Feb 2006 20:22
Thanks Joel. Hopefully the gameplay will live up to the visuals.

Thanks for the suggestions too. I've sort of gone along a combination between the node and raycasting route. I have no idea if it'll run well, but I'm gonna use the raycasting method to detect collision and then get the unit to follow node "detour" paths around buildings. I'm not using a grid of any kind, which I think is nicer, but is making this stuff more complicated.

Hmmm. We'll see how it goes. So far I've just finished designing a node grid for one part of the level. I'll try and implement it this evening and tomorrow.

Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 22nd Feb 2006 22:10
Quote: "You might also want to try a line-of-sight type system."


Raycasting can be *very* taxing on a game. I remember the raycaster built into the Meqon physics engine was just abysmal, as I was trying to do what IanM suggested to get my car to stay on the track.

We soon ditched the raycasting and went for something else.

Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 22nd Feb 2006 22:19 Edited at: 22nd Feb 2006 22:21
I've managed to get the ray casting setup so that only a couple of rays are cast per unit, about once a second against about 4 meshes of 20polys. How that holds up with 50 or so moving units, I'll have to see. So far, so good.

Edit: IanM, somehow I missed your codebox! Thanks for that!

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 23rd Feb 2006 01:15
If you want to use A* anyway, and a blisteringly fast one, try mine:



And a sample app:



Of course, you'll have to copy+paste the functions into the bottom of that example, or include them in a seperate file...

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 23rd Feb 2006 01:43
Woah, that's a monster! I won't be using A* because my system is not tile based, but that's still a damn handy piece of code to have. Very nice of you to chuck it up!

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 23rd Feb 2006 03:14
Ah well, no worries.

Stick it away somewhere, and one day you may be able to use it

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 23rd Feb 2006 10:30
No doubt mate! I'm bound to have use for it in the future, and it looks well documented and put together. Nice one.

Login to post a reply

Server time is: 2024-11-16 15:35:03
Your offset time is: 2024-11-16 15:35:03