Ask a Question related to Macromedia Director 3D, Design and Development.
-
Mazuho #1
3d Pathfinding
I have scavenged the net for information in how to apply the Astar pathfinding
algorithm to shockwave 3d. Although I didn't find any examples at all for the
3d part, I found a couple meant for 2d pathfinding.
So I decided to write a tutorial with code examples just for Shockwave 3d
and lingo since this is something I think would help many in their game
developing. And the more people developing stuff in Director, the more (much
needed) attention towards the great program.
But here comes the catch; I don't really know how to implement it to 3d
myself. For starters, I'm just going to make it simple, no obstacles that cost
more to pass, just fair and square a -> b.
So for step one I understand that I need to divide my terrain into a grid,
let's say 100 x 100. What would be the easiest way for this? Using lists?
Nothing advanced now, no height changes, the ground I am using now is just a
large plane object.
So for the greater good, please share your 2 cents!
Mazuho Guest
-
3D Pathfinding without a grid or nodes question andsuggestions
I am currently developing an RTS game and wish to incorporate pathfinding into the movable units. The problem is that all pathfinding algorithm... -
necromanthus #2
Re: 3d Pathfinding
I don't use A-star, but an old and very talented shockwave developer (aka
MEDION) has a great tutorial on this subject:
[url]http://www.station-zero.com/medion/demos/pathfind.htm[/url]
[url]http://www.station-zero.com/medion/demos/pathfind.zip[/url]
a tip: to decrease the requested processing power, divide the world into
several zones (sectors) and use few predefined paths.
necromanthus Guest
-
Mazuho #3
Re: 3d Pathfinding
Thanks for that example, it gave me a lot of reading last night =).
I have read all the code now, and I understand most of it. But what I don't
understand is how I can generate the text member that contains all the nodes,
which sectors they belong to and all the vectors for all the nodes. Surely he
didn't write all that by hand? So is there a step I have missed maybe between
exporting and importing the map? Because the code in Director relied on this
member, so it couldn't have been generated using any of the code already
there...
Progress update: I now know how to move a pre-selected object from a -> b with
interpolation. Only works good on a planar object.
Next step: Get to grips with everything that pathfinding involves in MEDION's
example. A really good example, thanks necromanthus!
Mazuho Guest
-
Mazuho #4
Re: 3d Pathfinding
Okay, now I know where the exported info came from. But I'm going to use
director to collect the info that I need. I have made 94 dummies in 3dsmax and
now I am trying to save the info of these "nodes" into lists. For the
worldpositions it works, I get the vectors. But when I check for neighbouring
nodes in all the axes, I only get emptyness. Here's the script I use. Note that
I am only going to use this script once, as I'll save all the info in a text
cast member when it is working.
on startmovie
w = member("pathfindtest")
groupc = w.group.count
tlist =
repeat with i = 1 to groupc
if w.group.name contains "node" then
nnode = nnode + 1
tlist.addprop("node"&(string(nnode)), w.group.worldposition)
neighb1 = w.modelsunderray(w.group.worldposition, vector(1,0,0), 1,
#detailed)
neighb2 = w.modelsunderray(w.group.worldposition, vector(-1,0,0), 1,
#detailed)
neighb3 = w.modelsunderray(w.group.worldposition, vector(0,1,0), 1,
#detailed)
neighb4 = w.modelsunderray(w.group.worldposition, vector(0,-1,0), 1,
#detailed)
neighb5 = w.modelsunderray(w.group.worldposition, vector(0,0,1), 1,
#detailed)
neighb6 = w.modelsunderray(w.group.worldposition, vector(0,0,-1), 1,
#detailed)
put neighb1
if neighb1.count > 0 then
if neighb1.name contains "node" then
tlist.addprop("neighbour1"&(string(nnode)), neighb1)
end if
end if
if neighb2.count > 0 then
if neighb2.name contains "node" then
tlist.addprop("neighbour2"&(string(nnode)), neighb2)
end if
end if
if neighb3.count > 0 then
if neighb3.name contains "node" then
tlist.addprop("neighbour3"&(string(nnode)), neighb3)
end if
end if
if neighb4.count > 0 then
if neighb4.name contains "node" then
tlist.addprop("neighb4"&(string(nnode)), neighb4)
end if
end if
if neighb5.count > 0 then
if neighb5.name contains "node" then
tlist.addprop("neighb5"&(string(nnode)), neighb5)
end if
end if
if neighb6.count > 0 then
if neighb6.name contains "node" then
tlist.addprop("neighb6"&(string(nnode)), neighb6)
end if
end if
end if
end repeat
put tlist
end startmovie
Mazuho Guest



Reply With Quote

