Results 1 to 7 of 7

Thread: AI Personalities - what they do

  1. #1

    Default AI Personalities - what they do

    Fresh guide available on the wiki:

    There are lots of rumours circulating on the subject, so Jojo00182, Fynn and myself have decided to finally clear things up.

    The values are hardcoded, but modders will hopefully be able to assign their AI personalities more accurately with this knowledge.

  2. #2

    Default Re: AI Personalities - what they do

    This is excellent work guys. A few questions:

    1) Are the values in the two tables multipliers? I.e. if I have a balanced AI and one building with population_growth_bonus 1 and another building with population_loyalty_bonus 2, does the table suggest that this AI will prefer the latter building because 1*80 == 80 while 2*64 == 128? Same question comparing different AI personality types: does balanced prefer population_loyalty_bonus 2 more than religious prefers population_loyalty_bonus 1?

    2) Are the values additive? That is to say, if we had a building with stage_games 1 and stage_races 1 (total == 96), would that have the same preference rating for a balanced AI as a building with fire_risk 6 (total == 96)? Is this type of arithmetic valid for calculating total building preference for each AI type?

    Quote Originally Posted by Guide
    Some of them are dummy effects (e.g. trade_fleet) or do not provide any bonuses (e.g. taxable_income_bonus), but they still influence the AI's preference to construct any buildings containing them.
    What is the difference between trade_fleet and taxable_income_bonus here? It sounds like they both have no effect. If so, they could both be very useful for getting the AI to prioritize buildings they normally wouldn't prioritize based on the other effects the building provides (assuming the arithmetic I mentioned is valid).

    Quote Originally Posted by Guide
    That is why large units tend to get recruited more often than small ones, which can be amended by using recruit_priority_offset in Medieval II Total War: Kingdoms.
    Exactly what impact does recruit_priority_offset have? You're saying that the unit stats have a greater impact than the AI preference based on class and category, does this include the recruit_priority_offset? Is it a multiplier of some sort?

    Quote Originally Posted by Guide
    weights for non_combatants and handlers have been excluded from the table
    I know handlers works, have you checked if non_combatants is allowed? The old guide on EDU says that it's not allowed, it's not clear what it does.

  3. #3

    Default Re: AI Personalities - what they do

    We don't know the formula of how the weights get applied (yet), so I will refrain from speculating on anything we haven't clearly confirmed. That goes for any of your questions that stay unanswered:

    3) You are right, they both have no effect. The difference I meant to point out is that trade_fleet is an actual mechanic, just not tied to the EDB bonus but hardcoded into the port and castle_port buildings (up to 3 at level 3). Whereas taxable_income_bonus doesn't do anything at all. I've noticed quite many mods are using taxable_income_bonus and population_loyalty_bonus to display construction cost/time bonuses. Now we know that is the only reason why the AI considers these types of buildings valid options at all.

    4) We have not sufficiently investigated the recruit_priority_offset. We have created a clean test environment mod with units of equal value and the results from good old fashioned testing didn't really make sense to us. All I can say is that its impact is massive and that the exe multiplies it with 4 before applying it. Hopefully we will be able to demystify that soonishly. The offset is not applied to the raw unit value, but at a later point. Unit cost has no influence on the raw value either.

    The exe also produces a "per soldier value" from it by dividing the total value by the soldier count. We highly suspect this unit value to be used in auto resolve. The secondary hp "hack" many modders use for auto resolve balancing also shows up in the form of higher unit values.

    5) For the sake of completness, these are the values for handlers: (48): mao, genghis, stalin, napoleon, henry, caesar; (72): heinrich, subotai, robert, roger; (64): everyone else

    non_combatants were the civilians on the battle map in Rome 1. They load into the game, but crash as soon as their recruitment is finished. It is entirely possible that they can be made to work, but that has not been the point of this research.

  4. #4
    bitterhowl's Avatar Centenarius
    Join Date
    Feb 2011
    Russian Feodality

    Default Re: AI Personalities - what they do

    Great tables, many thanks! God bless your reverse skills, those tables are more important than any limit breaking apps!

    Question - in M2TW descr_strat it's possible to set faction without any ai_personality profile and campaign still launches and works. Are there any hardcoded links between faction type and ai_personality, how do you think?

    My sister, do you still recall
    The blue Hasan and Khalkhin-Gol?

    Because AI is dumb and full of errors.

  5. #5

    Default Re: AI Personalities - what they do

    The AI Personality entry won't give you an error regardless of what you do or do not type there. You can even make it say "faction england, mickey mouse" and the game will still load and default to balanced smith. So no, there are no hardcoded links to factions.

  6. #6
    Jadli's Avatar The Fallen God

    Join Date
    Dec 2013
    Czech Republic

    Default Re: AI Personalities - what they do

    Well, I suppose this is relatively good place to ask this. Some time ago, I was trying to make more complex building trees, such as that to build barracks, you first have to build a blacksmith, roads for ports, etc. It didnt work well, because the AI didnt realize it needs to build a blacksmith in order to build barracks and so on. So I was wondering if you perhaps acquired some insight on how to do that? (Obviously, except building these buildings for AI with a script, or making units availible for AI from walls, and so on)

  7. #7

    Default Re: AI Personalities - what they do

    Interconnected building trees are indeed problematic for the AI, unless there is always just one building available (which is probably not the case). What you could do is move certain buildings higher up in the AI's priority by assigning them some of the unused bonuses like taxable_income_bonus or population_loyalty_bonus according to your personality type. I assume you know how to give a bonus only to the AI via an event_counter.

    In general I would say that complex building trees are not desirable if you want reasonable AI settlement development.

    It can work fine for purely military buildings, like say you need tier 1 barracks before building tier 1 archery range and tier 1 stable etc. That is because recruit_pool is evaluated separately from other bonuses (and higher). But something like farms as a requirement for other higher level buildings is probably not going to work well unless you specifically use a personality that really likes farms. Unfortunately designing building trees from the player perspective is often not optimal for the AI...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts