Lets help the AI purchase the unpurchaseable



  • I would like to collect in one place all the things the AI does not purchase or purchases badly.

    For me the AI will not Purchase the following;

    Unit---------- Atk-Def-Move  Notes
    Fort------------0---0-----0---isInfrastructure, isConstruction
    Castle----------0---0-----0---as an upgrade to a Fort
    Cruise Missile--0---0-----7---isStrategicBomber,  isFirstStrike,  isSuicide,   isKamikaze

    Please list all your AI purchase issues, even ones previously posted by others, then we can all see if it's a common or rare problem, then I will attempt to identify possible solutions to help the Devs.



  • Possible Solution for 0 move units

    In ProPurchaseOption.java line 259+

    private double calculateLandDistanceFactor(final int enemyDistance) {
        if (movement <= 0) {
          return 0.1; // Set 0 move units to an order of magnitude less than 1 move units

    I think this calculation is forcing movement 0 units to have a value of 0.1 and I think this needs to be increased, but to what value?

    This value could be included in the new AI properties file, something like this;
    AI.PurchaseOption.ZeroMovement=0.5
    .
    .
    Possible Solution for over buying Air units on a bid or turn 1 when the AI has a lot of money and also during the game

    Either code to ignore for turn 1 or less and/or change the value 10 below to a smaller value.

    In ProPurchaseAi.java line 2154+
    if (ppo.isAir()) {
    attackEfficiency *= 10;
    }

    In ProPurchaseAi.java line 2323+
    if (ppo.isAir()) {
    efficiency *= 10;
    }

    This value could be included in the new AI properties file, something like this;
    AI.PurchaseAi.AirEfficiency=8
    .


  • Admin

    @TheDog This is done on purpose. A significant amount of either logic to value 0 move units better or a map specific AI property would need to be added. Otherwise you risk the AI buying lots of 0 move units and not understanding that they can't move anywhere.



  • A common problem is buying too many air units if the AI has a large amount of money, which can happen with a starting bid. This happens in all scenarios.



  • @RogerCooper I dont play much WWII, but I am working on an Ultra modern/SciFi map and noticed the same, that the AI buys 3 Stealth Bombers and I thought why, when it needs ground units, but as you said the AI has a lot of money.

    A possible solution has been added to post 2.



  • @TheDog I don't think that proposed fix is sufficient. The problem is not only a bid problem, it can also happen during the game if the AI has relatively few factories. The AI does not really deal with the concept that enough is enough.



  • @RogerCooper You could be correct.

    There are two parts to the proposed fix.

    1. The bid/turn one purchases, hopefully that's now covered.
    2. The x 10 variable, makes the probability of buying aircraft probably too high and this value should be reduced, but to what ? Hopefully having it as a mapmakers/tinkers AI property we can find out.

    As an example, having this value as an AI variable for WWI this can set as 2 and for WWII 5, for modern warfare 8, the higher the number the more aircraft are favoured.


  • Admin

    @TheDog if you decrease that air variable then the ai is probably gonna buy even less air units then it does today which is probably gonna make it worse in most situations.



  • AI has issues buying other resources. Frostion's warcraft map lets you buy wood, food, etc. and the AI won't.

    AI doesn't factor units with createsunitlist into purchases.

    AI either doesn't make purchases of units that consume other units, or does it poorly. I can't remember which.



  • It is hard to see how the AI can deal with buying resources without some specific guidance. Perhaps a supplementary AI plan file that can be read by the AI. An AI plan file could contain a series of conditions and actions that the AI would execute before doing its regular buys.



  • The AI would need to know the value/ratio of a resource, compared to 1 PU.
    Resource1,fuel,0.5
    Resource2,iron,1.25
    Resource3,wood,2
    etc

    But the more resources the harder it will be for the AI to work out what is the best value per resource combo. The more resources the longer time it will take to come to a conclusion.

    I dont think there is a quick fix for this one.


  • Admin

    @TheDog This is the design that I came up with to add valuation for non-PU resources for the AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback/192



  • @redrum Wow already have a design that looks like it should work, when can you start work. 😛

    Seriously though, are you back as an observer or as a Dev?

    Either way good to have you back!

    Some questions
    Would you limit the number of non-PU resources? If so, to how many? Frostions Warcraft map has 6.
    Could it be done in two phases, the 'supply' side and then the 'demand' side or would it be better to do as one phase?
    Would this AI project conflict with what Trevan is currently doing?


  • Admin

    @TheDog Just a player and observer at the moment.

    • Shouldn't need to be any limit as it would just make each resource's value "relative" to PUs
    • Yes, it could be implemented in phases
    • No idea as I'm not sure exactly what Trevan is planning to do


  • @TheDog said in Lets help the AI purchase the unpurchaseable:

    Would this AI project conflict with what Trevan is currently doing?

    No. My AI is completely different from @redrum's. So changes to his ai wouldn't affect mine.


Log in to reply