Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Attack_Target_Priority, script for AI Bots?
Re: Attack_Target_Priority, script for AI Bots? [message #436510 is a reply to message #436439] Mon, 13 September 2010 04:28 Go to previous message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma:
General (5 Stars)
My AI scripts already handle targetting priority for AR and APB base defences in our development builds and are designed to be easily extensible to infantry / vehicles... there is in fact an AI for tanks already implemented although it needs some tweaking.




My stuff works by assigning a 'base priority' to each target type (infantry, vtol, light vehicle, heavy vehicle, building) and then adjusting that based on a set of modifiers including distance to target, value of target and targets health status. It then picks the highest priority target to attack and continually re-evaluates the priorities of all available targets.




All the implementation specific classes inherit from the base class which handles the actual priority calculation, so it's easy to re-use it across other scripts. For instance dp88_AI_Tesla_Coil inherits from dp88_AI_Turret which in turn inherits from dp88_customAI (not actually a script since it's partially pure virtual) which itself inherits from PublicScriptImpClass.

dp88_AI_Turret is the base class for all turret type AI's and provides virtual functions to check the base power status etc, allowing scripts like dp88_AI_Tesla_Coil to override the base power status with its own implementation which allows the defence to be 'powered' by tesla troopers (this is for the AR mod) OR by the standard base power without rewriting all the targetting and priority calculation code to take it into account.



Example of script parameters in use currently;

Quote:


Priority_Infantry <- Base priority for attacking infantry (0 = do not attack infantry)
Weapon_Infantry <- Weapon for attacking infantry (1 = primary, 2 = secondary)
Splash_Infantry <- Set to 1 to attempt to damage infantry with splash (NOT recommended for high ROF weapons, it will slightly decrease accuracy due to targeting a location rather than the unit)
Priority_Light_Vehicle <- Base priority for attacking light vehicles (0 = do not attack light vehicles)
Weapon_Light_Vehicle <- Weapon for attacking light vehicles (1 = primary, 2 = secondary)
Priority_Heavy_Vehicle <- Base priority for attacking heavy vehicles (0 = do not attack heavy vehicles)
Weapon_Heavy_Vehicle <- Weapon for attacking heavy vehicles (1 = primary, 2 = secondary)
Priority_VTOL <- Base priority for attacking VTOLs (0 = do not attack VTOLs)
Weapon_VTOL <- Weapon for attacking VTOLs (1 = primary, 2 = secondary)
Min_Attack_Range <- Minimum attack range for primary weapon
Max_Attack_Range <- Maximum attack range for primary weapon
Min_Attack_Range_Secondary <- Minimum attack range for secondary weapon
Max_Attack_Range_Secondary <- Maximum attack range for secondary weapon
Requires_Power <- Require power to attack (Checked against base power state)
Distance_Modifier <- Sets the value for the distance-to-target priority modifier, higher values increase the priority of closer targets (recommendation: higher value for inaccurate weapons, lower for accurate weapons)
Target_Damage_Modifier <- Sets the value for the target damage priority modifier, higher values increase the priority of damaged targets (ie: more likely to attempt to finish off a heavily damaged unit instead of a healthy unit)
Target_Value_Modifier <- Sets the value for the target value priority modifier, higher values increase the priority of high value targets (ie: purchase cost)
Debug <- Set to 1 to instruct the script to create a text file logging how its calculated priority for different targets. This will allow fine tuning of modifiers and priorities since devs can get an idea of how its working internally.



http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Mon, 13 September 2010 04:34]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Little help JBServ
Next Topic: Tortoise SVN Public Repository
Goto Forum:
  


Current Time: Sun Jan 19 06:21:33 MST 2025

Total time taken to generate the page: 0.00677 seconds