+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 25

Thread: Choosing AI personality dynamically...

  1. #1

    Choosing AI personality dynamically...

    I've been playing around with the idea of having an event choose a personality for certain AI countries at the start of the game and then every time the country gets a new ruler. The base chance is:

    50% - Balanced
    15% - Diplomacy
    10% - Capital
    10% - Colonial
    15% - Military


    But the event will also take into account the new ruler's stats as well as certain advisors and ideas along with some geographical data about the country. This is what I have so far but any suggestions on what to add, delete or change are welcome!

    BALANCED
    Positive modifiers:
    advisor = statesman
    advisor = alderman
    advisor = sheriff
    <= 4 in ADM, DIP, & MIL
    Negative modifiers:

    DIPLOMACY
    Positive modifiers:
    DIP 5-9
    advisor = diplomat
    advisor = ambassador
    advisor = philosopher
    idea = ecumenism
    idea = humanist_tolerance
    idea = cabinet
    Negative modifiers:
    MIL 6-9
    CAPITAL
    Positive modifiers:
    ADM 5-9
    advisor = trader
    advisor = treasurer
    advisor = collector
    idea = national_bank
    idea = shrewd_commerce_practise
    idea = merchant_adventures
    num_of_cots >=2
    num_of_cities <3
    num_of_cities <2
    Negative modifiers:
    DIP 6-9
    MIL 6-9
    num_of_cities >5
    num_of_cities >10
    COLONIAL
    Positive modifiers:
    advisor = colonial_governor
    advisor = pioneer
    advisor = navigator
    advisor = grand_admiral
    advisor = naval_reformer
    idea = grand_navy
    idea = sea_hawks
    idea = superior_seamanship
    idea = colonial_ventures
    idea = vice_roys
    idea = quest_for_the_new_world
    Negative modifiers:
    num_of_cities < 3
    num_of_cities < 2
    num_of_ports < 1 (factor 0)
    DIP 8-9
    MILITARY
    Positive modifiers:
    MIL 5-9
    advisor = grand_captain
    advisor = grand_admiral
    advisor = army_reformer
    advisor = naval_reformer
    idea = grand_navy
    idea = sea_hawks
    idea = superior_seamanship
    idea = grand_army
    idea = military_drill
    idea = national_conscripts
    Negative modifiers:
    DIP 6-9
    num_of_cities <3
    num_of_cities <2

  2. #2
    Once I have figured out what modifiers to use I will post a second list here with suggestions for the actual modifer values.

    EDIT: here's the list with some starting values. Any suggestions on how and what to tweak/add/removeare are welcome.

    EDIT: removed the list due to large revisions of the modifiers. Will post back soon...
    Last edited by pigglet82; 27-02-2009 at 12:37.

  3. #3
    General orwell's Avatar
    Hearts of Iron 2: ArmageddonCrusader Kings IIDeus VultEuropa Universalis 3Divine Wind
    For the MotherlandHearts of Iron IIIHeir to the ThroneEuropa Universalis III: In NomineEU3 Napoleon's Ambition
    Victoria: RevolutionsEuropa Universalis: RomeSemper FiSupreme Ruler 2020Victoria 2
    Victoria II: A House DividedRome: Vae VictisMount & Blade: WarbandEuropa Universalis IV

    Join Date
    Sep 2006
    Location
    Washington
    Posts
    2,224
    Blog Entries
    8
    Don't ask questions when you are nearly asleep at the computer.
    Last edited by orwell; 20-02-2009 at 21:07. Reason: Blindness
    Even an ignorant, paranoid, cowardly, ugly, corrupt, unsociable, aristocratic thug can conquer large parts of the world, kill thousands of people and be celebrated as the saviour of the Republic.

  4. #4
    I am confused. If you are intending on changing the actual AI personality in game via event, then I am all for it as long as its dynamic and takes history into consideration. I would even like to add it to TN mod (if thats ok) once you get it into a working state.

    for example, a nation like Inca (Cuzco in TN) should almost always be a conquering type personality and nothing else because during the entire EU3 timeframe of Inca's existance, Inca was conquering and expanding. there should be some randomness, but my point is that history should be considered highly.

    I would like to NOT use fixed_ai_strategy. right now, I use the AI mod made by Helius in the TN mod. I dont want to permenantly change data but instead add suggestions like Helius does with his mod. can the AI personality be changed without erasing it old AI data?
    Last edited by Darken; 19-02-2009 at 22:15.

  5. #5
    Quote Originally Posted by Darken View Post
    I am confused. If you are intending on changing the actual AI personality in game via event, then I am all for it as long as its dynamic and takes history into consideration. I would even like to add it to TN mod (if thats ok) once you get it into a working state.

    for example, a nation like Inca (Cuzco in TN) should almost always be a conquering type personality and nothing else because during the entire EU3 timeframe of Inca's existance, Inca was conquering and expanding. there should be some randomness, but my point is that history should be considered highly.

    I would like to NOT use fixed_ai_strategy. right now, I use the AI mod made by Helius in the TN mod. I dont want to permenantly change data but instead add suggestions like Helius does with his mod. can the AI personality be changed without erasing it old AI data?
    Well, I'm not planning on using fixed_ai_strategy. And it's not neccessary in order to change a country's hard-coded personality. It will not change the ai personality right away, but the next time the ai recalculates (change of ruler, after a war, et cetera) it will take the hard-coded personality into consideration.

    Example of new personality set for Denmark without fixed_ai_strategy:
    Code:
        ai_hard_strategy={
            initialized=no
            consolidate=yes
            static=no
            personality=military
            hre_interest=no
            papacy_interest=no
            threat={
                id="SWE"
                value=400
            }
            antagonize={
                id="SWE"
                value=400
            }
            rival={
                id="SWE"
                value=400
            }
        }
    But to compensate for not being able to completely change the ai personality I have written the event that calculates and sets the ai personality to also assign the country a flag (personality_military for instance) which is used in all other events in the strategy guide.

    The strategy guide will take historic goals into account, but how it chooses to act on them is determined by the personality. So Sweden with a military personality will act differently in a situation than if it has diplomacy or colonial. Some of the events in the strategy guide will be general while others will be nation specific based on history. So using Sweden as an example again, they will primarily focus on controlling the south of sweden, expanding into the Baltic, securing the Polish seaboard et cetera.

    I talked with Helius and I'm planning on using part of his AI mod together with my guide. For the first version I'm focusing on a dussin european countries, but I plan to add more later (or let others add to it), and you're welcome to add it to your mod if you find any of it usefull.

    In the mean time, any suggestions on the modifiers above?
    Last edited by pigglet82; 20-02-2009 at 02:07.

  6. #6
    Quote Originally Posted by pigglet82 View Post
    It will not change the ai personality right away, but the next time the ai recalculates (change of ruler, after a war, et cetera) it will take the hard-coded personality into consideration.
    Here's something I had not known! If you hadn't mentioned this, I would have thought that it is a futile exercise to change hard personality, b/c the AI will always pick its soft personality based on context.
    Mourning Magna Mundi

  7. #7
    Quote Originally Posted by pigglet82 View Post
    Well, I'm not planning on using fixed_ai_strategy. And it's not neccessary in order to change a country's hard-coded personality. It will not change the ai personality right away, but the next time the ai recalculates (change of ruler, after a war, et cetera) it will take the hard-coded personality into consideration.

    Example of new personality set for Denmark without fixed_ai_strategy:
    Code:
        ai_hard_strategy={
            initialized=no
            consolidate=yes
            static=no
            personality=military
            hre_interest=no
            papacy_interest=no
            threat={
                id="SWE"
                value=400
            }
            antagonize={
                id="SWE"
                value=400
            }
            rival={
                id="SWE"
                value=400
            }
        }
    But to compensate for not being able to completely change the ai personality I have written the event that calculates and sets the ai personality to also assign the country a flag (strategy_military for instance) which is used in all other events in the strategy guide.

    The strategy guide will take historic goals into account, but how it chooses to act on them is determined by the personality. So Sweden with a military personality will act differently in a situation than if it has diplomacy or colonial. Some of the events in the strategy guide will be general while others will be nation specific based on history. So using Sweden as an example again, they will primarily focus on controlling the south of sweden, expanding into the Baltic, securing the Polish seaboard et cetera.

    I talked with Helius and I'm planning on using part of his AI mod together with my guide. For the first version I'm focusing on a dussin european countries, but I plan to add more later (or let others add to it), and you're welcome to add it to your mod if you find any of it usefull.

    In the mean time, any suggestions on the modifiers above?
    cool, this will be a great addition to TN mod and other mods IMO.

    I personaly would not use advisors or monarch statistics as triggers for asigning nation personalities. this is because the advisors and stats are random and are only present for 20 years of game time or so. instead, I would base it on ideas, slider settings, religion, number of provinces, and historical personality. this would have a much more realistic outcome IMO.

    Since many mods and individuals might already be using Helius's AI mod, i would reccomend not including it in your mod but instead, perhaps making a simular system like his system but only for AI personality.

    thanks for permission to use this mod.

    I have some free time (until sunday) because I cannot do anymore TN modding until 17blue17 finishes the current map additions on sunday (hopefully it will be done then). if you would like some event help until sunday, let me know.

  8. #8
    Quote Originally Posted by Darken View Post
    I personaly would not use advisors or monarch statistics as triggers for asigning nation personalities. this is because the advisors and stats are random and are only present for 20 years of game time or so.
    That wouldn't be a problem since the AI event will calculate a new nation personality every time a new ruler comes into power.

    Quote Originally Posted by Darken View Post
    instead, I would base it on ideas, slider settings, religion, number of provinces,
    Any suggestions on how slider settings or religion would affect the five alternatives?

    Quote Originally Posted by Darken View Post
    ...and historical personality. this would have a much more realistic outcome IMO.
    There's two parts of the AI guide: the event that sets the personality has little to do with history since the event is supposed to work with random rulers. For instance if Sweden gets a weak ruler while the 30 Years' War, Sweden would probably stay out of it. The second part however, the one that actually sets the specific goals, will take history into consideration. Sweden would most likely focus on Denmark, Russia, Poland, secruing the Baltic coast, et cetera. But whether they decide to go after those goals or how hard they will focus on it depends on the personality -- and therefor also the ruler.

    Quote Originally Posted by Darken View Post
    Since many mods and individuals might already be using Helius's AI mod, i would reccomend not including it in your mod but instead, perhaps making a simular system like his system but only for AI personality.
    I will actually only use his giant file AI_Strategy to set the actuall ai values, which is all that file does. Everything else will be my own code:

    AI_setup calculates the personality upon start of game and everytime a new ruler emerges.
    |
    V
    AI_guide chooses strategic goals based on history, context and personality.
    |
    V
    (Helius) AI_Strategy sets the actual ai values.

    Quote Originally Posted by Darken View Post
    I have some free time (until sunday)... if you would like some event help until sunday, let me know.
    Sure. Right now what I need help with most is the question above. So if you have any ideas on how sliders and religion would affect the choice of personality, or any suggestions on what values the modifers above should have, please let me know. I'll post a new version of the list with some starting values in the second post above.
    Last edited by pigglet82; 20-02-2009 at 02:32.

  9. #9
    Quote Originally Posted by Helius View Post
    Here's something I had not known! If you hadn't mentioned this, I would have thought that it is a futile exercise to change hard personality, b/c the AI will always pick its soft personality based on context.
    Well, I can't swear on it but in the tests I did nations that usually never gets personality military suddenly got it a while after I set the hard one. But even if it doesn't it wouldn't change much for this mod, since the event that calculates the new personality sets a flag for it, and the event that chooses the strategy reacts to this and not what personality the actual ai has (there's no way to check that anyway from within an event as far as I know).

  10. #10
    Quote Originally Posted by orwell View Post
    Are those 5 the only ones? I thought there was a capitalist personality too? Can you define more personalities?
    Sorry for the late reply, I somehow missed your post. You can't define more actual ai personalities, but in my mod, sure, you could come up with any number of them. But to keep things manageable (for now at least) I choose to only use the five that are in the game.

  11. #11
    so, this means we can actualy set the personality in a event, like a command like 'personality = colonial'? or are you just planning on changing values like these?:
    Code:
            threat={
                id="SWE"
                value=400
            }
            antagonize={
                id="SWE"
                value=400
            }
            rival={
                id="SWE"
                value=400
            }
    this is just my opinions here, I support your mod and think its a good idea, i just want to add my ideas.

    well, my whole point is that, even though there will be a new personality set for each monarch, the nations's personality should not be set with regard to the nation's monarch skills because they are random and not the actual year the real monarch was ruling. in the end, if you had the personality set mainly according to monarch skills, it would always be random due to random monarchs and it would almost never be related to the nation's real situation in the game. the questions we need to ask are:

    was the nation historicaly diplomatic or colonial, or militaristic (expansionistic)?
    does the nation currently have any core provinces they do not own?
    does the nation have ideas that would make it want to be diplomatic or colonial or militaristic?
    (maybe more questions like this)

    just because a monarch has a diplomatic skill of 9 does not mean it should remain balanced or diplomatic. if the nation has expansionistic ideas and has cores in provinces it does not own, perhaps its best to make it militaristic. this is the kind of point I want to make. I think its also extremely important that the personalities do not get asigned randomly. they should never get asigned to be militaristic unless they have one qaulifing thing like a expansionist idea or uncontested cores, etc. advisors are just as random and should not be used to asign personalities IMO.

    Code:
    
    Balanced
    --------
     = always the default if no other personality fits.
    Diplomacy
    ----------
     = always the default if the nation is oriented to diplomacy. 
    diplomatic ideas (ones that give tolerance, diplomats, diplomacy skill etc), slider settings (offensive-defensive), religion (not next to religious enemies), number of provinces (small empire = diplomatic), and historical personality (Great britian would not be diplomatic IMO). 
    Capital
    -------
    (no idea what this personality is)
    Colonial
    -------
    = always the default if the nation is oriented to colonization.
    colonization ideas, christian religion, historical personality (SPA,POR,GBR,FRA,NED, etc would prefer colonial if able), centralized-decentralized slider (maybe),
    Military
    -------
    =always the default if the nation is oriented to conquest.
    Military ideas, nearby religious enemies, historical personalities (france, GBR, spain etc), unowned cores, offensive or defensive slider,
    

  12. #12
    Hmm, I think I made a mistake here. With these settings a ruler with MIL = 9 would get all of these modifiers, right?
    modifier = {
    factor = 2
    MIL = 7
    }
    modifier = {
    factor = 3
    MIL = 8
    }
    modifier = {
    factor = 4
    MIL = 9
    }
    If only the relevant one should be applied, should I write it like this?
    modifier = {
    factor = 2
    MIL = 7
    NOT = { MIL = 8}
    }
    modifier = {
    factor = 3
    MIL = 8
    NOT = { MIL = 9 }
    }
    modifier = {
    factor = 4
    MIL = 9
    }

  13. #13
    Quote Originally Posted by Darken View Post
    so, this means we can actualy set the personality in a event, like a command like 'personality = colonial'?
    Yes, that's what I'm planning on.

  14. #14
    Quote Originally Posted by Darken View Post
    well, my whole point is that, even though there will be a new personality set for each monarch, the nations's personality should not be set with regard to the nation's monarch skills because they are random and not the actual year the real monarch was ruling. in the end, if you had the personality set mainly according to monarch skills, it would always be random due to random monarchs and it would almost never be related to the nation's real situation in the game.
    The possible strategy goals the country will choose from will still be the same no matter what their personality is, and they will take context and history into account. Examples: Sweden will always consider conquering the Baltic (Estland, Livland, Riga, Kurland) as one of their main goals, but whether they chooses to actually do so will be dependent on their ruler/personality. And Portugal will always consider colonial ventures, but if they have no colonial ideas, no colonial advisors, few provinces, a weak military ruler with high diplomacy etc, they will be less likely to go down the colonial path. It will be very unlikely that a one-province minor like Hamburg end up with a military personality, but if they mainly have military advisors, military ideas, and end up with a new ruler that has MIL = 8 or 9, it's not impossible, and history has seen both small aggressive countries and delusional rulers...

    I hope this makes my intentions a little bit clearer. But do you still mean that a country should just go down it's historic path no matter what ruler they have? Anyone else's thoughts on this?

  15. #15
    Quote Originally Posted by Darken View Post
    Code examples:
    Code:
    
    Balanced
    --------
     = always the default if no other personality fits.
    
    Pretty much the case right now.
    Code:
    
    Diplomacy
    ----------
     = always the default if the nation is oriented to diplomacy. 
    diplomatic ideas (ones that give tolerance, diplomats, diplomacy skill etc),
    slider settings (offensive-defensive), religion (not next to religious enemies),
    number of provinces (small empire = diplomatic), and historical personality
    (Great britian would not be diplomatic IMO).
    
    Dimplomatic ideas & num of provinces already taken into account. Will add sliders & religion (tolerance should probably play a part also)
    Code:
    
    Capital
    -------
    (no idea what this personality is)
    
    Capital = capitalist, focus on trade (will probably avoid direct confrontations, but may use subsidies to fight enemies of their trade)
    Code:
    
    Colonial
    -------
    = always the default if the nation is oriented to colonization.
    colonization ideas, christian religion, historical personality (SPA,POR,GBR,FRA,
    NED, etc would prefer colonial if able), centralized-decentralized
    slider (maybe),
    
    Ideas are included. Any ideas on how christian religion and cen-dec slider would influence this choice?
    Code:
    
    Military
    -------
    =always the default if the nation is oriented to conquest.
    Military ideas, nearby religious enemies, historical personalities (france, GBR,
    spain etc), unowned cores, offensive or defensive slider,
    
    Ideas included. Will add slider. Unowned cores will be part of the strategy guide in the general section that applies to all nations. Nearby religious enemy is interesting but I don't know yet how to implement this. To always fight an nearby religious enemy would be kind of predictable and not that historically. I'm trying to get more of realpolitik into the AI guide. France is a good example: they often fought their fellow religious contries like Austria and Spain, and sided with reformed or protestant countries like the Netherlands or Sweden. Spain and Austria being 'threats' were more important than religion. Maybe give each ruler some sort of flag indicating whether they're strong religious fanatics or calculating politicians?

  16. #16
    Quote Originally Posted by pigglet82 View Post
    Code:
    
    Colonial
    -------
    = always the default if the nation is oriented to colonization.
    colonization ideas, christian religion, historical personality (SPA,POR,GBR,FRA,
    NED, etc would prefer colonial if able), centralized-decentralized
    slider (maybe),
    
    Ideas are included. Any ideas on how christian religion and cen-dec slider would influence this choice?
    Code:
    
    Military
    -------
    =always the default if the nation is oriented to conquest.
    Military ideas, nearby religious enemies, historical personalities (france, GBR,
    spain etc), unowned cores, offensive or defensive slider,
    
    Ideas included. Will add slider. Unowned cores will be part of the strategy guide in the general section that applies to all nations. Nearby religious enemy is interesting but I don't know yet how to implement this. To always fight an nearby religious enemy would be kind of predictable and not that historically. I'm trying to get more of realpolitik into the AI guide. France is a good example: they often fought their fellow religious contries like Austria and Spain, and sided with reformed or protestant countries like the Netherlands or Sweden. Spain and Austria being 'threats' were more important than religion. Maybe give each ruler some sort of flag indicating whether they're strong religious fanatics or calculating politicians?
    well, christian religions did more colonization than other religions IMO, so perhaps just give them a higher % of being colonial. centralized nations would be a bit less likely to make colonies IMO (and instead would prefer vassals IMO).

    you are probably right about the religion aspect of the military personality.

  17. #17
    Quote Originally Posted by Darken View Post
    well, christian religions did more colonization than other religions IMO, so perhaps just give them a higher % of being colonial.
    Will include that.

    Quote Originally Posted by Darken View Post
    centralized nations would be a bit less likely to make colonies IMO (and instead would prefer vassals IMO).
    You're probably right about this, and I started to include your other suggestions about sliders. The problem with centralized however is that early in the game every nation is decentralized which would mean thay all are more likely to be colonial.... So I probably need some way to increase the importance of centralizing over time. Not sure how to do this though. Or maybe the importance of centralizing on colonial is only added if the nation already has some of the other modifiers.

  18. #18
    Quote Originally Posted by pigglet82 View Post
    Portugal will always consider colonial ventures, but if they have no colonial ideas, no colonial advisors, few provinces, a weak military ruler with high diplomacy etc, they will be less likely to go down the colonial path.
    What if the AI picks its ideas based on its personality? Then you would create a feedback loop.

    My suggestion for an experiment:

    Give a random AI nation an hardcoded personality, using fixed strategy.
    Set available ideas at tech=0 to 10.
    Start the first game in 1399.
    Tell Portugal it is militaristic. See what ten ideas it picks.
    Start new game.
    Tell Portugal it is colonialistic. See what ten ideas it picks, now.
    Mourning Magna Mundi

  19. #19
    Quote Originally Posted by Helius View Post
    What if the AI picks its ideas based on its personality? Then you would create a feedback loop.

    My suggestion for an experiment:

    Give a random AI nation an hardcoded personality, using fixed strategy.
    Set available ideas at tech=0 to 10.
    Start the first game in 1399.
    Tell Portugal it is militaristic. See what ten ideas it picks.
    Start new game.
    Tell Portugal it is colonialistic. See what ten ideas it picks, now.
    Good idea. Hopefully I'll have some time to test that tomorrow. Will post here as soon as I have some results.

  20. #20
    This looks like an excellent mod, and I would love to incorporate it into my current project.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Posting Permissions

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