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.

Code Snippets / A.I. pathfinding (my technique)

Author
Message
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 7th Mar 2003 18:06
ok, whenever this topic comes up and i explain to people about my views, they all say it's too stressful or to much to do, thought it was time i explained how easy it is.

my idea was to divide your building into strategic points, (maybe similar to what they do in some industry games) using these points you could navigate your character from position a to position b withought them passing through walls.

i had a presentation to do rescently for which i had to come-up with pathfinding code, i spent a couple of minuts coming up with the code, probably a couple more refining it so it could be understood and here it is:

http://www.realgametools.net/forums/attachments/path_finding.zip

everyday of life is a new chapter that has already been fortold but is up to the soul to capture.
PiratSS
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 7th Mar 2003 19:26
Cool,

I used A* pathfinding for Lode Runner, since that's what they used in the original.


Toughest line of codecol$=asc(left(Pcol$)),1+str$(rev)+chr(80)+left(right(mid(name$),1),1)
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 7th Mar 2003 20:10
have you got a game demo out? would really like to see the A* algorithm in action ^_^

everyday of life is a new chapter that has already been fortold but is up to the soul to capture.
PiratSS
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 9th Mar 2003 01:57
Sure, if I win(retro comp), everyone can benefit from my source for A*


Toughest line of codecol$=asc(left(Pcol$)),1+str$(rev)+chr(80)+left(right(mid(name$),1),1)
LLX
21
Years of Service
User Offline
Joined: 17th Feb 2003
Location:
Posted: 9th Mar 2003 02:52
why is path finding so difficult? way i see it (mind you i havent coded it) theirs 2 ways, the caterpiller that just follows the players movments to follow him, and wayponts where you set markers on the matrix and the ai simply takes the shortest route between the 2 poinnts, if collision is good the worse result is you have ai running into a walll, litterary, but if the waypoint are player set thats only their fault.

the architect
21
Years of Service
User Offline
Joined: 6th Jan 2003
Location: United Kingdom
Posted: 9th Mar 2003 02:58
If you've played MOH sometimes you will see someone magically bypass you and land up the stairs on a second floor - amazing!

LLX
21
Years of Service
User Offline
Joined: 17th Feb 2003
Location:
Posted: 9th Mar 2003 03:11
well what do you expect, he was taught by mario....dem powerful legs

hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 9th Mar 2003 03:38
path finding is very simple to think about but complex to code! although this method is easy and took me minutes to code up, i bet it'll take sometime to understand the code, but when you do it'll all be so obvious to you ^_^

everyday of life is a new chapter that has already been fortold but is up to the soul to capture.
Red general
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: United Kingdom
Posted: 9th Mar 2003 14:28
Howabout someone puts the a sample code on this forum?

My computer melts regulary - perhaps it likes being fondue
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 9th Mar 2003 20:27
sorry if it doesn't come out well, the code required a house.x object, you can download the entire program from the link on the top of this page (my first post!) if you find any difficulties in understanding the code just give me a shout and i'll be glad to xplain ^_^



everyday of life is a new chapter that has already been fortold but is up to the soul to capture.
PiratSS
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 10th Mar 2003 03:50
Chronic programmer,

I think your pathfinding could work. But it would be very slow in Real time.

You could use: distance#=sqrt((x2-x1)^2+(y2-y1)^2) formula to determine how far your object is away, but then what...

It's qute hard to use my A* pathfinding, and I have discarted using it now! It just didn't suit my game plan.(Platform Lode Runner) You really have to pick the correct pathfinding for your game.


Toughest line of codecol$=asc(left(Pcol$)),1+str$(rev)+chr(80)+left(right(mid(name$),1),1)
LLX
21
Years of Service
User Offline
Joined: 17th Feb 2003
Location:
Posted: 10th Mar 2003 05:33
im sure it will coem in handy eventually

hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 10th Mar 2003 06:00
yeah, although they are many different pathfinding techniques you do have to choose the one that suits your game best ^_^ sometimes, for some unique type of games, you may even end up creating your own pathfinding technique from scratch!

everyday of life is a new chapter that has already been fortold but is up to the soul to capture.

Login to post a reply

Server time is: 2024-11-24 04:25:36
Your offset time is: 2024-11-24 04:25:36