Forged Alliance Forever Forged Alliance Forever Forums 2016-09-05T02:28:03+02:00 /feed.php?f=41&t=13052 2016-09-05T02:28:03+02:00 2016-09-05T02:28:03+02:00 /viewtopic.php?t=13052&p=134598#p134598 <![CDATA[Re: [?] Is it possible to have AI-Only units?]]>
Code:
        BuilderConditions = {
            { UCBC, 'HaveGreaterThanUnitsWithCategory', { 4, categories.ENGINEER * categories.TECH3}},
            { UCBC, 'UnitsLessAtLocation', { 'LocationType', 8, categories.SHIELD * categories.STRUCTURE}},
            { MIBC, 'FactionIndex', {1, 2, 4}},
            { EBC, 'GreaterThanEconEfficiencyOverTime', { 0.8, 1.1 }},
            { IBC, 'BrainNotLowPowerMode', {} },
        },


I guess you can see, there is already "GreaterThanEconEfficiencyOverTime" to watch the energy.
To explain the lines:

{ UCBC, 'HaveGreaterThanUnitsWithCategory', { 4, categories.ENGINEER * categories.TECH3}},
Build T3Shield if we have more then 4 units with categories.ENGINEER AND categories.TECH3 (engineers, subcommander)

{ UCBC, 'UnitsLessAtLocation', { 'LocationType', 8, categories.SHIELD * categories.STRUCTURE}},
Build T3Shield if we have less then 8 Units at location with categories.SHIELD AND categories.STRUCTURE (Shield buildings)

{ MIBC, 'FactionIndex', {1, 2, 4}},
Build T3Shield if we are from faction 1 UEF, 2 Aeon or 4 Seraphim. (Cybran can't build T3 Shield buildings. They upgrade to ED5 Shield)

{ EBC, 'GreaterThanEconEfficiencyOverTime', { 0.8, 1.1 }},
Build T3Shield if MassEfficiencyOverTime is greater then 0.8 and EnergyEfficiencyOverTime is greater then 1.1

It is actual calling this function:
Code:
function GreaterThanEconEfficiencyOverTime(aiBrain, MassEfficiency, EnergyEfficiency)
    local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
    if (econ.MassEfficiencyOverTime >= MassEfficiency and econ.EnergyEfficiencyOverTime >= EnergyEfficiency) then
        return true
    end
    return false
end

{ IBC, 'BrainNotLowPowerMode', {} },
Build T3Shield if we are not in LowPowerMode

This is how the AI decides to build something.

You can find this in "AIDefenseBuilders.lua". Search for: "T3Shields".
There you can find the full Builder for T3 Shields. Its not big, only 33 lines.

Statistics: Posted by Uveso — 05 Sep 2016, 02:28


]]>
2016-09-05T01:53:44+02:00 2016-09-05T01:53:44+02:00 /viewtopic.php?t=13052&p=134595#p134595 <![CDATA[Re: [?] Is it possible to have AI-Only units?]]> Statistics: Posted by Tanksy — 05 Sep 2016, 01:53


]]>
2016-09-04T21:05:31+02:00 2016-09-04T21:05:31+02:00 /viewtopic.php?t=13052&p=134582#p134582 <![CDATA[Re: [?] Is it possible to have AI-Only units?]]>
Code:
function AIGetEconomyNumbers(aiBrain)
[...]
    -- LOG('*AI DEBUG: RETURNING ECONOMY NUMBERS FROM AIBRAIN ', repr(aiBrain))
    local econ = {}
    econ.MassTrend = aiBrain:GetEconomyTrend('MASS')
    econ.EnergyTrend = aiBrain:GetEconomyTrend('ENERGY')
    econ.MassStorageRatio = aiBrain:GetEconomyStoredRatio('MASS')
    econ.EnergyStorageRatio = aiBrain:GetEconomyStoredRatio('ENERGY')
    econ.EnergyIncome = aiBrain:GetEconomyIncome('ENERGY')
    econ.MassIncome = aiBrain:GetEconomyIncome('MASS')
    econ.EnergyUsage = aiBrain:GetEconomyUsage('ENERGY')
    econ.MassUsage = aiBrain:GetEconomyUsage('MASS')
    econ.EnergyRequested = aiBrain:GetEconomyRequested('ENERGY')
    econ.MassRequested = aiBrain:GetEconomyRequested('MASS')
    econ.EnergyEfficiency = math.min(econ.EnergyIncome / econ.EnergyRequested, 2)
    econ.MassEfficiency = math.min(econ.MassIncome / econ.MassRequested, 2)
    econ.MassRequested = aiBrain:GetEconomyRequested('MASS')
    econ.EnergyStorage = aiBrain:GetEconomyStored('ENERGY')
    econ.MassStorage = aiBrain:GetEconomyStored('MASS')
[...]

Statistics: Posted by Uveso — 04 Sep 2016, 21:05


]]>
2016-09-04T21:02:53+02:00 2016-09-04T21:02:53+02:00 /viewtopic.php?t=13052&p=134580#p134580 <![CDATA[Re: [?] Is it possible to have AI-Only units?]]>
Code:
        local aiBrain = self:GetAIBrain()

        local massIncome = aiBrain:GetEconomyIncome( 'MASS' )
        local energyIncome = aiBrain:GetEconomyIncome( 'ENERGY' )
        local massNeed = aiBrain:GetEconomyRequested('MASS')
        local energyNeed = aiBrain:GetEconomyRequested('ENERGY')

Statistics: Posted by Uveso — 04 Sep 2016, 21:02


]]>
2016-09-04T19:09:14+02:00 2016-09-04T19:09:14+02:00 /viewtopic.php?t=13052&p=134571#p134571 <![CDATA[Re: [?] Is it possible to have AI-Only units?]]> Statistics: Posted by Tanksy — 04 Sep 2016, 19:09


]]>
2016-09-04T03:22:04+02:00 2016-09-04T03:22:04+02:00 /viewtopic.php?t=13052&p=134524#p134524 <![CDATA[Re: [?] Is it possible to have AI-Only units?]]>
Code:
        if self:GetAIBrain().BrainType == 'Human' then
            self:AddBuildRestriction(categories.xeb0204)
        end
That on a unit would restrict that specific unit from building xeb0204 if controlled by a human.

For a more global solution you would need to do something like this in the aibrain:
Code:
        if self.BrainType == 'Human' then
            AddBuildRestriction(self:GetArmyIndex(),categories.xeb0204)
        end

Statistics: Posted by Balthazar — 04 Sep 2016, 03:22


]]>
2016-09-02T13:40:03+02:00 2016-09-02T13:40:03+02:00 /viewtopic.php?t=13052&p=134373#p134373 <![CDATA[Re: [?] Is it possible to have AI-Only units?]]> Statistics: Posted by speed2 — 02 Sep 2016, 13:40


]]>
2016-09-02T13:22:10+02:00 2016-09-02T13:22:10+02:00 /viewtopic.php?t=13052&p=134370#p134370 <![CDATA[Re: [?] Is it possible to have AI-Only units?]]> Statistics: Posted by Tanksy — 02 Sep 2016, 13:22


]]>
2016-09-02T12:02:53+02:00 2016-09-02T12:02:53+02:00 /viewtopic.php?t=13052&p=134356#p134356 <![CDATA[Re: [?] Is it possible to have AI-Only units?]]>
Else the similar way the AI can have more build power on units or multiplied eco income, you should be able to set it to have less power consumption on the shield(s).

Statistics: Posted by speed2 — 02 Sep 2016, 12:02


]]>
2016-09-02T10:33:27+02:00 2016-09-02T10:33:27+02:00 /viewtopic.php?t=13052&p=134336#p134336 <![CDATA[[?] Is it possible to have AI-Only units?]]>
I've been modifying the Indestructible Experimental Shields mod to make it more AI-Friendly.
Originally, the AI had a 25% chance to build these (as opposed to a T3 Shield Generator -- Using SorianAI of course) which I lowered to 10%.

Now, I don't know fully how sensible the AI is. Does the AI build something even when it's utterly unfeasable? The modifications I've made to the Shield Gen put the energy maintenance up from 70k to 100k, and I worry that the AI may get a lucky roll of the dice and decide to try throwing one of these up waaay before they're even close to enough energy income.

What I would like to know, is if it's possible to have units that ONLY the AI can build? That way I could make a cheaper version, with a much lower energy maintenance, that Human players are unable to build that the AI could throw up without too much of an impact on their Eco. As it is now, I worry that the AI might try throwing one up as soon as they hit T3 and essentially kill their entire build rate because of having -90k power or so.

Statistics: Posted by Tanksy — 02 Sep 2016, 10:33


]]>