Lastly, there are two ways you can approachAnd this: coarse-grained quantisation of your level space, and fine-grained leads to 3 rough approaches that I've come across in my work.
Arbitrary node placement within a static level is super, if your constraints allow it. This is where you can place your nodes at any point in floating point space. This would be where you have level designers constructing your (static) levels. Here, the simplest and most sensible solution is to have them specify via editor or data file, nodes that represent portals inside your pathing graph. Obviously in this case it is also up to level designers to ensure that the geometry of the level is suited to that pathing which is put in place (usually you would do the level geom first, then lay pathing nodes over that to ensure the nodes are in all the right places and no others).
A coarseCoarse-grained gridgrids are used when a more dynamic approach to pathfinding is onerequired, such as where eachthe level is either procedurally generated, and/or where it can change at runtime. Here, you need intelligence built in to detect what might be considered a "portal" in your grid of potential pathfinding nodes. Each cell in the grid you divided your level into, is at least as big as each entity you have moving around. In this case, it's very easy: wherever a cell has just two non-adjacent neighbours, it's single width, and you can assume that, if the previously walked cell had more than that, you've reached a narrowing point that you can call a portal. The downside? Particularly if your level is dynamic and you don't tend to match walls exactly to grid cell edges, you'll find there are times when geometrically it is clear that an entity could pass from one cell to another, but in terms of the pathfinding graph, due to its resolution and origin position, the pathing-evaluator simply can't detect the connectedness of two adjacent cells. This may not be a problem for you, however.
A fineFine grained gridgrids is one where everyare used in the same circumstances as coarse-grained grids, but with the added constraint that you don't want your pathfinding nodes to be so clearly delimited into low-res tiles. So each cell is smaller than the entities in question, is a lot more complicated...
In the procedural case, or in a case where your initial level may be manually-constructed, but can be changed later (as is the case with destructible terrain), you need intelligence built in to detect what might be considered a "portal". This sounds aa lot easier than it actually is, geometrically speaking. Consider a cave complex constructed, throughout, of the same homogenous material. Say you use some form of noise to generate spaces inside a level-sized block of solid rock, and then used some sort of coherence/metaball approach to join the closest points of these spaces. Now bearing in mind that your pathfinding grid resolution is finer than the size of a single entity, some of these join channels are going to be narrower thantoo narrow for an entity to pass (even though air could pass through), while others might not. This will vary at different points along the channel, and in different places. Youyou can see how the shape of entities can also affect where they might be able to traverse and where they might not. This is quite a problem in 3D; in 2D, it's a lot easier to handle but still not trivial. One way to make things easier in both cases is to assume either a square (cubic) or circular (spherical) bounding volume for each entity.