I have taken a look into your gamemode. Unfortunately, your graph has a few issues, wich breaks the algorithm.
First, nodes[0] is 0 and not a vector, wich breaks the algorithm, since the number 0 has always distance 0 to everything, no matter what. I could add a condition for my algorithm wich filters the zeros from the array, but it’s not yet fixed. As a workaround, you could put a vector wich is below the ground as nodes[0]. Later you might be able to put an actual valid node into that index.
Second, there are some connections (edges) going through walls, wich you can see when you put your graph into my graph creation tool. Those shouldn’t exist, since it will tell the bots that they can walk through these walls, when they actually can’t.
You need to rework your graph.
When you do so you can make your life a little easier by only adding one edge between to nodes to connect them. You only need 2 edges (both directions) if you are using the directed version of my algorithm, wich you didn’t.
For the testing in your gamemode you should temporarily disable the other rules that make the dummy bots walk or add a condition event player.mode == 1
to them, so you can toggle between pathfinding movement (event player.mode == 2
) and your custom movement.
Also, you need to fix the last 4 actions of the dummy spawn rule:
Variablen
{
player:
27: pathTarget
}
aktionen
{
Players In Slot(0, Team 2).pathTarget = Position Of(Players In Slot(0, Team 1));
}
The “pathTarget” variable of the dummy bot (mercy on slot 0 team 2 in this case) needs to be set to the position the bot will move to (the position of the player in this case).
aktionen
{
Start Camera(Players In Slot(0, Team 1), Ray Cast Hit Position(Eye Position(Players In Slot(0, Team 2)), Eye Position(
Players In Slot(0, Team 2)) + Facing Direction Of(Players In Slot(0, Team 1)) * -2, Null, All Players(All Teams), False),
Eye Position(Players In Slot(0, Team 2)) + Facing Direction Of(Players In Slot(0, Team 1)), 50);
}
This is a debug action to see what the bot is doing while pathfinding (I replaced “event player” with the mercy bot here). Feel free to remove it.
Variablen
{
player:
26: mode
28: pathPhase
}
aktionen
{
Players In Slot(0, Team 2).pathPhase = 0;
Players In Slot(0, Team 2).mode = 2;
}
These 2 player variables need to be set for the dummy bot (the mercy bot in this case) to start the pathfinding algorithm for this bot.
I hope this will help you fixing your gamemode
Note: If you experience high server load and crashes when multiple bots pathfind at the same time, add a short wait action to the rule “P compute path (unweighted undirected graph)” as the second last action (before the End;
and after the Event Player.pathNodesVisited[Event Player.pathCurrentNode] = 1;
)