by date
Plan for Stefan Beffy Moises
Plan for Stefan Beffy Moises
| Name: | Stefan Beffy Moises | ![]() |
|---|---|---|
| Date Posted: | May 15, 2004 | |
| Rating: | 5.0 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Stefan Beffy Moises |
Blog post
small AI Pathfinding update
Hi again, just a quick update to the AI navigation stuff I'm currently working on... I've been playing with Ken Finney's sweet little fxSurfaceReference object.
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?
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?
Recent Blog Posts
| List: | 11/30/08 - Diggers Shop moved 05/20/08 - Horsepack TGEA 1.7.0 update! 10/15/07 - Free giveaway for horsepack owners - "accouterments of knighthood" horse armor 10/06/07 - "Seawolf" Submarine Content Pack available NOW! 07/06/07 - Horsepack TGEA port, Seawolf Submarine progress 06/04/07 - AI Antelope - Sealife/Submarine Pack - PodRacer Pack 05/24/07 - "Project: Seawolf" - Submarine / Sea Life Content Pack by the 3D-Diggers 04/25/07 - Horsepack released!! |
|---|
Submit your own resources!| Steven Jackson (May 15, 2004 at 14:53 GMT) Resource Rating: 5 |
| John \"Johnny Action\" Aho (May 15, 2004 at 18:00 GMT) |
| Ben Garney (May 15, 2004 at 18:33 GMT) |
| Justin Mette (May 15, 2004 at 21:55 GMT) Resource Rating: 5 |
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.
Edited on May 15, 2004 21:57 GMT
| Stefan Beffy Moises (May 15, 2004 at 23:16 GMT) |
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!
| Stefan Beffy Moises (May 17, 2004 at 05:46 GMT) |



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! :)
Edited on May 17, 2004 05:48 GMT
| Stefan Beffy Moises (May 19, 2004 at 11:48 GMT) |
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)
Edited on May 19, 2004 11:49 GMT
You must be a member and be logged in to either append comments or rate this resource.



5.0 out of 5


