Jump to content


troubadour

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

Posts I've Made

In Topic: InfantryTactic.TargetAbilities

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

In Topic: Project Map Database

08 April 2009 - 08:55 AM

Doh ! i had high hopes too, thx for your input Arkhan

In Topic: Project Map Database

08 April 2009 - 06:55 AM

I think a pcall encapsulation to TerrainAnalyzer:HasThreatOnPath() could do the trick because it would prevent in game crash. Of course you will not know which map is a problem but do you really need this piece of info if the game does not crash ?

If there is an error raised during pcal() then the old code is used, Moreover it will work fine wiht ALL the maps..

Well just my 2 cents , here is a piece of code with in bold lines i added, i have slightly edited cpuManager:HasThreatOnPath() to perform a 1st call to TerrainAnalyzer:HasThreatOnPath() if no error is raised then we return the result else we keep running the old code


function CpuManager:HasThreatOnPath(vPos1, vPos2, iRange)


dbAssert(vPos1 ~= nil)
dbAssert(vPos2 ~= nil)
dbAssert(iRange ~= nil)

-- Check if high speed AI setting is activated
if (CpuManager.AISettings.bHighSpeedAI == true) then
return false
end

function CheckThreat(pos1, pos2, range)
return cpu_manager.terrain_analyzer:HasThreatOnPath(pos1, pos2, range)
end

local noError, hasThreat = pcall(CheckThreat, vPos1, vPos2, iRange)
if noError then
return hasThreat
end


-- Calculate airline vector
local vAirline = Vector3f()
vAirline.x = vPos2.x - vPos1.x
vAirline.y = 0
vAirline.z = vPos2.z - vPos1.z

.......

end

In Topic: Project Map Database

06 April 2009 - 08:55 AM

It may be also possible to use protected call to catch error from Soulstorm TerrainAnalyzer:HasThreatOnPath() writing sthing such as :

CpuManager:HasThreatOnPath()

local status, hasThreat= pcall( self.terrainAnalyzer:HasThreatOnPath() )

if status == true then -- No error raised by HasThreratOnPath()

if hasThreat == true then
-- Do something
else
--- Do something else
end

else -- Error in HasThreatOnPath()
-- use the same piece of code in cpumanager:hasthreatonpath()

end
end

In Topic: Project Map Database

02 April 2009 - 02:35 PM

Great idea, i just had a look at SSPRO AI v2.5 to see how you implemented it, if HasThreatOnPath() works well for all std SS map it will be a huge step forward

BTW many thanks for working on SSPro AI, cheers !