THESE BLUE THINGS
sample files
--------------------------------------------------------------------------------
Welcome back, this is Part Two of the Ai .con Editing tutorial.
I am your host again today, and this part of the tutorial will focus purely on Strategic Areas, what they are, how to use and code them. This will allow us to customise the Ai addon to a custom map, so the Ai will behave more like its playing Aberdeen instead of Kursk
lets get botty ; )
--------------------------------------------------------------------------------
Ok, here we go again ... back to the sandy world of Aberdeen.
In the last episode of the Ai Cutting and Pasting Chronicles, we took an Ai out of its existing environment, without any regard for it's well being and shoved it into a world of Alien origin ... are you surprised the bots we're confused ?
What are Strategic Areas ? In short ... these blue things.

Strategic Areas (SA for short) are used to mark locations of importance to the Ai. The most common use for a SA is to mark Control Points, but can also be used to mark locations of strategic advantage (eg:Tight spots & Bunkers) or navigational "waypoints" (eg: complex &/or alternate routes)
Try not to use more Strategic Areas then you absolutely have to, but don't hesitate to try an extra one here and there, if you are trying to achieve something, it is worth experimenting.
SAs are linked to each other with the use of Neighbours. Bots move from one SA to its Neighbour by the shortest route, as allowed by the Pathfinding maps.
Rather than jump into writing up the SAs, as with much in mapping, its good to have a plan. With as little as a pencil and piece of paper, a small sketch will be a great help in understanding what lies ahead. Paint programs are quite handy, rather then a piece of paper, as you can paste together textures and pathmaps to further see “the big picture”
In the following image, i have overlayed a Tank pathmap onto a resized terrain texture, to give a general idea of the pathed area available. Blue rectangles are for Strategic Areas, and the red lines show which SAs I will "link" with a neighbour

Where the red "neighbour" line crosses over the white, non-pathed area the bot will skirt around the edges till they get to their destination. The bots do not usually drive into a non-pathed area, but they can get pushed into it.
On this occasion, i'm going to plan ahead and use some SAs for waypoints, to help the Bots leave their bases

Yep ... that's better.
Now we know roughly where we are going to setup the SAs, lets start working out exactly where they will be. Open the StrategicAreas.con from your Addon's folder, and also open Aberdeen in your favourite map editor. For this part i use Ed42
The first block of code in StrategicAreas.con creates the SA, by defining the position, size and value of the SA. The second block is the bulk of the code, which describes the additional attributes of each SA
First we are going to Define our Strategic Areas. Lets have a look at the code.
aiStrategicArea.create <SA_NAME> <X1>/<Z1> <X2>/<Z2> <NUMBER>
<SA_NAME> must be a unique name, no spaces, use something descriptive (eg: CP_Radar)
<X1>/<Z1> These are the Start co-ordinates for the SA (rule of thumb: South West Corner)
<X2>/<Z2> These will be the End co-ordinates for the SA (rule of thumb: North East Corner)
<NUMBER> This will give a Strategic Area a base value, values of 10 to 200 are the most commonly used
Switch to the map editor, and locate the Axis Base in the bottom left corner, and position the Camera, near the South West corner of the base, looking straight down.
The road tool (Key: R) in Ed42 is handy to make sure the view is locked straight down.

Get the Co-ordinates of your position, and write them down (63.86/87.07) these are your <X1>/<Z1> co-ordinates
You don't have to work to two decimal points. Unless you need to be super accurate for a particular SA, you can round off those co-ordinates and just use 64/87, and this make things easier up ahead
Now move to the diagonally opposite corner of the base, and write down the co-ordinates of that position.
Now you have your <X2>/<Z2> co-ordinates (121/219)
Easy ! I hear you say, well not quite, i have a speed bump for you ...
If you use those values, your Strategic Area would look like this.
I dunno either, very strange ... the <X1>/<Z1> coordinates are in the right place but <X2>/<Z2> ... wtf ?
The SA is twice the size that we wanted, so you will need to do some maths to work out a better <X2>/<Z2> coordinate.
Find the difference between <X1>& <X2> ( 121 - 64 = 57 )
Than add half of it back onto <X1> for you new X2 co-ordinate ( 57 / 2 = 28.5 + 64 = 92.5 )
Repeat the calculation for your <Z2> co-ordinate and you'll get 153
Then your Strategic Area will look like this

There is also another way to get your SA's co-ordinates that may be handy on some occasions. By thinking of the second set of coordinates as the “centre” of a Strategic Area, you can easily set the size of the SA by removing an amount that is half the size you require, from the centre coordinates.
Eg: You want to place an SA at a Control Point Flag that has coordinates 1024/1024. You use the Flag 's coordinates as the SA's <X2>/<Z2> Coordinates. Now just say the Flag has a capture radius of 50, and we want the SA to be the same size. Using 25 as our SA's “radius,” subtract that from 1024/1024 and use the resultant 999/999 as the <X1>/<Z1> coordinate of the SA.
The first method is better when you need to accurately place your SA between two points, the second method is quicker if you know the centre and have clear space to place a the SA.
We are nearly ready to start editing, once last decision needs to be made.
How much is the Strategic Area of a Base worth ?
That is a good question. How valuable is the base in terms of vehicles available or defenses required ?
You don't want to make a Base too valuable or the Bots will spawn there instead of the front lines. Yet, if you don't make it valuable enough, the Bots will rarely spawn at the Base leaving important Armoured Units to sit & rust. Also, Aberdeen has capturable bases, something different from most Battlefield Maps so you will need to take that into account by leaving troops at home for Defense.
Aberdeen has a good selection of tanks laying around, and we want some defense so a nice round figure of 100 sounds good. For less well equipped bases, where you want bots to be spawning more at the frontlines, a value of 50 is usually used.
This value is only an initial value, later we will cover Modifiers that allow you adjust the value of SA according to the state of play
Ok ... we have all the information to define our first Strategic Area, so lets type it in.
aiStrategicArea.create AX_Base 64/87 92.5/153 100
Next, move across to front of the Axis base where we will put the waypoint, I have worked out my co-ordinates, and as the waypoint has no Strategic value, it should have a low value. This is the code i am going to use ...
aiStrategicArea.create AX_Waypoint 215/154 227.5/166.5 10
and this is what it will look like

The South, West, East & North ControlPoints. Until later when we work out just how valuable each Control Point is in comparison to the main base, we shall use the same value of 100 that we used for the main base.
aiStrategicArea.create CP_South 625/200 651/225 100
aiStrategicArea.create CP_West 364/414 381.5/434.5 100
aiStrategicArea.create CP_East 624/544 640/566 100
aiStrategicArea.create CP_North 391/760 405.5/772 100
The Centre ControlPoint is a bit unusual, as the flag is on the roof of the building. We will move the CP's flag later for the bots, but for now this will do.
aiStrategicArea.create CP_Centre 516/455 527/462.5 100

!!! TIP : Make life easy for Bots !!!
A player has to be rather close to a Flag in Aberdeen to capture it, and the Centre flag has a radius of just 4. A bot will have lot of difficulty in capturing that flag, and even the other CP's that have a radius of 10 will take the Bot a bit longer to get in range.
The easiest way to help the Bots out is to increase the radius of capture for all the Control Points, in ControlPointTemplates.con
For each ControlPoint, change the line ...
ObjectTemplate.radius 25
This small reprieve for the Bots will help immensely.
Alternatively, you could deliberately make it impossible for a Bot to get within range of a Flag to Capture it, to Force human player to get the job done.
And of course, the Allied base, complete with Waypoint.
aiStrategicArea.create AL_Waypoint 725/819 738.5/832 10
aiStrategicArea.create AL_Base 854/803 880.5/886 100

When you are finished putting them together in your StrategicAreas.con, you would have something like this:
aiStrategicArea.create AX_Base 64/87 92.5/153 100
aiStrategicArea.create AX_Waypoint 215/154 227.5/166.5 10
aiStrategicArea.create CP_South 620/205 651/225 100
aiStrategicArea.create CP_West 364/414 381.5/434.5 100
aiStrategicArea.create CP_Centre 516/455 527/467.5 100
aiStrategicArea.create CP_East 624/544 640/566 100
aiStrategicArea.create CP_North 391/760 405.5/772 100
aiStrategicArea.create AL_Waypoint 725/819 738.5/832 10
aiStrategicArea.create AL_Base 854/803 880.5/886 100
!!! TIP : Cut n' Paste shortcuts !!!
How you edit files, is entirely up to you ... but I strongly suggest you get to know the keyboards shortcuts for;
Copy (to clipboard) - CTRL + C
Paste (from clipboard) - CTRL + V
Cut (to clipboard) - CTRL + X
These are your friends, and they will save you alot of time, as well as saving you grief from typos'
A handy feature of even the lowly Notepad is if you double-click a word, it will select the whole word. This makes selecting a word, copying it, selecting the target word to replace and pasting over it, more efficient and again, can greatly reduce typos'
Now we have to fill in the details by describing each Strategic Area, with a few attributes. We'll start by using just a few lines of code, just to get the areas functional, and add extra features later. Lets look closer at the code we will be using.
aiStrategicArea.setActive <SA_Name>
<SA_Name> Must be identical to the <SA_Name> used in the aiStrategicArea.create statement
AIStrategicArea.addNeighbour <SA_Name>
This is the statement that allows us to link one Strategic Area to another. Lets have another look at our SA planning to see which Areas should be linked
Starting at the bottom left, AX_Base only has one neighbour, AX_Waypoint.
AX_Waypoint has four neighbours, follow each red line and you get AX_Base, AX_Waypoint, CP_West & CP_South. You could argue that CP_East, CP_North & even AL_Waypoint and you would be correct, but in the goal of keeping things as minimal as possible, it is better if the bots move through the closer CPs first.
Work around each SA, count the number of lines linking to another SA, then work through each neighbour one by one as you enter them into your SA.
aiStrategicArea.addObjectTypeFlag <FLAG>
Object Type Flags (OT Flags for short) are used to supply the Ai further information about a SA, such as Purpose and Location. OT Flags will be used in the Strategies to control which SAs the Bots will attack or defend by modifing the value of a Strategic Area, and therefore the importance of a SA. These flags will almost certainly have hardcoded information that could affect the Ai, so try to use the flags for what seems to be their appropriate purpose. You may alos need to closer at an original level to learn more about the usage of particular flags.
The most commonly used OT Flags describe the SA's main purpose, such as: Base, ControlPoint & Airfield.
More OT Flags can be used as well, for “location” references; East, West, North, South & Centre.
Other OT Flags can be added to describe a “tactical” purpose for the SA, for the rarer usage of these flags i have labeled the map in which it was used: Airspawner(BoB), Bridge(Mkt.Grdn & ...), ChokePoint, Close, Flank, LandSpawner(BoB), Remote, Route, SoldierSpawner(Berlin), SupplyPoint(Salerno) & StrongPoint.
How well these flags are used will make the difference between a “smart” or “dumb” Ai.
aiStrategicArea.setSide <#>
You are probably already familiar with similar .setside statements, the <#> value sets which Team owns the Strategic Area at the start of a round.
1 = Axis
2 = Allies
0 = Neutral
aiStrategicArea.setTakeable <#> 0
This is a special statement for NON-CAPTURABLE Control Points (usually bases.) As Aberdeen's base are capturable we are not going to use it, but you will need it for other maps.
The usage is similar to .setside, the <#> value is used to set the Side that cannot take the Base. ie: If it the area belongs to Axis (1) you would set his to 2 so Allies cannot capture the point. And the 0 at the ends tags the Non-capturable attribute.
Ok, lets put that all together for the AX_Base
aiStrategicArea.setactive AX_Base
AIStrategicArea.addnNeighbor AX_Waypoint
aiStrategicArea.addObjectTypeFlag Base
aiStrategicArea.setside 1
That doesn't look too scary, does it ?
Next, AX_Waypoint. It has four Neighbours to add, and we will give ownership of this SA to Axis rather then leaving it neutral to help prevent bots from waiting in the SA to gain ownership in the “start of the round” frenzy.
aiStrategicArea.setActive AX_Waypoint
AIStrategicArea.addNeighbour AX_Base
AIStrategicArea.addNeighbour CP_South
AIStrategicArea.addNeighbour CP_West
AIStrategicArea.addNeighbour CP_Centre
aiStrategicArea.setSide 1
The next five areas are very similar. CP_South, CP_West, CP_Centre, CP_East & CP_North are all ControlPoints and they also fit in nicely with the “location” flags, South, West, Centre, East, & North so each SA will get it's own “location” flag as well. When you are working out the neighbours for each SA, be patient & methodical. An extra minute making sure you get them right first go, could save you a heap of time in the longrun.
Lastly, these SAs will be neutral at the beginning of a round.
aiStrategicArea.setActive CP_South
AIStrategicArea.addNeighbour AX_Waypoint
AIStrategicArea.addNeighbour CP_East
AIStrategicArea.addNeighbour CP_West
AIStrategicArea.addNeighbour CP_Centre
aiStrategicArea.addObjectTypeFlag ControlPoint
aiStrategicArea.addObjectTypeFlag South
aiStrategicArea.setSide 0
and
aiStrategicArea.setActive CP_West
AIStrategicArea.addNeighbour AX_Waypoint
AIStrategicArea.addNeighbour AL_Waypoint
AIStrategicArea.addNeighbour CP_North
AIStrategicArea.addNeighbour CP_West
AIStrategicArea.addNeighbour CP_East
AIStrategicArea.addNeighbour CP_Centre
aiStrategicArea.addObjectTypeFlag ControlPoint
aiStrategicArea.addObjectTypeFlag West
aiStrategicArea.setSide 0
now go through and complete the rest of the Control Points, AL_Waypoint and AL_Base and we are done, or you can cheat and just read the code in the included .RFA
--------------------------------------------------------------------------------
Last step, in this part is to repack the Ai and Test.
This time around save the addon to Aberdeen_011.rfa, this will keep our old file intact, we'll call that our pre-alpha ; )
Once you have packed the file, start the game
!!! TIP : Quick Map Starts !!!
You can get Battlefield to start a Map, straight from a shortcut without having to go through the menu.
Make a copy of your normal BF shortcut (or the one for the appropriate MOD) and add to the end of the Target: +restart 1 +hostServer 1
One double click, and Battlefield will start a game with the last Map & Server Settings that we're used.

When the game has started, you will see this, quite similar to the last time .. but the blue bits are in the right spots : )
If you see your desktop ... - Don't Panic - (large friendly letters sell well ; )
There is a good chance you have only made a small error and the log may even give you a helping hand.
- END OF PART 2 -
--------------------------------------------------------------------------------

Credits:
Arc D'Wraith - Author
Coralon - Proof Reading & Feedback
White Thunder - Title Image and support
Special Thanks to the toolmakers, for without your work modding Battlefield would be a joke.
Resources:
Bf1942 Modder's Wiki
bf42.com Editing Forums
Original Battlefield Maps
Tools Used:
Battlefield 1942
Corel Photo-Paint
Ed42
GMakeRFA
Notepad
Open Office
Please excuse my english, i'm Australian ; )