Game Development Community

Getting terrain and interior data for pathfinding

by Stefan Beffy Moises · in Torque Game Engine · 06/17/2002 (1:22 pm) · 4 replies

Howdy!
Well, I'm trying to get a basic AStar algorithm into Torque - actually the algorithm is in, but now I have to feed it with a data structure (which is normally a "grid" with simple xy values).

So my question is: where is the best place in the rendering pipeline to get the polys that make up the terrain surface and the static objects (interiors) placed on the terrain, so that I can set up a "navigation mesh" containing the position of the vertices/edges/polys (the height information will then be projected down to the surface, see Game Programming Gems for further explanation of the "nav mesh / carpet" concept if you have it...) to put them into my own datastructure to feed my algorithm with it?

Say, I get a bunch or triangles representing a piece of terrain, then I can "merge" the xy position with the slope and projected height information and finally get a datastructure telling my algorithm something like: "Point 349,281 is walkable, Point 366, 145 isn't because their is an interior which is too high to walk over it" etc. etc.
In one sentence: where do I get this data without too much pain? (scenegraph? terrain / interior classes themselves? somewhere else?)

Does this make any sense? Jeez, guess not... but it's so damn hot here.... 8-)
Thanks for any ideas! Or for some rain... ;-)

#1
06/17/2002 (5:01 pm)
Ive got some input,

first off there are a ton of ways to do this.

I think I would use the mission group to find the object.
ie: terrain, interior.

this is not a big deal, a possible one time investment with maybe storing the nav mesh.
#2
06/18/2002 (1:01 am)
Well, finding the terrain and interiors is not a big deal, yes...
you could use a simple SimSetItr like this:
for (SimSetIterator itr(conn); *itr && !terrBlk; ++itr)
   if ((*itr)->getType() & TerrainObjectType ) terrBlk = static_cast<TerrainBlock*>(*itr);
and
for (SimSetIterator itr(conn); *itr; ++itr) {
   if ((*itr)->getType() & InteriorObjectType) {
,
but I'm not really sure how to subdivide/partition them (get their "polygon structure" and divide it into reasonable "chunks") after I found them....
hm, guess I'll just go ahead and play around with it :-)
Anybody knows what TerrainBlock::buildGridMap(), TerrainBlock::packEmptySquares() or TerrainBlock::buildPolyList() do exactly?? Sounds like they could be useful...
Anyhow, thanks for your feedback!
#3
06/19/2002 (12:28 am)
Any terrain experts out there? :-)
#4
11/23/2002 (1:33 am)
Heya... dunno bout the terrain, but I'm working on something similar for interiors.. just noticed you can generate navigation graph only with map2dif... command argument -g, dunno if that'll help ya or not...