Forgotten Hope Battlefield 2 Modification Development

Please note I am not a FH2 developer but I do work with some of the FH2 Single Player development team.

Forgotten Hope issue tracker for Single Player AI/Mapping.

Feed

Issue Tracker Ani Headline

Notes about AI/Bot behaviour

Here are some quick notes about mods\fh2\ai\aibehaviours.ai and it's relationship to some FH bot behaviours, plus possible fixes and new feaure implementations.

Line 65: rem *** Construct unit weights ***

"aiSettings.setBehaviourModifier Avoid       1.0" 

Weighting for avoidance of grenades ?

"aiSettings.setBehaviourModifier TakeCover   1.0"

Is this why they just keep on running at us ? Weight to add supression behaviour and then they take cover at high level of fire ?

"aiSettings.setBehaviourModifier Revive      1.0"

Of course default BF2 medic behaviour is not the same in FH. But could be altered to make bots throw a bandage at you ... add template to bandages in SP from revive pads ?

aiSettings.setBehaviourModifier Special2    1.0
aiSettings.setBehaviourModifier Special3    1.0
aiSettings.setBehaviourModifier Random      1.0
aiSettings.setBehaviourModifier Triggerable 1.0

Ha ! Special of triggerable could be used to send the bots away on an event - like a smoke grenade exploding. If they are running or something then they won't be targetting hence "blinded" by smoke.

rem *** Construct HeliMove weights ***
aiSettings.createBehaviourModifiers HeliMoveWeights
aiSettings.setBehaviourModifier Avoid       1.5
aiSettings.setBehaviourModifier MoveTo      7.5
aiSettings.setBehaviourModifier Idle        0.001
aiSettings.setBehaviourModifier Fire        1.0
aiSettings.setBehaviourModifier Special     1.0
aiSettings.setBehaviourModifier TakeCover   2.0
aiSettings.setBehaviourModifier Change      1.0
aiSettings.setBehaviourModifier c4          1.0
aiSettings.setBehaviourModifier Special2    1.0
aiSettings.setBehaviourModifier Special3    1.0
aiSettings.setBehaviourModifier Random      1.0
aiSettings.setBehaviourModifier Triggerable 1.0

(Note, could be block below this). MoveTo set too hight for tanks ? They tend to move too far ahead of infantry and hence are quickly destroyed. This is not very good behaviour for training online players.

Line 167: aiSettings.setBehaviourModifier Change		3.5

could be fix for bots leaving a vehicle too easily ?

rem *** Construct Avoid inhibitors ***
aiSettings.createBehaviourModifiers AvoidInhibit
aiSettings.setBehaviourModifier Avoid       1.0
aiSettings.setBehaviourModifier MoveTo      7.5
aiSettings.setBehaviourModifier Idle        0.0001
aiSettings.setBehaviourModifier Fire        0.0
aiSettings.setBehaviourModifier Special     5.0
aiSettings.setBehaviourModifier TakeCover   2.0
aiSettings.setBehaviourModifier Change      5.0
aiSettings.setBehaviourModifier Revive      0.0
aiSettings.setBehaviourModifier c4          2.0
aiSettings.setBehaviourModifier Special2    0.0
aiSettings.setBehaviourModifier Special3    0.0
aiSettings.setBehaviourModifier Random      0.0
aiSettings.setBehaviourModifier Triggerable 0.0

Hmmm. More tuning around possible cover and smoke issue ?

rem *** Construct Change Inhibit ***
aiSettings.createBehaviourModifiers ChangeInhibit
aiSettings.setBehaviourModifier Avoid       0.8
aiSettings.setBehaviourModifier MoveTo      5.0
aiSettings.setBehaviourModifier Idle        0.0001
aiSettings.setBehaviourModifier Fire        7.75
aiSettings.setBehaviourModifier Special     5.0
aiSettings.setBehaviourModifier TakeCover   2.0
aiSettings.setBehaviourModifier Change      0.0
aiSettings.setBehaviourModifier Revive      5.0
aiSettings.setBehaviourModifier c4          0.0
aiSettings.setBehaviourModifier Special2    0.0
aiSettings.setBehaviourModifier Special3    0.0
aiSettings.setBehaviourModifier Random      0.0
aiSettings.setBehaviourModifier Triggerable 0.0

Ah. This also has an effect on bots jumping out of vehicles when they player often has something else in mind. Why let THOSE bots jump out just to go on their beeline to the target, because ALL bots OUTSIDE vehicles will be doing that anyway.

Line 392: rem *** Infantry Behaviour setup ***

aisettings.setVehicleMods Infantery StandardWeights
aiSettings.setVehicleMaterialCost Infantery Ground     1
aiSettings.setVehicleMaterialCost Infantery Road       .5
aiSettings.setVehicleMaterialCost Infantery Shallows   1.5
aiSettings.setVehicleMaterialCost Infantery DeepWater  6
aiSettings.setVehicleBehaviour Infantery	Avoid		BBAvoid			BBPAvoidCollisionInfantery	1  UCUnion AvoidInhibit
aiSettings.setVehicleBehaviour Infantery	MoveTo		BBMoveTo		BBPGotoWaypointInfantery	4  UCUnion StandardWeights
aiSettings.setVehicleBehaviour Infantery	Idle		BBIdle			BBPIdleInfantery		5  UCUnion StandardWeights
aiSettings.setVehicleBehaviour Infantery	Fire		BBFireInfantery		BBPFireInfantery		4  UCFire  StandardWeights
aiSettings.setVehicleBehaviour Infantery	Special		BBMedicAssist		BBPMedicAssist		       12  UCUnion StandardWeights
aiSettings.setVehicleBehaviour Infantery	Special2	BBBridgeRepair		BBPBridgeRepair		       15  UCUnion StandardWeights
aiSettings.setVehicleBehaviour Infantery	c4		BBC4			BBPC4       		       12  UCUnion StandardWeights
aiSettings.setVehicleBehaviour Infantery	Special3	BBDefuseMines		BBPDefuseMines		       13  UCUnion StandardWeights
aiSettings.setVehicleBehaviour Infantery	Change		BBChange		BBPChange			6  UCUnion StandardWeights
aiSettings.setVehicleBehaviour Infantery	Revive		BBRevive		BBPRevive			8  UCUnion StandardWeights
aiSettings.setVehicleBehaviour Infantery	Random		BBRandom		BBPRandom       	       12  UCUnion StandardWeights
aiSettings.setVehicleBehaviour Infantery	Triggerable	BBTriggerable		BBPTriggerable       	       12  UCUnion StandardWeights

More settings for possible supression and smoke behaviour.

Hook example - BAPSTNotifyBot

For example a grenade could turn off notifying bots of targets for as long as a smoke grenade lasts. Of course it would hv to be only bots around the smoke ? Probably would not do it BUT this is simply an example of the OBLIQUE way of controlling the BF2 engine to achieve an effect ... THERE ARE NO REAL SOLDIERS BEING BLOCKED BY REAL SMOKE ... it's all the proverbial "smoke and mirrors".

Line 685: rem *** Passenger Behaviour setup ***

Tanks not firing MG ?

rem ***--------------------

aisettings.setVehicleMods 		ManDown		StandardWeights
aiSettings.setVehicleBehaviour 		ManDown		Idle		BBIdle			BBPIdle2d		2 	UCUnion 	StandardWeights
aiSettings.setVehicleDefaultBehaviour 	ManDown		Idle
aiSettings.addInterpreterEntry		ManDown		Trigger
aiSettings.addInterpreterEntry 		ManDown 	InfanteryResetControls
aiSettings.activateDefaultInterpreter 	ManDown		BAPSTWhile			Full
aiSettings.activateDefaultInterpreter 	ManDown		BAPSTParallel	Full
aiSettings.activateDefaultInterpreter 	ManDown		BAPSTSerial			Full
aiSettings.activateDefaultInterpreter 	ManDown		BAPSTSendRadioMessage		Full
aiSettings.activateDefaultInterpreter 	ManDown		BAPSTDebug			Full
aiSettings.activateDefaultInterpreter 	ManDown		BAPSTInfoWrapper		Full
aiSettings.activateDefaultInterpreter 	ManDown		BAPSTUseFlareOnMissileLock	Full
aiSettings.activateDefaultInterpreter 	ManDown		BAPSTSoldierPose	Full
aiSettings.activateDefaultInterpreter 	ManDown		BAPSTEvaluateCondition	Full

Related to possible development of self-healing bot behaviour, bots giving bots bandages, etc?

Python scripting for AI

# armor.canBeRepairedWhenWreck = 1 and armor.canBeDestroyed = 0 causes crash
for pco in bf2.objectManager.getObjectsOfType('dice.hfe.world.ObjectTemplate.PlayerControlObject'):
u.active(pco.templateName)
if u.templateProperty('armor.canBeDestroyed') == '0':
r('ObjectTemplate.armor.canBeDestroyed 1')
if u.templateProperty('armor.canBeRepairedWhenWreck') == '1':
r('ObjectTemplate.armor.canBeRepairedWhenWreck 0')

Taken from ""mods\fh2\python\game\plugins\aiFixups.py"

Here we have an example of actually altering internal settings depending on various values in settings files (*.con). Having looked at many AI problems while entering issues into the issue tracker I noticed many compromises that have been taken to get around crash problems, or instances where multiplayer functionality takes priority over the single player game. Using Python this can be got around.

Using setting file checks might also be able to be used for things like smoke.

Scholarly Lite is a free theme, contributed to the Drupal Community by More than Themes.