Ok Swaffy, I see you have already started a thread, kewl. As I mentioned in the other post from the wee hours I will give a brief explanation here as a prelude to the mentioned tutorial. This can be a complicated topic and a lot of background knowledge of the Battlefield AI is a prerequisite to fully getting your head around how these files fit into the big picture. It is also important to have advanced knowledge of Battlefield mapping because to have outstanding AI performance you have to create your map from the very beginning with AI in mind, especially static object placement. The latter is essential for the generation of good pathmaps to where your "smallones" will come out right. I am going to attempt to show you why and answer your question, Swaffy, as to why the bots in your map go around the DefGun the way they do. Hopefully, I will get some good feed back that will help me better write the tutorial.
First let me address this question or issue ....
POTAmatt ...
I know what you mean. I find myself streaking the pathmaps when i want to keep them on the roadways:
I just path the roadways and it works perfect. Here is how I go about doing this. Using a sacrificial copy of the map (always have and work with one of these) I use the euro wood fence, or what ever you want, and I place it all along the roadways, trails, etc. Now drop this StaticObjects.con file in your maps directory within your ed42 dev folder and fire up ED42. Now you just paint everything in those areas white except the areas within the fence or what ever marker you used. All you are saving in ED42 is the textures anyhow so feel free to flatten the terrain at will to aid in painting the pathmap. Now generate you a new set of pathmaps, pack the map, load and play. Wha La! Your bots follow the roads or trails. Now I usually only do this with Tank maps because infantry should follow allowable terrain unless you want to say, have them follow vehicles along the road like a marching column. Hummmm .. that gives me an idea for a map .. a supply column moving along a road .. strafing with a P51comes to mind..... I digress .. darn ADHD!
Anyhow you get my point here right?
Next we have the best question in the class from Mr Swaffy! I mean you couldn't have asked a better question, and I have like the perfect example. I am hoping the two of them will help me explain this.
For example: I have a DefGun next to a road, and the AI drive around the back of the DefGun instead of driving down the straight road. I get why they would do that, but I'd like them to be guided down paths that make more sense.
Ok, how many of you have played Bocage with bots? Have you ever noticed how all the Axis bots when leaving the Axis base going towards the bridge, all run to a point way to the right of said bridge, then cut back and cross it?
Ok lets put things in perspective, here is an image from Bocage of the area we are talking about. I have the point of interest marked.
- Map image showing location of waypoint in question.
Ok now in both cases the bots are going where they are because of the "smallones" files. I prefer to call them a waypoint file as is the term AchingLasers used, and is more fitting to their purpose. I will get to the different files and what they are in a moment, but first lets have a look at the info waypoint files for this area of the Bocage map. I think you will start to get the picture. Now I am using FourCentsShy's kewl little tool he is or was developing called BFSAK or Battlefield Swiss Army Knife. This tool along with Genpathmaps are a total must have in any serious AI coders tool box. It is very buggy because it is a total beta but usable if you get a handle on it. The last time we chatted he was revamping it to load the map for edit like ED42, with with the ability to move spawns points and save in the Singleplayer folder. Anyhow I have it opened to Bocage and the Infantry pathmap, set to show the smallones.
- View of smallones in FourCentsShy's BFSAK tool.
You will note in the second image that I have a red arrow and my cursor on the waypoint (in the largest dogo area) for that info tile. This is where the bots go as they leave the connecting dogo area from the previous info tiles to this one. This is why you see all the bots run to this point then head across the bridge and in your map, Swaffy as they run around the DefGun. Can this be fixed? Oh yes it can. One way is to use BFSAK and simply pull the waypoints where you want them and save. You have to remember that if you generate a new set of pathmaps afterwards you have to re edit the waypoints if needed. If you put in the time and properly do your pathmaps the waypoint - info file pretty much take care of themselves.
Now in this image I have moved the waypoints in several areas to make the bots go where I want them to, the best you can given their reactive nature. Now this is the infantry map and even more important for the Tank maps as you can well imagine. Notice the difference of the waypoints between the two images. In the second I have the points flowing towards the windmill and sawmill then towards the second bridge.
- View of waypoints after edit.
Now that is one way to do it, but the proper way is to paint your pathmaps to where the smallones or waypoints come out right in the first place. In the case above I would paint or white out the whole area of that tile except for the path to the bridge, and once a new set of pathmaps are generated, the waypoint would then fall pretty much in the center of the path at the start of the bridge of it's own accord. You will note several other connections in different colors. This is because some tiles have more than one non connected dogo area and they are ranked by size. Each tile can have 4 states, 00, 01, 10, and 11. Largest to the smallest by size. The 00 would be the largest and in 4c's tool and genpathmaps diag images, they are yellow. The next largest is 01 or red then blue and green for 10 -11. If any of these dogo areas connect with a dogo area in an adjacent tiles, a waypoint connection is made. The trick is to have all 00 dogo areas but, this is not always possible. You first paint your pathmaps as clean as you can, and if you still have issues you then move them with BFSAK. They do not have to be all lined up like that and there are only certain cases where it occurs. In this case you have a bridge on an angle and a narrow gap where all traffic has to pass. If for instance in was all flat terrain and you had waypoints centered in tiles on both sides of the bridge the bots most likely, if there was a good reason to cross would go straight for the bridge.
The most important thing to remember is that you need to white out ANY AREAS that a bot does not need to go, or would never have reason to go. This reduces the waypoint connections to areas not used or don't need to be used within the battle area making the bots play and follow the map more like you intended. It is with your pathmaps along with proper strategies that allow you to do what scripting that is possible with BF AI. I once added AI to a BF1918 map for a friend where he had to armies charging each other head on down a slope to a valley below with three control points. First I used a striping technique as you demonstrated POTAmat, but a series of them connected by StragicAreas with connected neighbors, and each group of bots spawned in their own "cells" at first, then charged down the hill. The effect of the multiple Sa's and random striping patterns gave them all a realistic weaving back and forth movement as the groups mixed then aggregated into a whole in stages until ending up in the open area around the CP's where fight began in earnest. Was pretty kewl but took a lot of work and especially in pathmapping, coding SA's and writing strategies.
Think of it this way. The SAI for a given side says "Bots, I need you to go here." so he consults the pathmapping files for infantry and tanks, noting he is at at waypoint such and such. Now they need to be at waypoint this and that, so he lays out all the info tiles using the waypoint file as a guide (it is the index or xy grid) from point A to point B and the bots take off. This is some times why you see them making kind of zig zag paths because they are going from waypoint to waypoint, tile by tile towards their destination. It's actually an abstraction layer designed to save memory for the old rigs we were gaming with in the days the game came out. In fact the whole AI system uses an abstraction layer for this purpose. In the early days bots were dumb because of not only a lack of memory but crappy AI code to boot. The stock pathmap for Bocage is total trash and I am being nice. I am in the process of doing my own for all of the stock maps. Anyhow I digress again.
Let me end this one and start part two for the rest of the story as this post is getting a bit long.
Someone needs to show me how to do one of those video tutorial things! Come on this old dog loves new tricks. All this typing and image work, jeez it's a lot of work.