Jenna WSI wrote...
And is there anything that explains pathnodes and pathfinding at the basic levels? Really new to understanding it and we do use placables in bunches to create a scene.
The short, convenient answer (assuming the reader knows nothing about WOKmeshes, pathnodes or pathing):
There are two types of pathing in NWN and whether it's the first type or the first and second type combined depends entirely on where a player or creature is moving
to:
The
first type is
intra-tile and involves pathing inside the confines of an individual tile. For this pathing the WOKmesh is consulted. The WOKmesh is very granular and specific about what triangles on the mesh can and cannot be traversed, any special effects to play (like puffs of dust) when they are traversed, or whether they block line-of-sight, etc. A WOKmesh is part of the 3D model of each tile and although it is invisible to the player in-game, it can be revealed by using the debug console command
renderaabb 1. Here is a sample WOKmesh for a tile and to simplify things we'll say that green means walkable and gray means not walkable and line-of-sight blocking:
The
second type is
inter-tile and it involves pathing between two or more tiles. For this pathing the pathnodes are consulted, a path is plotted and then the WOKmeshes for each tile are consulted as the actual traversal takes place.
Inter-tile pathing +
intra-tile pathing = "full path", the actual path that the PC will
attempt to take. A pathnode is very general and merely identifies where the exits on a tile should be. It does not know exactly what is between the start and the destination, only generally how to get there. Individual pathnodes have to be programmed into the engine but there are about 30-40 to use, each describing some combination of exits from a tile. A pathnode is defined in that tileset's .SET file, one pathnode for each tile and a rotation because the tile might be rotated. A general indicator of the tile pathing in an area can be revealed by using the debug console command
rendertilepathnodes 1. Here are a few tiles from Rural and the pathnodes (and their names, which are letters) for them:
Remember pathnodes tell the engine about
exits from a tile. The
black lines are an oversimplified indicator that it is expected that the more granular WOKmesh will allow pathing into the tile from a particular side and (if the black lines connect) will allow an exit from a particular side.
Now I'm going to say something that's not entirely true*. But, like classical mechanics in physics, it's going to get you
most of the way there. And that's this: If you put down placeables in the white areas of your tiles, as described by the pathnodes, you will have a much lower probability** of interfering with pathfinding than if you place them where the black lines are. Within about 2 game meters or so (each tile is 10 game meters on a side), anyway.
Here are four pathnodes, let's pretend these represent 4 tiles next to each other in a 2 x 2 area:
Consider the right side of pathnode
I and the right and top sides of pathnode
H. In those examples what I describe (about placeable placement) should become a little clearer because the entire rigth side of those tiles is not expected to provide an exit. So, if the player is traversing them the you will have much better luck putting down more placeables on their right side than on their left, tops (at least for
I) or bottoms.
** Why did I say probability instead of certainty? Because
inter-tile pathing results in the "full path" which is both the generality of the pathnodes about how to get there and the granularity of the WOKmesh. Also, for an area to traverse that's filled with something like the A pathnode (at least) you can easily walk diagnally across tiles without the pathing being obvious. How all this gets calculated depends on the starting spot the player is in, the number and shape (equilateral or something close to it versus a Scaline) of the triangles, non-walkable spots on the walkmesh and any on-the-fly modifications because of placeables or moving creatures. For instance, a bunch of long thin little triangles can really screw with the pathing algorithm. Bioware tiles are usually made from the pathnode on up and have good WOKmeshes. Usually. Your mileage may vary with community content, depending on how much care they give to such things.
* Ok, well if that's not entirely the truth, what
is the truth?
Glad you asked! Like a couple of the geniuses who originally designed NWN, Dr. Mark Brockington (Bioware's 'Lead Research Scientist' on the NWN project) wrote a few extremely informative articles about the inner workings of Neverwinter Nights which include information about his pathfinding algoritms and how NWN uses Level of Detail for the AI/pathfinding.
By Mark Brockington:
Level-Of-Detail AI for a Large Role-Playing GameBTW, the LOD he describes for AI in this paper appears to directly map to the Get/SetAILevel functions in NWScript and give you a much clearer idea of what impact they have, especially in regards to pathing.
Pawn Captures Wyvern: How Computer Chess Can Improve Your PathfindingI assume the tree he talks about is the BSP tree in the WOKmesh but I don't know.
Modifié par Inayity, 26 décembre 2010 - 08:03 .