How is pathfinding implemented in Bannerlord?

Users who are viewing this thread

If you tried a siege in BL then you'd understand.(and I don't meant to be offensive here)
If not, from what i recall the pathfinding is pretty poorly made and in sieges units either all group up in a small area or ignore dangers around them while still doing their "chores"(shooting arrows, shield wall by the gate etc). The list can go on..
ok now I get what you mean:pathfinding in Bannerlord performs poorly, that's what I knew. What I'm trying to ask is like how exactly does the pathfinding in Bannerlord works, like how the route is computed/how the algorithm is designed.
I wonder if title of this post is misleading, not a English native speaker.
Now I changed the title, hopefully this new title won't lead to ambiguity again
 
I just don't understand why devs try to make it complicated...

Entry positions to castle/town are predetermined and limited to:
2x Siege tower landing zones
2x Breached walls
1x Gatehouse

Spawn points for defenders are also predetermined let's say:
A
B
C


According to each map's spawn point location's relative distance to entry positio an example logic should be:

Considering A is closer to Siege tower landing A and Gatehouse ;
If spawn in A run to Siege tower landing A or Gatehouse, if in perimeter of enemy attack.


Simple as that...
 
ok now I get what you mean:pathfinding in Bannerlord performs poorly, that's what I knew. What I'm trying to ask is like how exactly does the pathfinding in Bannerlord works, like how the route is computed/how the algorithm is designed.
I wonder if title of this post is misleading, not a English native speaker.
Now I changed the title, hopefully this new title won't lead to ambiguity again
I don't really know, but i think the paths for each scene are custom made(?) and AI just follow them but they encounter errors along the way, maybe as i said bumping into other units, sometimes ignoring what's happening around them and so on. I saw a while ago a dev response on pathfinding but don't remember when so sry for that.
I just don't understand why devs try to make it complicated...

Entry positions to castle/town are predetermined and limited to:
2x Siege tower landing zones
2x Breached walls
1x Gatehouse

Spawn points for defenders are also predetermined let's say:
A
B
C


According to each map's spawn point location's relative distance to entry positio an example logic should be:

Considering A is closer to Siege tower landing A and Gatehouse ;
If spawn in A run to Siege tower landing A or Gatehouse, if in perimeter of enemy attack.


Simple as that...
images

Not the best at pathfinding algorithms but what you described might for for small numbers, say a soldier in every position but when you have 300 men bumping into each other's path they end up breaking each other as it happens now.
 
ok now I get what you mean:pathfinding in Bannerlord performs poorly, that's what I knew. What I'm trying to ask is like how exactly does the pathfinding in Bannerlord works, like how the route is computed/how the algorithm is designed.
I wonder if title of this post is misleading, not a English native speaker.
Now I changed the title, hopefully this new title won't lead to ambiguity again
Nah, it's not misleading, we're just joking around because we grew bitter with this game's development
 
I don't really know, but i think the paths for each scene are custom made(?) and AI just follow them but they encounter errors along the way, maybe as i said bumping into other units, sometimes ignoring what's happening around them and so on. I saw a while ago a dev response on pathfinding but don't remember when so sry for that.

images

Not the best at pathfinding algorithms but what you described might for for small numbers, say a soldier in every position but when you have 300 men bumping into each other's path they end up breaking each other as it happens now.
When do you see 300 men spawn for reinforcement? Most of the time max defenders are 200-500 anyway... If you play at 1000 agents cap, it means 500 defenders would be spawned already so no reinforcements, if you plan on lowest cap which is 100, defender reinforcements will be minimal and limited to 50 max. If let's say you play on 500 agents cap, then it'll leave 200-300 of these agents to defenders, considering spawns don't wait for all defenders to die, it again won't happen.
 
AI is retarded in bannerlord, neither we nor devs should expect complicated calculations from them.

It should be simple, first of all Idk how design works for siege but we all agree on there are predetermined spawn points and entry points that needs to be defended.

First decision to be made, where to spawn the reinforcements, this can be done by sending how many defender/attacker in 50 meter radius of an entry point to function, and prioritize to choose a spawn point that is closer to problematic entry point.

It can be adjusted maybe you put ratios like %50 of reinforcements to 1st promlematic entry point, %30 to 2nd, %20 to 3rd etc...

Then AI pathfinding, it should be just directing AI to run to position, with an exception rule "If within the radius of enemy, override running order and attack!)

End result would be defenders that actually defend instead of 3 year olds trying to figure out how to go to the tower that is not being under attack...

Devs are wasting too much time and work on putting ideas to soldiers' minds, which contradicts the whole concept of war, a soldier shouldn't think, there are generals and kings to do that, soldier should FIGHT and we're missing this core aspect in bannerlord.
 
That sounds weired to me. Refer to what I read, mesh is supposed to be defined as convex polygon, which means obstacles are not supposed to exist between two points within the same mesh. If the obstacles exist on boundry of inter-mesh boundry, then this two mesh is not supposed to be linked, therefore a direct route goes from A to B is not supposed to be returned by the algorithm.
I found that video without too much searching, it may not be the perfect example for what i'm trying to say :smile: What you said is true and i confused cylinder's movement around moving obstacles with algorithmic imperfection.
And to correct my language, I mean I don't understand why defining navmesh can require large amount of manual adjustment, not only for M&B, but in general.
The video has one player cylinder, for moving boxes and an even terrain. M&B games have hundred of moving units with complex models and animations and scenes contain uneven terrain and whatever else. Add the minimum and optimum system requirements to the list of limitations then you have a large amount of complexity for this issue. I wrote this before
I don't mean that pathfinding algorithm is the most resource eating thing. It could have a small effect on performance and there might be more downgrades. I also don't think downgrading pathfinding algorithm must be only motivated by performance concerns. Think about Cyberpunk 2077, players say ai controlled cars can't drive around you when you stand in front of them. Developers may have no time to spare or the current state of code might not allow easy addition of such system. Lots of different possibilities.
I'm talking about the patfinding algorithms in general, not about navmeshes in particular.
It has been long since I learnt about parallel processing and I don't remember much about that. Kind of confused about if M&B was utilizing that, and why if not, since from what I can remember, using parallel processing to do pathfinding is supposed to help performance.
You can split a work into small parts and do each of them on seperate threads. Modern GPU's have way more cores than the CPU's. It takes less time to split time-consuming chores into multiple threads and make them done on GPU. I'm just talking about a general programming idea here.

Edit: A little bit of google search reveals the mechanics of the pathfinding.
Here an old member has a scening tutorial which he explains the mechanics:
A word about AI meshes:

AI meshes are the pathfinding meshes. It walks over these AI meshes to get at an enemy. AI Barriers are used to not make AI's fall of ladders, while players can jump off than, unlike when placing normal barriers.
Best way to make AI meshes on walls and through buildings is by going to Edge mode and extrude them.
If an AI mesh goes through a building, the AI will think they can pass through that building to get at an enemy, so don't do that. If an enemy is on a place without AI meshes, the AI will go to the AI mesh closest to him, and tries to reach him from there. If the bot gets off the AI grid, he will try to get to the closest AI mesh, sometimes being at the other side of the wall, thus bots gets stuck under ladders. Also add AI meshes under ladders that lead them back to the ladder.
There are 2 documentation sites for Bannerlord. One is created by forum member Ster im March 2020 docs.bannerlordmodding.com.
Other one is the official one. docs.modding.bannerlord.com. In the official website bannerlord missions -> what makes a village scene
sections explains how navigation meshes work in bannerlord.
Depending on what's written on these links, i can say both games uses navigation meshes for pathfinding.
I wonder why nobody mentioned that before :???:
 
Last edited:
Back
Top Bottom