Advanced strategy commands for BF1942 By CareyBear
Ok, we all know the basics - or I hope you do, or this tut won't mean much.
I'm assuming you can write a custom ai - that is, your own conditions, prerequisites, strategies and strategic areas, or at least be fairly familiar with the contents of all of them. These commands can also be added to existing AI strategies.\
I take no responsibility for anything untoward which may happen to… ah stuff these disclaimers. They're a waste of time. This is all correct as far as I know. Of course, you might stuff your comp and BF install, but that's your problem. Agreed? :
Deep in the game.rfa file is an ai folder, containing conditions, prerequisites and strategies .con files. The strategies.con contains:
|rem *** Create Strategies *** |
The interesting lines are in dark blue and light blue - the light blue ones are remmed out, so we should probably be a little more cautious expecting them to do anything. There's more too - Let's have a little look at the strategies from Battle of Britain for a sec.
|rem ** American ** |
There they are again! Ok, so we've found:
|Arguments||aiStrategy.setTreeModifier TTNDefensivePos 0.75|
aiStrategy.setTreeModifier TTNDefensivePos 1.5
|Arguments||aistrategy.setTreeModifierCombatStrength TTNFriendAir 5.0|
aistrategy.setTreeModifierCombatStrength TTNFriendAirMobile CSTAir 5.0
So, what the hell do they do? I'm not sure what part of the AI structure the Tree is, but it's probably something to do with decision making. Another thing notable about the aistrategy.setTreeModifier arguments is that the number is between 0.75 (lowest) and 2 (highest). This could indicate that the argument is a weighting for AI behaviour - where 1 would indicate a 'normal' weight for the type defined in the argument (eg, TTNFriendGroundFixed). So the line aistrategy.setTreeModifier TTNHostileNaval 2.0 would mean the AI had a preference for (?targeting?) enemy Naval vehicle types which was double normal. The strategy this was found in is called airToNaval, so this seems to be a safe assumption.
The type arguments for the two seem to be the same as well. That is, they include:
TTNFriendGroundFixed appears on both sides. If the commands are consistent, we can take some guesses at what some others might be too.
The ones in blue are the ones we've found, the black ones are 'these will possibly/probably work'
Now, lets keep going with aistrategy.setTreeModifierCombatStrength This command has two different instances - one with two arguments, and the rest with three. We have a 'type' as above, a number (probably similar to the general strategy SA weighting numbers - they seem to be in the same range), and another 'type' of some sort..
Ok, this is weird. Looks like it might more closely define the setting. So, if the (for example) command was
aiStrategy.setTreeModifierCombatStrength TTNFriendAir NavalArmour 2.5
we could probably expect the bots to favour using or boarding friendly Air vehicles which are effective against NavalArmour. CSTAir may indicate anti-aircraft - that is, fighters and AA guns, for TTNFriendAir and TTNFriendGroundFixed
Other possible arguments for this might be HeavyArmour, LightArmour, Submarine etc, but that's just a guess.
I don't pretend to know all about this stuff, but this is what I've found out so far about this interesting aspect of BF's AI.
Creative and careful use of these can change the way a mission works by giving the AI preference for particular vehicle types. BoB used it to make them want planes, I've used it in Aberdeen to make the bots prefer ground vehicles to walking. It seems to have some effect.
There are more interesting tidbits hidden in game.rfa, but I'm not going through them now.. Cheers all..