Let The Games Begin.
  
Main Menu
Home
Flash Games
Weblinks
Contact Us

Game Modding

Battlefield 1942
· README FIRST
· Ai.con editing pt1
· Ai.con editing pt2
· Ai.con editing pt3

· Pathmapping pt1
· Pathmapping pt2
 
BF 42 Modding/Mapping: Ai.con editing pt3

 


THE CHAIN OF COMMAND

 

 

sample files
--------------------------------------------------------------------------------

Hello again, this is Part Three of the Ai .con Editing Tutorial.

Again i shall be hosting a feast of Ai goodness, as i continue describing the Ai functions and further customise the Ai to suit Aberdeen.

So far our work has answered the Ai's questions of “What & Where.” The Pathmaps, the Strategic Areas, and their flags, all add up to being a description of the Map's layout, and references to what part are of value or purpose.

The next questions of the Ai's we shall answer is “When & Why” as we dissect the Conditions, Prerequisites and Strategies.

We're going botty ; )


--------------------------------------------------------------------------------

3.1 - Conditions

The Conditions are the Ranking Officers in our Ai's Chain of Command that watch & keep track of the proceedings on the battlefield. When an event occurs, like a Control Point is gained or lost, the conditions are examined and compared against the situation. When a match is found (a Condition is true) the Commander passes an order to the Field Officer to “Do something.” The Field Officers in this case are the Prerequisites.

In most cases, the Field Officer passes the order straight to the Sergeant (the Strategies) who passes the orders to the Troops (the Bots), telling them what to attack or defend, and how aggressive (suicidal) to be in performing their Duty

It is possible for two or more Conditions to be True at one time, in which case when multiple Commanders are saying “Do something” the decision is passed to the Field Officers to make a “on the spot call.”

The other side of the coin is not handled so neatly, If at any stage during the game, NO conditions are True ... you will probably be saying hello to your desktop, aka CTD (Crash to Desktop) You can think of it as all the Commanders going Awol.

Once you have a stable set of conditions, you have a solid foundation on which to build on and experiment with. Things may go haywire and the bots will do everything but what you want them too ... at least it won't crash.

Now that we know how the decision process works, we can start to evaluate how our Ai is performing and start making the serious adjustments. You may remember these four strategies from Part 1 of the tutorial, i've added what I think would be appropriate use for the strategy.

breakOut - A basic Strategy to get the bots motivated to leave the main base, and make a grab for Control Points. Best used for the start of the round, could also double as a “panic” strategy if the enemy side has too many Control Points.

single - A one group attack, all attacking Bots move on the most valuable SA. Best used in the mid game.

double - A two group attack, attacking Bots split into two smaller forces and attack the two most valuable Control Points. Best used in the mid game, could be used as an alternate attack strategy to single

holdAndCamp - No attacks, all bots defend owned Control Points. An “End Game” strategy that would only be used if the other side is bleeding tickets

 

 

Load up Battlefield and start a Co-op game in Aberdeen, lets see what the bots are actually doing. When the round starts, watch the top left corner of your screen.

 

This readout from the Ai stats is conveniently showing us which strategy each side is using.

The figure after the Strategy is a counter, in seconds, and will keep counting up while the Ai remains in the current strategy. When the strategy changes, the counter will reset to zero, and start the count again. Later we will use the counter to make the Ai switch strategies, to create variety in the “mid-game” attacking.

The figure at the end is the prerequisite value. This would come into play when you are using more complex and subtly balanced Ai. For the moment i will be keeping to things that I understand. The Ai that will be produced from this work will actually be more like a script, controlled by numbers and timing. On the good side of things is the Ai tends to more decisive, switching quickly and getting on with the job, the downside is this can make the Ai more predictable & less responsive ... then they already are.

Getting back to the strategies, at the beginning of the round the bots on both sides should be using the breakOut strategy, so we have some adjustments to make.

Quit Battlefield and open Conditions.con

 

 


!!! TIP : Quick Quit !!!

The quickest way to close Battlefield is to drop the console, and simply type ...

QUIT

 

 

 

 

!!! TIP : BACKUP !!!

We are about to embark on some serious editing on the dreaded Conditions.con

It is time the word BACKUP was mentioned.

From here, it is worth making a Backup copy of the the files in the Ai folder EVERYTIME before you make changes. If your Ai CTD's you could spend a heap of time looking for a needle in a haystack error, that may end up being a simple typo. If your latest backup is only one lot of changes behind, you only lose a few minutes, to restore the backup and make the changes again.

And for the very same reason, keep your changes minimal in each adjustment until you really have the confidence that your changes will all work first go.

An easy way to quickly Backup these small files, is to Copy them, and then Paste them back down in the same folder. Windows will automatically rename the files like this...

 

 

Straight back into the code, we are looking at this line in the breakOut section of Conditions.con

aiStrategy.createConstantCondition noFriendlyCPCond Crisp Equal Friendly ControlPoint 0

aiStrategy.setConditionStrength Required

This Condition statement is really a basic question; Is the number of Friendly ControlPoints equal to zero ?

The second line (in gray) is a piece of luggage that must be included with the Condition and i have no idea of its purpose ; )

A Condition's definition of a ControlPoint is different from the StrategicArea's ControlPoint Flag and the two are not connected. As far as the Condition's are concerned, ANY Control Point including Cappable & Un-cappable Bases and Invisible spawns are counted.

And this is why the Bots are not using the breakOut strategy, each side already starts with a Base (1 CP) so unless one side is being totally and utterly spawn-camped by the other side, this condition is unlikely to ever be true. So lets change it. I'd like the Bots to use this Strategy to get a foothold on the game ... say 2 CP Flags, before they switch to other Strategies. Take the base into account and that is Three Control Points by the Condition's count. So we want the condition to be true when the Side has no, one or two Control Points and when the Ai gets the third Control Point this Condition should no longer be true, and another condition will become true.

This is the question i would ask : Is the number of Friendly ControlPoints Equal to, or smaller than two ?

Coded, it is only a small change on the original Statement, BUT be aware, some of this code is CASE SENSITIVE miss one capital letter and hello desktop. If you ever get stuck, jees .. capital .. yes, no ...err ... Open a Dice Map, copy and paste the exact word you want.

aiStrategy.createConstantCondition noFriendlyCPCond Crisp EqualSmaller Friendly ControlPoint 2

Don't worry that the “noFriendlyCPCond” doesn't look good with a 2 for the value, you could follow the trail to prerequisites.con and rename it, but its a safer bet to leave it alone for the time being.

 

 

There is also another Condition here in the breakOut section.

aiStrategy.createConstantCondition twoEnemyCPCond Crisp Equal Enemy ControlPoint 2

I mentioned earlier that the breakOut strategy could double as a “panic” strategy if a side is in trouble, and that is exactly what this is for. If either of these conditions were true, the breakout strategy would be activated. Although the previous change has made this redundant, as if a side is in trouble, it will have two or fewer ControlPoints and would be in breakOut anyway. It's easier to leave it there for the moment and work with it, change the value to 5 and add “Greater” to the Statement (enemy has equal or more than 1 base & 4 cps).

aiStrategy.createConstantCondition twoEnemyCPCond Crisp EqualGreater Enemy ControlPoint 5

 

 

The next Condition we are going to look at is the one that will activate the single & double strategies. When the breakOut condition is no longer true (ie: Side gets a third Control Point) this is the condition that should kick in after the Ai leaves breakOut

aiStrategy.createConstantCondition maxOneEnemyCP Crisp EqualSmaller Enemy ControlPoint 1

This condition is currently setup to work off the number of “Enemy” ControlPoints. The way our “script” will be written, it needs to be setup to run off Friendly ControlPoints, and that shall be the first change. Also with the condition's value set at one ControlPoint, its not going to be true at the required time when a Team has Three ControlPoints secured (Base + 2 CPs). We need to set it three to get the desired effect, and we will also remove the “Smaller” portion of the statement, as the lesser values are already taken care of by the previous condition.

aiStrategy.createConstantCondition maxOneEnemyCP Crisp Equal Friendly ControlPoint 3

 

 

Next in line for a look over is the holdAndCamp condition.

aiStrategy.createConstantCondition twoFriendlyCPCond Crisp Equal Friendly ControlPoint 2

By now, we should know exactly what we need here. This condition follows on after the previous one and should activate when a Side has 4 ControlPoints (and the enemy is bleeding tickets.) We also need to make sure the condition stays true if the camping team does manage to grab 5 or more ControlPoints. If we don't cover this possibility you will be saying hello to your desktop, so we will add “Greater” to the statement.

aiStrategy.createConstantCondition twoFriendlyCPCond Crisp EqualGreater Friendly ControlPoint 4

 

 

one minor change left to do ...

aiStrategy.createConstantCondition minFiveFriendlyAreasCond Crisp EqualGreater Friendly NumberOfHostileAreas 5

NumberOfHostileAreas is used in a similar way to ControlPoint, except a hostile area does not have to be a controlPoint, it can be ANY Strategic Area. This condition will see little use in our Ai, we could remove it, but it's easier to leave it there and make an adjustment. Kursk uses a few extra SAs to help the troops around, and since our Aberdeen has fewer SA's we will reduce the value of the line to 3

That is all the changes we need to make, so save & close the file.

Pack your Ai Addon's .RFA into a new revision file, ..._012.rfa, and Fire up Battlefield

 

 


--------------------------------------------------------------------------------

3.2 - Testing

Get into the game Soldier, your Bots are going to need a hand. They run around ok, but they are still acting like they are daydreaming ... Now grab a tank, and go cap some CP's. As you take each one, keep your eye on the Ai Stats in the Top left corner, hopefully you will see the Strategies change at the appropriate time.

Early in the round, each Team only has their Base, and the strategy is set to breakout. Nice start.

 

 

Each Team takes one CP, and the Strategy remains on breakOut. Good

 

 

 

Allies get 3rd CP and change to Single, Great

 

 

 

Allies take 4th CP and CAMP, Excellent !

 

 


--------------------------------------------------------------------------------

3.3 - Prerestiquites

At the beginning of this part of the tutorial, we established there is a “chain of command” in the Ai. The Conditions are the Commanders, who pass orders down the chain to the Field Officers, formally know as the Prerestiquites. The Prerequisite's job is to relay the “order” though the chain of command and see to it that the appropriate strategy in Strategies.con is selected.

Prerequisites use a value “weighting” system to control the activation and variation of the Strategies. When a condition is true, the value that is assigned to the condition in prerequisites.con is applied to the Prerestiquite. Note that the condition referenced in this statement, is one of the conditions that was defined previously in Conditions.con.

aiStrategy.addCondition noFriendlyCPCond 10.0

When the noFriendlyCPCond condition is true, the Prerequisite will have a value of ten (10). If the noFriendlyCPCond condition is False, the Prerequisite's value will be zero (0)

If there is only one Prerequisite with a non-zero value, there is no need for further evaluation of the decisions available, and the prerequisite activates the corresponding strategy in Strategies.con. Of course there will be occasions where more than one condition is True and/or more than one Prerequisite will have a value greater than Zero.

 

 

It is possible to have two different Conditions that can be used to activate the same Strategy, eg: a condition for No Friendly CP's (game start) and a “Team is bleeding” condition that both activate a breakOut strategy that gets the bots to spread out and grab any CP.

aiStrategy.createPrerequisite breakOutPrereq

aiStrategy.addCondition noFriendlyCPCond 10.0

aiStrategy.addCondition twoEnemyCPCond 10.0

When noFriendlyCPCond OR twoEnemyCPCond are true, the breakOutPrereq prerequisite will have a value of ten (10). Multiple Conditions are evaluated by an OR style decision, and their values do not add together. If both Conditions are true, the prerequisite's value is still ten (10)

 

 

Another method can be used to add variation the Ai's use of strategies by providing access to multiple strategies to activate under the same Condition(s) eg: Attacking Strategies:- Left & Right Flanking Attacks that alternate, so the Ai is not constantly bashing its head against the same wall over and over again. At least you are able to give the Ai alternative brick wall to head butt.

Here we have two Prerequisites that use the same condition.

aiStrategy.createPrerequisite singlePrereq

aiStrategy.addCondition maxOneEnemyCP 10.0

 

 

aiStrategy.createPrerequisite doublePrereq

aiStrategy.addCondition maxOneEnemyCP 10.0

When the maxOneEnemyCP condition is true, both the singlePrereq and doublePrereq prerequisites have a value of ten (10)

So how does the Field Officer decide between these two Prerestiquites ? Well ... he “rolls the dice”. This is where the “weighting” comes into play. As both prerequisites have the same value, the chance each has of being selected is equal, ... 50/50, a dead heat.

IF doublePrereq had maxOneEnemyCP 5.0, then it would be more likely that singlePrereq will win the “roll of the dice” and the lower the value, the smaller chance there is of it being selected

At times during play, at preset time intervals or due to a change in the Conditions the Prerequisite decision may have to be evaluated again. At this time the dice are rolled again, and each Prerequisite has the same chance to “win” that it had the first time the dice we're rolled.

This is an example from a different Ai, of multiple Prerestiquites using the same condition.

aiStrategy.createPrerequisite sitPrereq

aiStrategy.addCondition twoCpCond 10.0

 

 

aiStrategy.createPrerequisite pushPrereq

aiStrategy.addCondition twoCpCond 3.5

 

 

aiStrategy.createPrerequisite pushHardPrereq

aiStrategy.addCondition twoCpCond 1.5

Three prerequisites using the same condition, yet each will activate a separate strategy. SitPrereq has the highest value when twoCpCond is true, and has the highest chance of being selected instead of the other two prerequisites. pushPrereq is next in line, and pushHardPrereq has the least chance of being selected, but don't discount pushHardPrereq from not begin selected as it is a totally random choice.

We are not going to make any changes to the prerestiquites for the moment, so close the file.

 

 

That was one big mouth full to get out, I hope it made sense.


--------------------------------------------------------------------------------

3.4 - Strategies (or Ai according to Arc D'Wraith)

Now here comes the fun part, where directing the bots around can be a bit like playing a “Sim” game, but it also comes with a disclaimer. What is written in the following section is THEORY not fact, it is based on observation and testing and while for the most part everything will work according to theory, there are some factors i can't explain, so you should expect a curve ball occasionally. There will also be times that where no matter what you do to achieve a goal, the bots sometimes just refuse to be a party to it.

i'm done, off we go again ...

 

 

At the end of the Chain of command in the Ai is the Sergeant, who will be the coordinator of the Strategy that was chosen by the Command Chain in the Conditions & Prerestiquites. The Strategies will direct the bots in Offensive and Defensive groups, to the Strategic Areas of importance by modifying the the value of the Strategic Areas. The bots will then have “incentive” to move to the Strategic Area(s) of highest value.

Lets take a look at the breakOut strategy. This strategy will be active when the conditions noFriendlyCPCond OR twoEnemyCPCond are True. The strategy's aim is to get the bot to capture CPs at any cost, and is used at the beginning of a round and mid-game if the side is bleeding tickets. Ok, here comes the code.

 

 

aiStrategy.createStrategy breakOut

The first line simply is to define the strategy's name. It must be unique, contain no spaces and must be listed in Ai.con

 

 

aiStrategy.Aggression 1.0

This statement allows us to set the amount of bots on Attacking & Defensive duties. At the maximum value of one (1.0) as used here, all the bots will be assigned to attack Hostile Strategic Area(s). The minimum value of zero (0.0) will assign all the bots to defense of Owned Strategic Area(s). Values between the minimum and maximum will vary the number of Bots on Attacking or Defensive roles. To generate a large attack group, while leaving a pocket defense would use a value around 0.75. For a solid defense, with small attacking groups a smaller value like 0.25 would have the desired effect. You should use the maximum value of 1.0 with caution, a side effect of high aggression is bots tend to become single minded, ignoring close by enemy units, in favor of heading for their destination, and of course they promptly become cannon fodder. A suitable time to use the maximum value is when a side needs to get Control Points at any cost, like the beginning of a game to get the upper hand early or when a side is bleeding tickets.

 

 

aiStrategy.NumberOfAttacks 1

aiStrategy.NumberOfDefences 0

This allows us to further divide the bots into groups, by setting the number of Strategic Areas that the Attacking and Defensive groups need to cover each. In this Strategy the Bots are being told to Attack the one most valuable Strategic Area, and leave no defense behind. numberOfAttacks can be set to higher numbers for multiple front attacks. If numberOfAttacks was set to 2, this would make the Attacking group of bots, split into 2 groups and then attack the 2 highest valued Hostile Strategic Areas. Higher values such as four or five could be used so the spread out and attack a variety of areas.

Aberdeen is a vastly different map from Kursk, there are 7 Control Points (5 Cps + 2 capturable Bases) instead of 2 CPs and 2 un-capturable bases. A side at Aberdeen will need to hold any four (normally a base + 3 CPs) of these to make the other side bleed tickets, rather than just two. We will start making adjustments to Ai to allow for this.

The goal of the initial attack is to capture as many CPs as possible, without over extending. Lets go through some choices -

numberOfAttacks 1: All the Bots from each side will head to the single most valuable CP, leaving other CPs open for capture (the other side of bots will make the same single attack but humans player won't)

NumberOfAttacks 2: Two groups of Bots from each side head for the two most valuable CPs, this only leaves one CP left open for capture but it when a side Captures it, that will be the fourth CP for that side and the other side will bleed. You could consider this a safe choice, the Bots establish a front from which to launch further attacks, and it should also be noted that the conditions will change when a side captures a third CP and that will activate other strategies.

NumberOfAttacks 3: Three groups could be used to not only establish the front by grabbing two CP's but also to preemptively push for that fourth and controlling CP, but as this strategy will also be used in a “panic” situation when a side is bleeding tickets, three attacks may spread the forces to thin to capture any CPs at all. More than three attacks will have the effect of Bots moving towards & fighting for many CPs with lots of fireworks, but could disadvantage a side by not establishing a front line to work from.

At the end of the day, this is a strategic decision that should be made on the grounds of how you want your Ai to play the game. Just keep in mind that Bots are simple creatures. Don't try and get them to do too much, keep to a basic plan of attack and allow for the human factor as while one team of Bots playing another team of Bots is a fairly standard affair, your real opponents will be human, and it will only take one unpredictable act like sneaking into the enemy base to completely stuff it all. With two things in mind, I want an established front and knowing that the conditions will change when the bots achieve this, I am going to use 2 Attacks and change the line to read ...

aiStrategy.NumberOfAttacks 2

We do not want any Bots on defensive duties while this strategy is active, so NumberOfDefenses 0 can stay unchanged.

 

 

aiStrategy.setPrerequisite breakOutPrereq

This should look familiar, it is the reference to breakOutPrereq from Prerequisites.con. This is the link that selects the breakOut strategy when the prerequisite is active.

 

 

aiStrategy.setStrategicObjectsModifier <OTFLAG> <MULTIPLIER>

Object Modifiers are where the control of our Bots really comes from. By using the OT Flags that we defined earlier in StrategicAreas.con, we can modify the original values of particular SAs to give the Bots “incentive” to attack or defend the SAs of our choosing. The Modifiers works by multiplying the value of Strategic Areas with a matching OT Flag by the MULTIPLIER. In the breakOut strategy this statement multiplies all ControlPoints by 4

aiStrategy.setStrategicObjectsModifier ControlPoint 4.0

Lets have a closer look at the information that is displayed for a Strategic Area and check the results of this. First, the Centre Control Point.

 

The first line of the information is identification, the number at the beginning is given to the SA by the order it is defined in StrategicAreas.con. CP_Centre is the name, again as it was defined in StrategicAreas.con. At the end is a tag, [CP] that acknowledges that this SA is a Control Point.

The second line, gives us the “temporary” or Modified values of the Strategic Ares. Note there is a value for each side, on this occasion the value is the same for each side but there will many occasions where the values will be different as each side could be in different Strategies. The value of this SA at the moment is 412, the original value of this SA was defined as 100 and the multiplier we used was 4 which when multiplied gives 400. So what gives ? and why is the SA valued at 412 ? This is your first curve ball, the SAi seems to have it own hard-coded value system that will adjust values of SAs slightly and at times, fluctuate the values greatly. These adjustments may be based on facilities, spawn objects or even cover available in the SA. The fluctuations i have no explanation for, it may be to add variation, or to increase the chance a Bot may spawn at home base for a short period. Be careful of fluctuations as if your SA values are finely balanced, it may cause one SA to become more valuable than you expected it too, and the Bots may do a U-turn and head for that SA instead.

The third line indicates which unit classes are allowed to use this SA. For land based Ai like we are covering it will always be all, as we have not defined any Unit classes or marked SAs accordingly. The Unit classes are used when there is a combination of Land & Water units, that need to have SAs that are marked for their specific use. Eg: SAs in the water will accept SEA. This prevents Bots from trying to drive or walk into the Ocean.

The Fourth and Fifth lines, detail the status of the SA for each side. Some of these details are a little hazy, but here goes

P: - Present ? Seems to indicate how many bots are in the vicinity of the Strategic Area, not always accurate tho ...

A: - Attack ? I have never seen it indicate anything other than zero ...

D: - Defense ? Again ... i have never seen anything other than zero ...

Ass: - Assigned - Is a fairly reliable indicator of how many Bots have been told to attack/defend this SA. You can use the Bot Stats to clarify this, as the RED lines will show you where a Bot is heading to.

 

 

St: - Status - Shows the ownership status of the Strategic Area and are NOT linked to the status of a CP Flag (if present), the two are tracked separately. There are three different possibilities, Hostile, Neutral, and Owned. At the beginning of a round the ownership is determined by the .setSide statement for the SA in StrategicAreas.con. When a player/bot is in the SA he will then affect the Status, if the other side is not present, the SA will become Owned by that side after a short period. Much like a CP Flag, both sides cannot own a SA at the same time, but if both sides are in the SA, the status will remain hostile for both sides, until only one side remains in the SA.

Be aware that if a Bot is in the SA, but not within range of a CP Flag, it is possible the SA will change, but the flag will not and this could possibly cause havoc with the modified value of the SA in relations to others, and the Bots could leave the SA without capturing the Flag.

An SA's Status can also be used as a Object Modifier, allowing us to further control the bots in the strategies depending on the ownership of a Strategic Area.

 

 

Ok, now that we know what the Strategic Area statistics are telling us, lets have a look at the rest of the map's SAs while the AI for both sides are still in the breakOut strategy .

Here is another curve ball, each team's own value for the waypoint is many more times the value it was given in StrategicAreas.con (10) even though this SA has no OT Flags or Modifiers applied This could be due the number of Bots present in the Area ? The value for an opposing team's SA (eg: AX_Waypoint from the Allies perspective) remains at (or near) the SA's original value.

 

 

Looking around the open control points, each of these SAs has an original value of 100 They also have the OT Flag ControlPoint and so are multiplied by the Modifier of 4.0. The SAi's own value system is at work again, and hence why each SA's value is higher than the expected value of 400.

CP_West & CP_East SAs have more equipment available than CP_North or CP_South, which in turn has more equipment than CP_Centre which has the lowest modified value of all the Neutral Strategic Areas.

Lastly, we come to the main bases, and here is a real good curve ball. The OT Flag Base, will give modified values of the Base's SA that will fluctuate throughout the game for the side that owns it. It is possible that the OT Flag Base has a hard-coded multiplier that varies between 1.0 and 2.0 ?

 

 

Want to put some of that to work ? Ok, this is what I am going to try and achieve ... at the beginning of the round, while in the breakOut strategy, I want the Bots to attack CP_East or CP_West while they are Neutral, in preference to other, possibly Hostile SAs. To this i will add new modifiers that use the OT Flag of each SA, and take into account the Status of these SAs.

aiStrategy.setStrategicObjectsModifier ControlPoint 4.0

aiStrategy.setStrategicObjectsModifier West 2.0 Neutral

aiStrategy.setStrategicObjectsModifier East 2.0 Neutral

These two new statements will further multiply the values of CP_East and CP_West, making the total multiplier 8, while these two SAs have a Neutral Status.

 


Once either team gains control of the SA and it is no longer Neutral, only the original ControlPoint 4.0 Modifier applies, and the values drop back to around 400.

 

The breakOut strategy is doing a decent job of getting the Bots moving, so lets move on to the next Strategy, holdAndCamp. This Strategy will be active when a Side has 4 or more Control Points and the other side will be bleeding tickets. This is an advantage worth holding on to, so we will setup the strategy to defend the Friendly Control Points.

aiStrategy.Aggression 0.25

To totally shut down can be a tactical blunder, as it can allows an enemy to mount an organized offensive. A low setting of 0.25 will keep most of the Bots around for defense, while allowing a few Bots to attack Hostile SAs. You could use a higher value, if you believe in “Attack is the best Defense.”

aiStrategy.NumberOfAttacks 2

The number of Attacks for this strategy isn't really important as most of the Bots will be defending, but I will send what few Bots are on attack to separate SAs, and you never know, they may get lucky or at the least be a pain in the butt. One attack would be a suitable alternative, but three would probably be too many, and of no use at all.

aiStrategy.NumberOfDefences 3

When this strategy is active the Side will most likely have a Base and Three of the Open Control Points. We are going to defend everyone of these valuable Control Points, by spreading our defending Bots to them. Two defenses would be alternative, but protecting only the Two most valuable SA would leave a defensive hole behind the Front line. You could consider using four defenses, to increase defenses behind the front line (eg: the main base) but as Aberdeen has no planes for players to “drop in” this may stretch the front line defense too thin.

aiStrategy.setStrategicObjectsModifier Safe 0.2 Owned

Safe is a hard-coded modifier that does not have a OT Flag that can be added to a Strategic Area. This line's purpose is to Modify the value of an Owned Base SA, and it does not affect other Owned SAs. By using a Modifier less then zero, we can reduce the Modified value of this Strategic Area, the effect of which is to motivate the bots to leave this SA for more valuable SAs

 

aiStrategy.setStrategicObjectsModifier ControlPoint 2.0 Owned

This line should look easy now, the value all Owned ControlPoints will be multiplied by 2. Now this is fine for a simple map like Kursk, there is only two Control Points and if a side is camping, they will have both of them. For Aberdeen we'll need to give the Bots a bit more direction and tell them which SAs we think they should defend and where possible, which one(s) to Attack. To do this we will replace the ControlPoint modifier with other modifiers that will make CP_East & CP_West the most valuable CPs, and CP_Centre more valuable, but not as valuable as CP_East & CP_West.

aiStrategy.setStrategicObjectsModifier West 2.0

aiStrategy.setStrategicObjectsModifier East 2.0

aiStrategy.setStrategicObjectsModifier Centre 1.5

Here, the Allies are using the holdAndCamp strategy.

 

 

 

 

 

 

 

CP_East has a multiplier of 2.0 applied and its value is close to the expected value of 200. The Allies currently own this SA, and as we have set .NumberOfDefences 3 the defensive Bots will be distributed amongst the 3 most valuable Owned SAs.

Thanks to our modifiers CP_East is the most valuable Owned SA and has Bots assigned to it.

 

CP_Center has the multiplier of 1.5 applied and is close to the expected value of 150. This Area is the second most valuable SA and accordingly, has Bots assigned to it.

CP_North, without any multipliers affecting it, remains close to its original value. Even at this low value, it is one of our three most valuable Owned SAs, and has Bots assigned to it.

 

CP_West is the highest valued Hostile SA, followed by CP_South. When the Bots get organised for an attack, these two areas will come under fire with CP_West receiving the most attention.

Ok, looking good. Its time to give the attacking strategies some attention, lets look at the single strategy.

 

 

aiStrategy.Aggression 0.75

We want the bots to push for another CP, but with out sacrificing any already Owned SAs so we will use a higher aggression but not so high that we leave no Bots for defense.

 

 

aiStrategy.NumberOfAttacks 1

As the name of this strategy implies, we are only going to attack 1 Hostile CP at a time.

 

 

aiStrategy.NumberOfDefences 2

At this stage of the game, a side will only have 2 CPs, if you used 3, Bots would be hanging around the main Base, not doing anything useful.

 

 

aiStrategy.TimeLimit 200

Here is a new line for you. Previously i have mentioned that we can use the counter to allow the Ai to switch strategies. To use the counter in such a way, the strategies involved must each have a .TimeLimit otherwise the Ai will not know when to consider changing strategies and will be stuck in the same strategy until the Conditions change. Both the single and double strateiges have .TimeLimit 200, when the counter reaches this figure, the Ai will return to the Prerequisite decision process and “Roll the Dice” again. As we covered earlier, the Prerequisite for the single and double strategy, each have the same value so when the Counter hits the timeLimit, each strategy has an equal chance of being chosen and used until the Counter hits the timeLimit again.

 

 

aiStrategy.setStrategicObjectsModifier Safe 0.7 Owned

Since Aberdeen has alot of tanks at the main base, we will increase the value of the main Base in an effort to make more Bots spawn there, and grab a tank before joining the battle on the front lines.

Lastly, we will add the same modifiers that we used in holdAndCamp, to give the Bots the same guidance.

aiStrategy.setStrategicObjectsModifier West 2.0

aiStrategy.setStrategicObjectsModifier East 2.0

aiStrategy.setStrategicObjectsModifier Centre 1.5

Again, looking from the Allies point of view, they own CP_North & CP_East and are using the single strategy.

 

 

 

CP_North & CP_East are the 2 most valuable Owned SAs, and have a couple of Bots each for defensive duties.

 

 

 

CP_West is the most valuable Hostile SA, and it looks like there is going to be party over there soon.

 

 

 

As AL_Base's value fluctuates around thanks to the SAi, there will be times when it will be more valuable than CP_North, and hopefully you will see Bots spawning at the Base and leave with any tanks that are available during this time.

Now for the double strategy. As this is an alternative attacking strategy to single it is going to very similar except a few changes.

 

 

aiStrategy.Aggression 0.9

We will use a higher Aggression than single. As the attacking groups spread out, we can afford to skimp on defense a little.

 

 

aiStrategy.NumberOfAttacks 2

Unchanged, the double strategy is supposed to provide 2 attacking groups

 

 

aiStrategy.NumberOfDefences 2

There will not many Bots left for defensive duties, but we will try and cover what we have.

 

 

aiStrategy.setStrategicObjectsModifier Safe 0.7 Owned

We still want to encourage Bots to grab Tanks from the main Base.

 

 

aiStrategy.setStrategicObjectsModifier West 2.0

aiStrategy.setStrategicObjectsModifier East 2.0

aiStrategy.setStrategicObjectsModifier Centre 1.5

 


And again add the Modifiers to give the Bots guidance.

 

 

--------------------------------------------------------------------------------

Last step, in this part is to repack the Ai and spend a moment or two watching how the AI plays.

Increment the addon again, this time to Aberdeen_012.rfa.

We're starting build a little history of our Ai, we'll call the last one our Alpha.

This version should play a reasonably decent game and we'll call it a pre-beta. There are still a few quirks that each side has, and so far we have been unable to use North or South OT Flags, as what would be good for one side will not be good for the other side, due to the “mirrored” nature of the strategies.

 


Once you have packed the file, start the game and go Cap some Flags ; )

 

 

- END OF PART 3 -

 

 


--------------------------------------------------------------------------------


Credits:

Arc D'Wraith - Author

Augustus - Surviving incessant Tundra Ai updates

Coralon - Proof Reading & Feedback

White Thunder - Title Image

 


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 8

GMakeRFA

Notepad

Open Office

 

 

 

Please excuse my english, i'm Australian ; )




Live Free and Ride With The Angels My Friend.

 All material Copyright 2004 NetSimZ.com

Except for user input, that is copyright the respective submitter.
 

Brought to you by New York Freelance Technology and Montana Freelance Technology