Plan for Stefan Beffy Moises
05/15/2004 (2:21 pm) by Stefan Beffy Moises
While it's designed to be used for foliage replication mainly, I thought why not use it for the navmesh generation for our AI pathfinding... so that the level designer could just paste a certain texture onto the terrain to make the AI "avoid" this area (in addition to the "blocker" markers I've mentioned in my last .plan).
So I went ahead and implemented it into our navmesh generation code and it seems to work quite well - I've tried it with a simple grass texture, which doesnt really make sense, but I only wanted to have a "proof of concept" that this idea is actually working:

So now we dont have any nodes created at spots where it finds exactly that texture - nice :)



It does, however, create the links between nodes around those "spots", so, while there is no node on that texture, sometimes the link/edge goes over the texture, so it cant be guaranteed that the bots really dont touch the texture... not sure yet how to prevent this...
one workaround is to only link nodes that arent more than X world units apart from each other, so chances are that if you have larger spots covered with your "avoid texture", nodes around the spot wont be linked across it... but that isnt the ideal solution here I guess...
Anyway, I think its an interesting concept and can help the leveldesigner configure the auto-generated navmesh...
JiuQ had the idea to use a heightmap as an alternative, where you would mark the unpassable areas witch black/gray and the passable areas in white e.g. - would be interesting, too, I think... :)
but I find the texture painting to be easier / more precise... what do you think?
About the author
I have a strong knowledge in Java / JSP / XML / XSL / C++ / DHTML / Javascript / PHP/ C#/.NET / 3D-/Gameprogramming / AI etc. Within the last five years I have worked for clients such as Siemens, Grundig, Varta, Agfa, BSW, IHK, Moeller, Rhenus, Pixon Interactive, Schuhfried, etc. I have been working for a German Internet / Software company for four years and am self-employed since May 2003. I am working with the Torque Game Engine since early 2002, worked on some content packs, different game projects like flight sims, racing games, a horse game etc. I have received [b]GG Associate[/b] status in 2003. Currently I am working on some Torque Game Engine projects as well as different internet projects. I have also written the [b]TIDE Jedit plugin[/b] for Torque scripting and debugging together with Paul Dana. I am available as contractor for game programming / scripting and internet related programming. [gge_user=beffy] view profile »
Extending that thought; maybe more than just the mid-point of that vector should be checked because those vectors are kind of long in more open areas of the terrain.
There is some commented out code at the end of AINavGraph::filterLink() which may be useful here. It's the last block of commented code in that function titled "check to see if there is enough room".
I was originally trying out an idea for filtering links based on slope changes between the nodes. That really didnt work out but I left the code in there because I thought it might be useful later down the line.
The code will break up a vector into one unit intervals; casting a ray from each interval location down to the terrian. In this case it checks the distance from that interval point to the terrain, which you won't really need. The code which walks a vector, casting rays to the ground however might be useful.
Anyway, cool stuff. I'm actually going to rate this plan - awe yeah.
But your "walking a vector" and breaking it down to multiple checks is awesome, Justin, gonna try that tomorrow when I'm back home :)
And yeah, I like the terrain texturing best, too, since thats really easy to do :)
thx for your thoughts everyone!



And of course, you dont have to exclude textures, you can also restrict the navmesh to a certain texture like this:

Sweet! Thanks a lot to Ken C. Finney for this nice tool! :)
since we are generating the navgraph on the server only and the process is taking place at the start of the mission loading, unfortumately we can't really use Ken's twSurfaceRef object (since that works entirely client-side and requires the objects being ghosted already etc.)... so I wrote a new object, a SurfaceMarker (based on Ken's stuff) ... you can now add up to 16 of those to each mission (and therefore distinguish between 16 surface types / texture blends) and configure in the navgraph if it should avoid the marked surfaces/textures OR generate Nodes on these surfaces exclusively... it's basically just an invisble marker object which stores the texture information at its position:

Works very well in Multiplayer it seems (gotta test it on a dedicated server still though, but I don't see a problem there either)

Torque Owner Steven Jackson