Facepunch / garrysmod-issues

Garry's Mod issue tracker
147 stars 56 forks source link

Additional ai-nodes in ain file do not link with the original ones #5514

Closed ExboCooope closed 1 year ago

ExboCooope commented 1 year ago

When try to add nodes in some map to fix connection issues, new added nodes will not link with the buildin ones. In really old version (2016) it was fine, and now the added node maps are broken.

20230707204821_1_info In map d1_canals_08, about the picture, the left side's origin nodes have broken links so i removed them all and added my own node. The green lines "ai_show_connect" indicate the links are successfully loaded, but the purple lines "ai_show_graph_connect" indicate that only the new nodes themself are linked with each other, and the npc_go will fail between origin node and new node

d1_canals_08.txt rename the file to d1_canals_08.ain and put into maps/graphs/

robotboy655 commented 1 year ago

I don't know where you are getting this idea of "old nodes" and "new additional nodes". All of the nodes are stored in that file. There are no "additional nodes" loaded from elsewhere.

The green lines are the "allowed connections". The purple lines are possible connections. If you didn't notice, there are objects that cannot be walked through in the way of your purple lines that do not have an accompanying green line.

Since the NPCs would not be able to walk on those lines, obviously the connection cannot be made or "allowed". image

The NPCs can walk around the obstacles using the green lines, which they do: image

ExboCooope commented 1 year ago

I don't know where you are getting this idea of "old nodes" and "new additional nodes". All of the nodes are stored in that file. There are no "additional nodes" loaded from elsewhere.

The green lines are the "allowed connections". The purple lines are possible connections. If you didn't notice, there are objects that cannot be walked through in the way of your purple lines that do not have an accompanying green line.

Since the NPCs would not be able to walk on those lines, obviously the connection cannot be made or "allowed". image

The NPCs can walk around the obstacles using the green lines, which they do: image

This is the old graph if you delete the ain file and the game recreates one. 20230711223435_1

Remove nodes using nodegraph editor 20230711223625_1

Plot some new nodes and links 20230711223704_1

Save the ain file and reload map, those links between new nodes and old nodes are not working 20230711224857_1

d1_canals_08.txt

robotboy655 commented 1 year ago

It is literally the file you sent above.

But I see what you mean. The issue is entirely with the tool you are using, it is not generating a correct node graph.

The nodes you add are considered in an "unknown zone", zones being isolated navigation meshes from each other. So, since the nodes are in different zones, the path finding quickly fails, since the NPC would not be able to walk from one isolated area to another, even if the nodes are visually connected.

Looking at the source code for the tool, it completely ignores the zoning data. The old tool has the exact same issue.

It SHOULD be a fairly easy fix for the tool's author, if they know what they are doing, to simply copy the zone ID from the nodes it is connecting to when placing a node.

And no, it "didn't used to work before".

ExboCooope commented 1 year ago

Thanks, fixed by setting all node to zone 0

robotboy655 commented 1 year ago

That's a bad idea, as NPCs will now try to walk through unwalkable places (or the pathfinding will timeout and fail), but do as you like.

ExboCooope commented 1 year ago

Actually noding a map mostly means to make a single connected graph so it doesn't matter But I really think in the old version the 'zone' might not fuctioning because I fixed the gm_floatingworlds_3 (2015/10/2) broken node network near the castle and played with npc, in that day the ain file in game folder still can override the one in bsp