AI ignores destructible factories


  • Donators

    I am working on a scenario with destructible factories

    		 attachTo="factory"
    		 javaClass="games.strategy.triplea.attachments.UnitAttachment"
    		 type="unitType">
    		 <option name="canProduceUnits" value="true"/>   
       <option name="defense" value="2"/>
       <option name="maxBuiltPerPlayer" value="3"/>
        </attachment>
    

    However, the AI refuses to build units with them. It works fine for humans. I have attached an example xml0_1528595987025_test.xml


  • Admin

    @rogercooper Yeah, the AI only builds factories that have "isInfra". The problem is there are a few maps like 270bc that have units that can build a limited set of other units. But I'm gonna add this to the list.


  • Donators

    @redrum Thanks. They can be useful in certain situations.



  • Hi,

    Is there any trick known to force AI to consider buying certain resources or units? For example units that are producing resources? I'm playing with Dragon War official and my little conversion of it (units eat and need to be paid every turn, towns are producing resources; food, PU's, metal, wood). AI just doesn't care, so I'm trying to force it to buy at last from time to time village or town. I'm considering make some "trick units", so AI can think "it's a good idea!" and buy something as something different. For example, super cheap unit, super defending or super attacking unit (based on simple stats), but in fact being something different? Let's say AI buys free unit, but can place it only on high value place and it's in fact village or factory?

    All the best,
    ComR


  • Admin

    @comr AI mostly looks to buy units that are cheap from a PU perspective and have high attack/defense/movement/hitpoints. The AI purchase logic was mostly written to handle PU only maps and doesn't consider many advanced unit options. At some point, I'm planning to rewrite it but hard to say when.



  • @redrum Yes, I know that TripleA was born as Allied & Axis game only and with only PUs in mind, but it changed much, so, simply, I do not know what was added when I was not looking (about 5 years, that is). 😉

    Regarding rewriting the engine... I'm used to old, very old school of C, C#. MaybeI could be of some use? We could for example start from the sketch of engine we need now and make it so every new upgrade would be a bit.. a bit compatible with all games. So, so it would be easy for people to convert old XML files ans scripts to new game with minimal effort (for example; the same graphic and sound catalogues, most of the naming the same, but UI completely separated, unit stats scalable (for ex. morale, strength, gaining experience) and so on. But, we should stay with maximums - for example; game idea is - it's still boardgame with tiles and pawns, using of turns (but, I'd love to add Risk II PC game option, when all players can plan their movements and all units are moved and battles calculated at once at the end of the round by AI ... I'd like to change battle system (for example - you can use classic battle system, Risk, Samurai Swords, but also anything you want and what you script or write - I hate idea of choosing casualties). But, it all should be an option, so everyone could make a game he wants.

    BTW. Feudal Japan Warlord doesn't work at all. Errors are showing during first round. Pity. I have no idea what's wrong. 😞


  • Admin

    @comr Well, I don't really want to rewrite the whole engine but most areas of it are pretty flexible for extension. For example, all games are based on phase delegates so you can have multiple move/battle/purchase phases and in theory you could create a new type of phase delegate in the engine which maps could use that allows for different move or battle rules.

    I'd strongly recommend playing a bunch of different maps that already exist to get a good understanding of what can already be achieved beyond that standard A&A maps. Here is a list of maps that I'd say push the bounds of what the engine to use more advanced features:

    • Civil War
    • Total World War
    • Iron War
    • Age of Tribes
    • Feudal Japan
    • Feudal Japan Warlords
    • Greyhawk Wars
    • The Grand War

    If you are seeing errors with any maps then please make sure you are using the current stable release 1.9.0.0.9687 and then make a thread here with the error and I should be able to help resolve it.



  • @redrum Thank you very much! That was all I really need! Yes, if I find any bugs again, I'll report it. For now I will try to play with everything I know till now. Thank you once again!


  • Donators

    @comr said in AI ignores destructible factories:

    Hi,

    Is there any trick known to force AI to consider buying certain resources or units? For example units that are producing resources? I'm playing with Dragon War official and my little conversion of it (units eat and need to be paid every turn, towns are producing resources; food, PU's, metal, wood). AI just doesn't care, so I'm trying to force it to buy at last from time to time village or town. I'm considering make some "trick units", so AI can think "it's a good idea!" and buy something as something different. For example, super cheap unit, super defending or super attacking unit (based on simple stats), but in fact being something different? Let's say AI buys free unit, but can place it only on high value place and it's in fact village or factory?

    All the best,
    ComR

    You could just use triggers to give the AI-played nations the needed resources automatically. It is a bit much to expect that the AI be able to handle arbitrary sets if resources.Or rather than using 'trick' units give resource creation to units that the AI already has like factories.