1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

List of <UnitAIs> and what they do

Discussion in 'Civ4 - Creation & Customization' started by fulano, Feb 17, 2010.

  1. fulano

    fulano Chieftain

    Joined:
    Dec 11, 2009
    Messages:
    214
    Location:
    Western USA
    I've searched for a while and can't find a list that actually explains what each UnitAI does, so I decided to start a thread and make a guess so more experienced people can correct me and there will be a list for others to use.

    I made my guesses from looking at CvUnitAI.cpp (I barely understand C++myself) and from looking at the civ4 units themselves. Please post any corrections that might help me and future users looking for help on this.

    UNITAI_ANIMAL: Animal, explores and attacks, avoids culture
    UNITAI_SETTLE: Settler, use this to create settlements
    UNITAI_WORKER: Worker, use this to improve terrain
    UNITAI_ATTACK: Use this to attack other units
    UNITAI_ATTACK_CITY: Use this to attack cities
    UNITAI_COLLATERAL: Use this to cause collateral to wear down stronger units
    UNITAI_PILLAGE: Use this to destroy improvements
    UNITAI_RESERVE: Build this unit when nothing else is immediately needed (build lots of them)
    UNITAI_COUNTER: Use this unit to protect against specific units
    UNITAI_PARADROP: This unit can paradrop (when does the AI use this?)
    UNITAI_CITY_DEFENSE: Use this to defend cities
    UNITAI_CITY_COUNTER: Units with bonuses against others that are to defend cities.
    UNITAI_CITY_SPECIAL: Leave this unit in cities (like machine guns)
    UNITAI_EXPLORE: Use this for exploring
    UNITAI_MISSIONARY: Used to spread religion
    UNITAI_ATTACK_AIR: Air unit used for attacking
    UNITAI_DEFENSE_AIR: Air unit for defending against air units
    UNITAI_CARRIER_AIR: Use to fill carriers
    UNITAI_MISSILE_AIR: AI for missiles
    UNITAI_ATTACK_CITY_LEMMING: Use to attack cities, ignoring combat odds. (Used for barbarian revolt events)
    UNITAI_ICBM: Use for nukes
    UNITAI_SPY: Use as a spy.

    Great people AIs: Mostly self explanitory.
    UNITAI_PROPHET:
    UNITAI_ARTIST:
    UNITAI_SCIENTIST:
    UNITAI_GENERAL:
    UNITAI_MERCHANT:
    UNITAI_ENGINEER:

    Same as above except for water use. Doesn't really need descriptions I think.
    UNITAI_WORKER_SEA:
    UNITAI_ATTACK_SEA:
    UNITAI_RESERVE_SEA:
    UNITAI_ESCORT_SEA:
    UNITAI_EXPLORE_SEA:
    UNITAI_ASSAULT_SEA:
    UNITAI_SETTLER_SEA:
    UNITAI_MISSIONARY_SEA:
    UNITAI_SPY_SEA:
    UNITAI_CARRIER_SEA:
    UNITAI_MISSILE_CARRIER_SEA:
    UNITAI_PIRATE_SEA:

    phungus420's info for BAI. I'm sure it's very similar to the vanilla AI.
    This is based on BBAI, so default BtS may be slightly different:

    UNITAI_ATTACK: General purpose; unit prioritizes joining an attack stack, but also may wander off on search and destroy/explore, sit in a city and defend it, etc.
    UNITAI_ATTACK_CITY: Join an attack stack -> If in an attack stack, lead assault on a city once the AI decides the stack should attack a city
    UNITAI_COLLATERAL: Similar to UNITAI_ATTACK_CITY, but may also attack enemy stacks in the field
    UNITAI_PILLAGE: Causes unit to wander off by itself into enemy territory and pillage stuff
    UNITAI_RESERVE: Primary use - Floating defenders to shuffle around between threatened cities. Also is a priority UNITAI type for the AI to change if it needs units of another type (the AI will frequently change reserve units to attack units once it starts warplans, for instance)
    UNITAI_COUNTER: Join an attack stack -> if in stack may leave stack to attack adjacent tiles with enemy units
    UNITAI_CITY_COUNTER: Same as UNITAI_COUNTER, but for cities instead of stacks
    UNITAI_PARADROP: Hold in reserve and drop into enemy territory; very similar to UNITAI_PILLAGE, except units drop deep into enemy territory
    UNITAI_CITY_DEFENSE: Defend a city, never leave the city
    UNITAI_CITY_SPECIAL: Basically the same as UNITAI_CITY_DEFENSE, except the AI deprioritizes this type if a city already has a defender of this AI type, meaning that the AI in unmodded BtS, the AI only ever builds a single machine gun in it's cities
    UNITAI_EXPLORE: Wander around prioritizing terrain that hasn't been revealed until unit is killed
    UNITAI_ATTACK_AIR: Air Unit used for bombing
    UNITAI_CARRIER_AIR: Similar to UNITAI_ATTACK_AIR, but prioritizes filling up carriers
    UNITAI_ATTACK_CITY_LEMMING: beeline enemy cities and Suicide against enemy units
    UNITAI_ICBM: Hold unit, and then launch when at war
    UNITAI_SPY: Basic spy AI (prioritize going into enemy territory and running spy missions - In base BtS this is purely random, with the spys basically wandering around and rolling dice, in BBAI the spys prioritize high value missions and improvements)
    UNITAI_WORKER_SEA: Build sea improvement, if none is available explore
    UNITAI_ATTACK_SEA: Basic sea AI, wander around the oceans in search and destroy mode, join a stack, etc
    UNITAI_RESERVE_SEA: Similar to UNITAI_RESERVE except for sea units
    UNITAI_ESCORT_SEA: Join a stack
    UNITAI_EXPLORE_SEA: Wander around the oceans prioritizing moving into unexplored territory until unit dies
    UNITAI_ASSAULT_SEA: Transport land units for sea assault, launch when a sufficient assault stack is ready; forms core of water domain stacks
    UNITAI_SETTLER_SEA: Ferry settlers and workers over water tiles
    UNITAI_MISSIONARY_SEA: Ferry missionaries over water tiles
    UNITAI_SPY_SEA: Ferry spys over water tiles
    UNITAI_CARRIER_SEA: Be a mobile air base for UNITAI_CARRIER_AIR units
    UNITAI_MISSILE_CARRIER_SEA: similar to UNITAI_CARRIER_SEA but for missiles
    UNITAI_PIRATE_SEA: Wander around pointlessly, sometimes run a blockade if the die roll tells you to and you are in enemy territory

    Great people AIs:
    UNITAI_PROPHET: Prioritize Building a Shrine and prioritize the religion of which there are the most cities of if multiple shrines can be built; if no shrine can be built, roll dice to decide whether to start a golden age or settle in a high value city (probably the capital)
    UNITAI_ARTIST: Not sure what the behavior of this type is actually
    UNITAI_SCIENTIST: Build an academy in a high priority city (most likely capital); if no good cities are available for this mission, roll dice to decide whether to settle in a high priority city or start a golden age
    UNITAI_GENERAL: Roll dice to decide whether to join a unit or not, if not (most likely scenario), Build a military academy in a high priority city; if no acceptable city is available to build an MA in, join a high priority city (almost always the capital)
    UNITAI_MERCHANT: Roll dice to decide if unit should Find best city to conduct trade mission in and do so, or start a golden age, or join a high priority city
    UNITAI_ENGINEER: Build an available wonder. If no wonder is available to rush, roll dice to decide whether to start a golden age, or join high priority city
     
  2. fulano

    fulano Chieftain

    Joined:
    Dec 11, 2009
    Messages:
    214
    Location:
    Western USA
    Mostly, if someone could clarify the ones I have wrong and the ones with a "??" I would greatly appreciate it and I'm sure future people will too.

    Unless I just haven't found a resource somebody already made, if that's the case please direct me to it.
     
  3. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    UNITAI_ATTACK_CITY_LEMMING is for a unit to attack a city no matter what (ie, it ignores combat odds and anything else that would normally cause a unit to do something else); it's used for the barbarian revolt events.
     
  4. Shiggs713

    Shiggs713 Immortal

    Joined:
    Mar 11, 2007
    Messages:
    2,361
    Location:
    Indianapolis
    UNITAI_CITY_SPECIAL is also on machine gun. Yea its for units that should stay in cities basically.
     
  5. fulano

    fulano Chieftain

    Joined:
    Dec 11, 2009
    Messages:
    214
    Location:
    Western USA
    Thanks! I updated the list so far.

    Could a person add this to a guided missile and cause the AI to use guided missiles to attack cities more often than just UNITAI_ATTACK_CITY?
     
  6. Tssha

    Tssha Chieftain

    Joined:
    Dec 20, 2007
    Messages:
    270
    AI_RESERVE is used to designate a unit the AI should build a lot of, in other words, to build up a reserve of such units. In case of war, break out the reserve units.

    Well, that's somewhat close. It's basically used to designate units you can't have to many of. When in doubt and with no pressing need, build something from the reserve list.
     
  7. Shiggs713

    Shiggs713 Immortal

    Joined:
    Mar 11, 2007
    Messages:
    2,361
    Location:
    Indianapolis
    yea many units that have AI_RESERVE also have AI_CITY_COUNTER, I didn't look but I'd imagine those AI's are on units such as riflemen, grenadiers, or infantry.
     
  8. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    UNITAI_CITY_COUNTER are units that should stay in cities to counter specific attacking units. Like cavalry that stay in a city to be able to do flanking attacks on enemy catapults. Or crossbows that stay in cities to attack melee units.

    EDIT: Upon actually reading the vanilla unitinfo.xml, it's clear that this UNITAI_CITY_COUNTER is for units that have a native combat bonus against other unit classes/types. So it has nothing to do with flanking. But you are right that they should stay in cities when using that UNITAI.
     
  9. phungus420

    phungus420 Chieftain

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    This is based on BBAI, so default BtS may be slightly different:

    UNITAI_ATTACK: General purpose; unit prioritizes joining an attack stack, but also may wander off on search and destroy/explore, sit in a city and defend it, etc.
    UNITAI_ATTACK_CITY: Join an attack stack -> If in an attack stack, lead assault on a city once the AI decides the stack should attack a city
    UNITAI_COLLATERAL: Similar to UNITAI_ATTACK_CITY, but may also attack enemy stacks in the field
    UNITAI_PILLAGE: Causes unit to wander off by itself into enemy territory and pillage stuff
    UNITAI_RESERVE: Primary use - Floating defenders to shuffle around between threatened cities. Also is a priority UNITAI type for the AI to change if it needs units of another type (the AI will frequently change reserve units to attack units once it starts warplans, for instance)
    UNITAI_COUNTER: Join an attack stack -> if in stack may leave stack to attack adjacent tiles with enemy units
    UNITAI_CITY_COUNTER: Same as UNITAI_COUNTER, but for cities instead of stacks
    UNITAI_PARADROP: Hold in reserve and drop into enemy territory; very similar to UNITAI_PILLAGE, except units drop deep into enemy territory
    UNITAI_CITY_DEFENSE: Defend a city, never leave the city
    UNITAI_CITY_SPECIAL: Basically the same as UNITAI_CITY_DEFENSE, except the AI deprioritizes this type if a city already has a defender of this AI type, meaning that the AI in unmodded BtS, the AI only ever builds a single machine gun in it's cities
    UNITAI_EXPLORE: Wander around prioritizing terrain that hasn't been revealed until unit is killed
    UNITAI_ATTACK_AIR: Air Unit used for bombing
    UNITAI_CARRIER_AIR: Similar to UNITAI_ATTACK_AIR, but prioritizes filling up carriers
    UNITAI_ATTACK_CITY_LEMMING: beeline enemy cities and Suicide against enemy units
    UNITAI_ICBM: Hold unit, and then launch when at war
    UNITAI_SPY: Basic spy AI (prioritize going into enemy territory and running spy missions - In base BtS this is purely random, with the spys basically wandering around and rolling dice, in BBAI the spys prioritize high value missions and improvements)
    UNITAI_WORKER_SEA: Build sea improvement, if none is available explore
    UNITAI_ATTACK_SEA: Basic sea AI, wander around the oceans in search and destroy mode, join a stack, etc
    UNITAI_RESERVE_SEA: Similar to UNITAI_RESERVE except for sea units
    UNITAI_ESCORT_SEA: Join a stack
    UNITAI_EXPLORE_SEA: Wander around the oceans prioritizing moving into unexplored territory until unit dies
    UNITAI_ASSAULT_SEA: Transport land units for sea assault, launch when a sufficient assault stack is ready; forms core of water domain stacks
    UNITAI_SETTLER_SEA: Ferry settlers and workers over water tiles
    UNITAI_MISSIONARY_SEA: Ferry missionaries over water tiles
    UNITAI_SPY_SEA: Ferry spys over water tiles
    UNITAI_CARRIER_SEA: Be a mobile air base for UNITAI_CARRIER_AIR units
    UNITAI_MISSILE_CARRIER_SEA: similar to UNITAI_CARRIER_SEA but for missiles
    UNITAI_PIRATE_SEA: Wander around pointlessly, sometimes run a blockade if the die roll tells you to and you are in enemy territory

    Great people AIs:
    UNITAI_PROPHET: Prioritize Building a Shrine and prioritize the religion of which there are the most cities of if multiple shrines can be built; if no shrine can be built, roll dice to decide whether to start a golden age or settle in a high value city (probably the capital)
    UNITAI_ARTIST: Not sure what the behavior of this type is actually
    UNITAI_SCIENTIST: Build an academy in a high priority city (most likely capital); if no good cities are available for this mission, roll dice to decide whether to settle in a high priority city or start a golden age
    UNITAI_GENERAL: Roll dice to decide whether to join a unit or not, if not (most likely scenario), Build a military academy in a high priority city; if no acceptable city is available to build an MA in, join a high priority city (almost always the capital)
    UNITAI_MERCHANT: Roll dice to decide if unit should Find best city to conduct trade mission in and do so, or start a golden age, or join a high priority city
    UNITAI_ENGINEER: Build an available wonder. If no wonder is available to rush, roll dice to decide whether to start a golden age, or join high priority city



    For unit AIs that are correct in the OP, I didn't write anything.
     
  10. fulano

    fulano Chieftain

    Joined:
    Dec 11, 2009
    Messages:
    214
    Location:
    Western USA
    You guys are awesome! Thanks for helping out!!

    I just have a few more questions if somebody could clarify for me it would be great!:

    -Do the _SEA ai's have to be for water units? Can a land carrier use the CARRIER_SEA units?
    -What's the difference between UNITAI_MISSILE_AIR and UNITAI_ICBM?
    -Can you give something like UNITAI_ATTACK_CITY to bombers to encourage the AI to use bombers against cities?
     
  11. phungus420

    phungus420 Chieftain

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    Setting a UnitAI type that is designed for a certain domain for a unit not of that domain type almost never works. In general the unit will just stay frozen in one spot. You can of course test any of those specific questions pretty easily. Just enable debug mode, and go into WB and manually set the unit's AI type to what you want to test, and see what the AI does.
     

Share This Page