Jump to content


troubadour

Member Since 04 Oct 2006
Offline Last Active Aug 30 2009 07:32 AM

Topics I've Started

InfantryTactic.TargetAbilities

21 August 2009 - 09:05 AM

In InfantryTactic there is a global table named TargetAbilities that is used to store Abilities name, ID, filter and timer
However this table is global to InfantryTactic class meaning it is not duplicated for each instanciated squad.

Using a global table for things such as ability name, ID and filter make sense but for timer it does not.
Timer is stored in 5th position in the table (refer to InfantryTactic:DoAbilities() )

At the moment when a squad use an ability since there is only one timer for all the squads this ability is locked for all of them.

EG : SM Tactical squad + frag grenades.
If squad A launch grenade at time = 9s, squad B will not be able to launch a grenade untill time + 5 = 14s in game because of squad A according to function InfantryTactic:DoAbilities()

In order to prevent multiple attack bug for one squad, ability usage has been potentially disabled for all the squad of this kind.

I think it could be easily solved by relocating the Target ability table into constructor (name and ID will be duplicated but each squad will be able to use the ability)
It really shows for abilities used by great number of squads such as infantry grenade, when using a target ability table for each AI uses grenades very often.

Moreover the delay of 5 seconds shall not be hardcoded but customized for each ability, eg timer for frag grenades is 25s and timer for smite is... well something else
Unfortunately there is no way to retrieve this info using lua code i guess

Ability.Filter vs FindFirstXXX() function

13 January 2009 - 08:42 AM

In Dow AI code, I have noticed that there are many lines such as :

local infantry = Ability.Filters.CloseInfantryEnemy( squad_pos, 15, 1 )
local vehicle = Ability.Filters.CloseVehicleEnemy( squad_pos, 10, 1 )
local commander = Ability.Filters.CloseCommanderEnemy( squad_pos, 10, 1 )

They are used to retrieved a specific unit in range of squad_pos, but what is the difference with :

local oEnemyUnit = cpu_manager.cpu_player:FindFirstEnemy(vSquadPos, iScanRange, 1)
oEnemyUnit:GetStats():GetClass()
and then checking the GetClass() returned value

Because it seems to me the Ability.Filters thing is more "elegant" vs FindFirstEnemy(), is there a major performance cost when using Ability.Filters ?
Do these 2 piece of code do the same thing ?