Pathfinding and A* resource
by Bloodknight · in Torque 3D Professional · 02/04/2011 (7:17 pm) · 9 replies
This one, www.garagegames.com/community/resource/view/14558/
When I got to this resource most of the links to files were gone, so there's no 'complete' set of files for any particular engine. I cobbled together what files I could and set to trying to get this implemented in 1.1 B3, as people in irc already know, this beast has been giving me all kinds of trouble. I have no reached a point where I'm completely stuck. So where Am I at and what's broken.
Well firstly what's working?
The navmesh creation and editing is working fine, writing it to its binary file and its reloading into the mission seems to be working fine.
the navmesh isn't rendering, in fact its worse than that it seems to be rendering its own shadows which just confuses me more.

This is what it should look like in normal mode (this is displayed in wireframe mode)
here's the render code, nothing throws ugly errors, it just doesn't work right and I don't understand why.
The next problem I have is that for some reason the path is not being passed to the wander function this causes the wander function in astar.cpp to assert because of an empty vector, this is almost certainly because I only have an old TGEA aiplayer.cpp to merge with.
So as you can see I need a bunch of files that match and/or a bunch of help
When I got to this resource most of the links to files were gone, so there's no 'complete' set of files for any particular engine. I cobbled together what files I could and set to trying to get this implemented in 1.1 B3, as people in irc already know, this beast has been giving me all kinds of trouble. I have no reached a point where I'm completely stuck. So where Am I at and what's broken.
Well firstly what's working?
The navmesh creation and editing is working fine, writing it to its binary file and its reloading into the mission seems to be working fine.
the navmesh isn't rendering, in fact its worse than that it seems to be rendering its own shadows which just confuses me more.

This is what it should look like in normal mode (this is displayed in wireframe mode)
here's the render code, nothing throws ugly errors, it just doesn't work right and I don't understand why.void AStar::render(SceneState* state)
{
if (!Con::getBoolVariable("$pref::AStar::Render", false))
return;
int i;
for (NMPoint* tmp = list; tmp; tmp = tmp->next) //iterate thru list
{
PrimBuild::begin( GFXLineList, 2 );
PrimBuild::color3f( 0, 1, 0 );
PrimBuild::vertex3f(tmp->loc.x, tmp->loc.y, tmp->loc.z);
PrimBuild::vertex3f(tmp->loc.x, tmp->loc.y, tmp->loc.z-1);
PrimBuild::end();
for (i=0; i<8; i++)
{
if (!tmp->adjs[i])
continue;
PrimBuild::begin( GFXLineList, 2 );
PrimBuild::color3f( 0, 0, 1 );
PrimBuild::vertex3f(tmp->loc.x, tmp->loc.y, tmp->loc.z);
PrimBuild::vertex3f(tmp->adjs[i]->loc.x, tmp->adjs[i]->loc.y, tmp->adjs[i]->loc.z-1);
PrimBuild::end();
}
}
}The next problem I have is that for some reason the path is not being passed to the wander function this causes the wander function in astar.cpp to assert because of an empty vector, this is almost certainly because I only have an old TGEA aiplayer.cpp to merge with.
So as you can see I need a bunch of files that match and/or a bunch of help
About the author
#2
Also, if anybody who had this working in 1.0 could give me a copy of the aiplayer.cpp/h or even the full resource that's working with 1.0 that would be great, if I could get a working version in almost any engine I could make a comparison fix this and get the resource page updated.
02/06/2011 (8:20 am)
Updated original post, I'm told this was working fine in 1.0, so it seems either the rendering system was changed or a bug was introduced. I'm not really sure I care which, as long as i can get this running the way it was designed.Also, if anybody who had this working in 1.0 could give me a copy of the aiplayer.cpp/h or even the full resource that's working with 1.0 that would be great, if I could get a working version in almost any engine I could make a comparison fix this and get the resource page updated.
#3
it has a bit more than just the changes for aStar, but youll work it out.
you may even want to keep the extra changes, they add a lot of extra functionality, like Z movement, for flying.
I had the aStar playing with the UAISK with the extra changes....
aiPlayer.cpp
and
aiPlayer.h
cheers
EDIT:
I just checked, it compiles fine in 1.1b3 as is, just correct this
PS: if you do get the aStar working correctly in 1.1b3, it would be great if you could share with us...
02/06/2011 (9:56 am)
you are welcome to my aiPlayer from 1.0, BloodKnight.it has a bit more than just the changes for aStar, but youll work it out.
you may even want to keep the extra changes, they add a lot of extra functionality, like Z movement, for flying.
I had the aStar playing with the UAISK with the extra changes....
aiPlayer.cpp
and
aiPlayer.h
cheers
EDIT:
I just checked, it compiles fine in 1.1b3 as is, just correct this
#include "T3D/moveManager.h"to be
#include "T3D/gameBase/moveManager.h"
PS: if you do get the aStar working correctly in 1.1b3, it would be great if you could share with us...
#4
The rendering still doesn't work though even in 1.0.1, I suspect that we are working off slightly different versions of astar.cpp/h.
if i could impose again, could you compare your render function to the one i have posted above.
for reference i'm using the files posted by Adam Beer found here www.garagegames.com/community/resources/view/14558/8#comment-140013
02/07/2011 (12:09 pm)
those work perfectly deepscratch thanks :) i clearly screwed up something porting the TGE versions to T3D.The rendering still doesn't work though even in 1.0.1, I suspect that we are working off slightly different versions of astar.cpp/h.
if i could impose again, could you compare your render function to the one i have posted above.
for reference i'm using the files posted by Adam Beer found here www.garagegames.com/community/resources/view/14558/8#comment-140013
#5
did you get it working?
mine renders a nice blue mesh,
let me know if you still need the render function.
03/07/2011 (11:13 am)
Bloodknight,did you get it working?
mine renders a nice blue mesh,
let me know if you still need the render function.
#6
im wondering is this the ai pathfinding system where you can run around dropping nodes? like in the source engine?
im looking for something that can handle complex fps interiors and walkways and stuff, is this suitable ?
08/11/2011 (2:52 am)
hello all im wondering is this the ai pathfinding system where you can run around dropping nodes? like in the source engine?
im looking for something that can handle complex fps interiors and walkways and stuff, is this suitable ?
#8
thats the one i was lookin for, do you know if it works with the uaisk ?
08/11/2011 (12:07 pm)
thanks Steve thats the one i was lookin for, do you know if it works with the uaisk ?
#9
08/11/2011 (12:29 pm)
No idea about UAISK, I make my own AI solutions.
Torque 3D Owner Chris