Jump to content


Photo

InfantryTactic.TargetAbilities


3 replies to this topic

#1 troubadour

troubadour
  • Members
  • 88 posts

Posted 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

Edited by troubadour, 21 August 2009 - 09:06 AM.


#2 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 21 August 2009 - 08:07 PM

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

You'd have to go through each ability in the AE code and see the recharge time to know that. :lol:

I still find the AI ability logic you mentioned odd because I haven't seen lags in time when abilities are used by multiples of the same squad.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#3 troubadour

troubadour
  • Members
  • 88 posts

Posted 30 August 2009 - 07:33 AM

I still find the AI ability logic you mentioned odd because I haven't seen lags in time when abilities are used by multiples of the same squad.


I am not a LUA guru but i think you got the feeling it works because timer for all target ability is hard coded to 5 sec and not to real timer for grenades which are around 25 sec.
If you replace 5 with 25 in InfantryTactic:DoAbilities(), i mean this line

if (now > InfantryTactic.TargetAbilities[i][5] + 5 and Ability.DoAbilityTarget( self.squad_ai, ability_id, filter, count )) then
InfantryTactic.TargetAbilities[i][5] = g_iGMT
end

You will notice that 25 sec are required between 2 grenade use among 3 or 4 SM squads

#4 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 29 September 2009 - 05:56 PM

Reducing to 2 seconds seems to be an easy and practicable solution without coding fuss. Will leave enough time for targetted squad to get on their feets before being naded again.

Edited by LarkinVB, 29 September 2009 - 05:59 PM.




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users