• If you are reporting a bug, please head over to our Technical Support section for Bannerlord.
  • Please note that we've updated the Mount & Blade II: Bannerlord save file system which requires you to take certain steps in order for your save files to be compatible with e1.7.1 and any later updates. You can find the instructions here.

I have a idea for AI Pathfinding system

Users who are viewing this thread

jisiting2960

Sergeant
I'm not a programmer,Please do not hesitate to correct me if I am wrong。
Assuming that the ground can walk, AI identifies the x-axis, Y-axis and z-axis within 1m,Where x and Y represent green and Z represents orange / red。X, Y axis can walk / run, and Z axis AI first identifies the highest point of Z axis。If it is more than 1.5m, give priority to dodge,If the highest point is 50cm, give priority to identifying dodge and then jump。If the highest point is 25cm, give priority to identifying the up and down leg movement。
First, solve the X and Y axes, that is, the plane problem,Use the AI sole as the starting point,It is assumed that the sole coordinate is (0.2 / 0.2 / 0.2) and the starting point of the ground grid is (150 / 300 / 0,The x,y-axis changes randomly, which does not affect AI walking and running)
After meeting the conditions of walking and running, AI can recognize the z-axis (within 1m around AI)
If: AI recognizes that the lowest point within 1 meter of the body is 3 meters, it is preferred to judge the detour.
If: AI recognizes that the lowest point within 1 meter of the whole body is 1-2.9 meters, it gives priority to judge the plane of walking, followed by jumping.
If the highest point of the object in the Z axis is an object more than 1.5m, AI will first identify the highest point of the object, and AI system will give priority to identifying Dodge (trees, houses, riprap, etc.)
If: the highest point of the object in the z-axis is 25cm-50cm, the AI system will give priority to identifying the jumping object, followed by the Detour
If there is a 25cm object in the Z axis, the AI system gives priority to recognizing the stepping action.
The main obstacles in the game are houses, trees, fences and city walls,In this way, the root grid of the obstacle embedded in the plane belongs to the red point. It is preferred to judge the detour. If it is set as a destructible object, it is set to orange.
If: AI should first bypass to attack the player with the highest efficiency, but in practice, because AI only explores within 1 meter of itself, it may attack destructible objects first,Or vice versa,AI should give priority to attacking destructible objects, but it missed a big circle and made low-level errors,At this time, a condition should be added, that is, the on-site AI will automatically share coordinate points and the AI will identify the shortest distance,If it takes 2 minutes to bypass and only 1 minute to attack an object, attack the object first and then attack the player。I don't know if I think so. After all, I'm not an expert. I hope you can criticize me
Or when I finish writing, I realize that I have written a lot of nonsense and actually write code. What I said is the most basic
 
Last edited:

Lazregamesh

Sergeant
WB
I think we are gonna have a siege overhaul at some point and that's why they are not touching it right now. What you are saying seems like it would require a lot of processing power per unit. We had something similar to that at the start of beta and the game was barely playable. Lots of stuttering and lags.
 
Last edited:

jisiting2960

Sergeant
I think we are gonna have a siege overhaul at some point and that's why they are not touching it right now. What you are saying seems like it would require a lot of processing power per unite. We had something similar to that at the start of beta and the game was barely playable. Lots of stuttering and lags.
Ah, I don't know. I think this can at least solve the most basic recognition problem of AI. I don't know how the CPU processing power is. If CPU process millions of calculations per second,I think this calculation is very small
 

MadVader

Duhpressed
Duke
M&BWB
Ah, I don't know. I think this can at least solve the most basic recognition problem of AI. I don't know how the CPU processing power is. If CPU process millions of calculations per second,I think this calculation is very small
Pathfinding for hundreds of soldiers demands a lot of processing power and is one area which needs to be optimized in a mass combat game.
Generally you do this and then optimize it for your game.
 

Grank

Sergeant Knight at Arms
WBNWVC
数百名士兵的寻路需要大量的处理能力,是大型格斗游戏中需要优化的一个领域。

通常,您会执行此操作,然后针对您的游戏对其进行优化。
What makes it even worse is that the game runs in real time, is physics-based, and has a lot of factors that can change the situation like troops getting shoved away or killed by a flying exploding rock.

In Warband the AI was simpler because it didn't have all these siege spots and tools to think about. They just rushed to the opponents and would automatically meet through the few paths.
 

eddiemccandless

Knight at Arms
WBNWVC
I'm not a programmer,Please do not hesitate to correct me if I am wrong。
Assuming that the ground can walk, AI identifies the x-axis, Y-axis and z-axis within 1m,Where x and Y represent green and Z represents orange / red。X, Y axis can walk / run, and Z axis AI first identifies the highest point of Z axis。If it is more than 1.5m, give priority to dodge,If the highest point is 50cm, give priority to identifying dodge and then jump。If the highest point is 25cm, give priority to identifying the up and down leg movement。
First, solve the X and Y axes, that is, the plane problem,Use the AI sole as the starting point,It is assumed that the sole coordinate is (0.2 / 0.2 / 0.2) and the starting point of the ground grid is (150 / 300 / 0,The x,y-axis changes randomly, which does not affect AI walking and running)
After meeting the conditions of walking and running, AI can recognize the z-axis (within 1m around AI)
If: AI recognizes that the lowest point within 1 meter of the body is 3 meters, it is preferred to judge the detour.
If: AI recognizes that the lowest point within 1 meter of the whole body is 1-2.9 meters, it gives priority to judge the plane of walking, followed by jumping.
If the highest point of the object in the Z axis is an object more than 1.5m, AI will first identify the highest point of the object, and AI system will give priority to identifying Dodge (trees, houses, riprap, etc.)
If: the highest point of the object in the z-axis is 25cm-50cm, the AI system will give priority to identifying the jumping object, followed by the Detour
If there is a 25cm object in the Z axis, the AI system gives priority to recognizing the stepping action.
The main obstacles in the game are houses, trees, fences and city walls,In this way, the root grid of the obstacle embedded in the plane belongs to the red point. It is preferred to judge the detour. If it is set as a destructible object, it is set to orange.
If: AI should first bypass to attack the player with the highest efficiency, but in practice, because AI only explores within 1 meter of itself, it may attack destructible objects first,Or vice versa,AI should give priority to attacking destructible objects, but it missed a big circle and made low-level errors,At this time, a condition should be added, that is, the on-site AI will automatically share coordinate points and the AI will identify the shortest distance,If it takes 2 minutes to bypass and only 1 minute to attack an object, attack the object first and then attack the player。I don't know if I think so. After all, I'm not an expert. I hope you can criticize me
Or when I finish writing, I realize that I have written a lot of nonsense and actually write code. What I said is the most basic
Did you use Google translate to generate this text? I am having a hard time making sense of what you are trying to say.

What makes it even worse is that the game runs in real time, is physics-based, and has a lot of factors that can change the situation like troops getting shoved away or killed by a flying exploding rock.

In Warband the AI was simpler because it didn't have all these siege spots and tools to think about. They just rushed to the opponents and would automatically meet through the few paths.
If the path finding algorithm works troops being moved shouldn't really matter. My guess is that they are having troubles dealing with multiple entry points, but honestly I just think that they are terrible coders and can't make sense of their spaghetti code. Plus I get the impression that they try to do difficult things all at once, instead of breaking them down into easiest sub problems and being modular.

One thing that probably does make things tricky is the wonky physics and the fact that all actors end up melting into each other. I do imagine that keeping track of that mess is not the easiest thing ever.
 
Last edited:

Grank

Sergeant Knight at Arms
WBNWVC
If the path finding algorithm works troops being moved shouldn't really matter.
Oh I was just mentioning factors that add to the amount of calculations. This amount wouldn't really make a difference in modern engines. The things that slow down processing is data (graphics = big) and input/output (loading/writing from disk). Path finding only plays with spatial data, which is numeric and fast to process.

On the logic end tho, these extra factors do make things more complicated to code, and it's probably why they're struggling with it. For all we know the path finding algorithm itself might be fine, but the part that's in charge of tool usage like ladders is bugged out somewhere.
 
Oh I was just mentioning factors that add to the amount of calculations. This amount wouldn't really make a difference in modern engines. The things that slow down processing is data (graphics = big) and input/output (loading/writing from disk). Path finding only plays with spatial data, which is numeric and fast to process.

Jisiting isn't talking about the intial pathfinding algorithm, but the moment-to-moment movement decisions for preventing collisiion with other agents. Pathfinding is fast because only one data set has to be accessed, while dynamic pathfinding has to load collision data, agent location data, and anything else that could affect a path, leading to a lot of cache misses which are hundreds of times slower than loading predictable arrays of data, like static pathfinding usually does.

That being said I don't think what Jisiting is suggesting is particularly complex. The AI probably does a lot of this kind of thing already, and it doesn't have to do it every frame, just every few seconds, meaning it can be staggered or even multithreaded.
 

jisiting2960

Sergeant
Because I think a * pathfinding is in 2D mode, I wonder if AI will be smarter if it can read 3D space. It's like loading an X / Y / Z axis space. Maybe the grid doesn't need to be changed manually. The workload of module editor and mod author is reduced
 

eddiemccandless

Knight at Arms
WBNWVC
Because I think a * pathfinding is in 2D mode, I wonder if AI will be smarter if it can read 3D space. It's like loading an X / Y / Z axis space. Maybe the grid doesn't need to be changed manually. The workload of module editor and mod author is reduced
A* (and pathfinding algorithms in general afaik) by itself isn't really 2D or 3D. It works with cells so you can go either way. A 3D scene usually is reduced to a 2D cell system to reduce computational load (and I can't think of a particular reason to used a full 3D grid unless you are flying).
 

jisiting2960

Sergeant
A* (and pathfinding algorithms in general afaik) by itself isn't really 2D or 3D. It works with cells so you can go either way. A 3D scene usually is reduced to a 2D cell system to reduce computational load (and I can't think of a particular reason to used a full 3D grid unless you are flying).


Ah, so it is. I thought a * was just 2D. I was wrong.
 

Grank

Sergeant Knight at Arms
WBNWVC
Jisiting isn't talking about the intial pathfinding algorithm, but the moment-to-moment movement decisions for preventing collisiion with other agents. Pathfinding is fast because only one data set has to be accessed, while dynamic pathfinding has to load collision data, agent location data, and anything else that could affect a path, leading to a lot of cache misses which are hundreds of times slower than loading predictable arrays of data, like static pathfinding usually does.
So was I, hence my mention of shoving and exploding rocks. Although I was focusing more on the siege problem.
 

froggyluv

Grandmaster Knight
NW
Ah, so it is. I thought a * was just 2D. I was wrong.

Yes but make no mistake about it -3d pathfinding in a non-scripted scene with potentially 100's of AI units needing to be processed per frame is a haphazard experience. Just take a look at how many games involving 3d AI pretty much try to avoid using them in buildings and what not unless they are purposely scripted there - its a computational nightmare to pull off smoothly. Even Total War (overhead 2d) has had problems for years with buildings and sieges getting glitchy and thats a mere 2d game (with granted alot of units)
 
Top Bottom