Game Development Community

Path Finding Demo

by Matthew Langley · in Torque Game Builder · 04/01/2005 (11:42 am) · 9 replies

Heres a download for Windows

Path Finding Demo


if you run it, for some fun effects, try these in turn in the console and look at the background, only run them in that order though

"swirl();"

"swirling();"

"blend();"


also to turn on a lot of debug echos and some visual info...

"$debugMsg::pathDebug = true;"


keep in mind this is very simple pathfinding lol... just dodging an object... there is one major bug right now, if you place a point on 0 of the x axis it wont dodge the object... other than that its just some fun with the start of pathfinding :) place as many points as you want

here are some pics...
razedskyz.com/games/torque/tutorials/T2D/pathDemo/pathFinding1.JPGrazedskyz.com/games/torque/tutorials/T2D/pathDemo/pathFinding2.JPGrazedskyz.com/games/torque/tutorials/T2D/pathDemo/pathFinding3.JPGrazedskyz.com/games/torque/tutorials/T2D/pathDemo/pathFinding4.JPGrazedskyz.com/games/torque/tutorials/T2D/pathDemo/pathFinding5.JPG

About the author

Was a GG Associate and then joined GG in 2005. Lead tool dev for T2D and T3D. In 2011 joined mobile company ngmoco/DeNA and spent about 4 years working game and server tech. 2014 joined startup Merigo Games developing server technology.


#1
04/01/2005 (11:43 am)
I also have my object selection code in place, so if you left click on the objects you can move them
#2
04/01/2005 (11:59 am)
This looks awesome, Matt - I'd love to see this as a mac download to - is there anyway that can happen?

Thanks,
Chris
#3
04/01/2005 (12:13 pm)
Ooh, niceness. :)
#4
04/01/2005 (12:15 pm)
Very cool, I'll have to play around with it a little bit later on tonight - already have a lot of ideas running around in my head :p
#5
04/01/2005 (2:44 pm)
Definitely cool. I will definately have a need for this in the future since my AI skills are null. Are you planning on releasing the code once it's finished?
#6
04/01/2005 (7:22 pm)
What pathfinding algorithm is behind this? Some sort of simple, object-dodging one, or what?
#7
04/01/2005 (7:51 pm)
Thx for the compliments guys... was a simple concept but took a little more to implement than planned (always does)...

@Chris - I wish I had a mac at home to dev off of (Plan on getting one down the road for sure :)... Monday I might be able to throw a Mac usable version up here

@Matt - I'll release this code and some other when I tweak it more... this is just some very basic object dodging code... as well as a path/dot queueing system, I have an animation queueing system set up the same way, all done with functions on fxSceneObject2D (in torquescript) so all objects have these functions for themselves... lol you could try moving the box in this demo... think it'd be

"$player2.addPathPoint("10 10");"

the rest is done automagically... updating, inserting points for object dodging, etc etc...


@Ted - this is just a very simple algorithm I developed in the past two days... just got a path queueing (as well as a dot queueing) system up, then basic object dodging... really this just takes the angle of the player, subtracts 90 degrees (to make a right triangle) and shoots a vector off in that direction (2 * the size of the object... the x or y size is grabbed based on a little math deciding which is needed)... then I just do a vector Add to get the location and insert a path point there... the check is done on a schedule so it keeps checking if everything is clear...

the player shoots a ray from its center and two mount nodes (click the mount links button to see those) to the endpoint to check if dodging is needed...

again just very basic... in the game my team and I are making I think we will have two types of pathfinding... the player type and AI type... AI will be based off of simple rules like this, along with special techniques for walls (I will tag all walls somehow)... the player will use a more accurate system... keeping the processing down for pathfinding will be crucial to having a lot of AI units on screen and moving though, so I'm going to probably develop this all myself (or in house with the rest of my team) so we have a very customized and efficient pathfinding system.
#8
04/03/2005 (7:45 am)
Great work mr langley ;) would help in my TBS game, i gotta work on path finding next, i had bit of a gap and havent touched it for nearly 2 weeks, great work again
#9
04/03/2005 (9:57 am)
@Matt
Do you think this could be extended to work with simple (pacman) maze pathfinding? From what you described, I don't think it'd work with a pacman maze. At least not efficently. But then again, I have no idea where to even begin with pathfinding scripting. So I could be wrong on all kinds of levels :).