Dancing Hoskuld
Deity
Purpose: This thread is here to discuss the AI for all animal units.
I am dividing the units into Wild, Subdued and Domesticated. Where Domesticated units are those animal units built, subdued are those animal units captured and wild are those spawned.
Assumptions:-
Some of this will sound like a cross between English and program speak. It is just the way I am.
As far as I can tell the order things happen in a game turn are
Get the unit safely home
Mammoth
Camel
Horse and Elephant
Cheetah and Lion (not Cave Lion or Lion Pack)
Cave Lion, Lion Pack, Cave Bear and Polar Bear
Bear and Panda Bear
Hyena
Dire Wolves
Wolves
Crocodiles
Gorilla and Orangutan
Event: On city work radius expands
Event: On build city
Event: Open Boarders agreement made
Event: Acquire Technology Trade
Event: OnEndgameTurn
I am dividing the units into Wild, Subdued and Domesticated. Where Domesticated units are those animal units built, subdued are those animal units captured and wild are those spawned.
Assumptions:-
- It is possible for the AI to know is a unit has orders or not.
- First priority is to get the unit safely back to the owner's cities
- Second priority is to use the unit, if possible, to build a building.
- Otherwise store the animals until some event e.g. acquire technology, build a city or city borders expand.
Some of this will sound like a cross between English and program speak. It is just the way I am.
As far as I can tell the order things happen in a game turn are
- onBeginGameTurn event
- other events
- onEndGameTurn event (check name)
- give orders units without any
- move all units which already have orders.
Get the unit safely home
If the unit is in cultural boarders or one move from cultural boarders then move to nearest city.
If unit is wounded heal. Note: if unit is "in the wild" it would be nice to use the worker wake when in danger AI to wake and move the unit to safety.
If unit can't get to a city set to Explore. (see events Open Borders and Build City)
If unit is wounded heal. Note: if unit is "in the wild" it would be nice to use the worker wake when in danger AI to wake and move the unit to safety.
If unit can't get to a city set to Explore. (see events Open Borders and Build City)
Mammoth
Mammoth units are special because of the wonder. It affects everything about what we do with these units.
If player has built the Mammoth Wonder go to that city and "upgrade unit".
If there are any player cities with tundra in the vicinity (now or potential) with out Ivory in the vicinity and without a Mammoth Herd. Go to biggest and build Mammoth Herd.
If biggest three (five if Military?) cities don't have a Master Hunter go to biggest and build Master Hunter.
If have too many Mammoths build (priority order
If player has built the Mammoth Wonder go to that city and "upgrade unit".
If there are any player cities with tundra in the vicinity (now or potential) with out Ivory in the vicinity and without a Mammoth Herd. Go to biggest and build Mammoth Herd.
If biggest three (five if Military?) cities don't have a Master Hunter go to biggest and build Master Hunter.
If have too many Mammoths build (priority order
- Master Hunter in this city or nearest city without one.
- Carnival in this city or nearest unhappy city without one
- Exotic Herbivores in this city or nearest unhappy city with carnival but without one
- Animal Standard(Totem) in this city or nearest city without one.
Camel
If player has built the Camel Trainer go to that city and "upgrade unit".
If the Myth building for the unit has not been built go to capital city and build it.
If there are any player cities with desert in the vicinity (now or potential) with out Camels in the vicinity. Go to biggest and build Camel Herd.
If have too many Camels build
If the Myth building for the unit has not been built go to capital city and build it.
If there are any player cities with desert in the vicinity (now or potential) with out Camels in the vicinity. Go to biggest and build Camel Herd.
If have too many Camels build
- Carnival in this city or nearest unhappy city without one
- Exotic Herbivores in this city or nearest unhappy city with carnival but without one
- Animal Standard(Totem) in this city or nearest city without one.
Otherwise "sleep".
Horse and Elephant
If player has built the Horse Trainer go to that city and "upgrade unit".
If the Myth building for the unit has not been built go to capital city and build it.
If have too many Horses/Elephants build
If the Myth building for the unit has not been built go to capital city and build it.
If have too many Horses/Elephants build
- Find biggest city without horses/ivory in the vicinity, go there and build Horse/Elephant Herd. (Note: try an not build the elephant herd near tundra?)
- Carnival in this city or nearest unhappy city without one
- Exotic Herbivores in this city or nearest unhappy city with carnival but without one
- Animal Standard(Totem) in this city or nearest city without one.
Otherwise "sleep".
Cheetah and Lion (not Cave Lion or Lion Pack)
Cheetahs are made to be pets. given the current game (Subdue Animals mod) set up single lions are also designed to be pets.
If the Myth building for the unit has not been built go to capital city and build it.
Find most unhappy city which does not have Governor Pets or Governor Menagerie go there and build the building.
If to many units Big Cat Cage or Animal Standard(Totem) in best city.
Otherwise "sleep"
If the Myth building for the unit has not been built go to capital city and build it.
Find most unhappy city which does not have Governor Pets or Governor Menagerie go there and build the building.
If to many units Big Cat Cage or Animal Standard(Totem) in best city.
Otherwise "sleep"
Cave Lion, Lion Pack, Cave Bear and Polar Bear
The sign of a good hunter, these units are designed to build Master Hunter buildings
If the Myth building for the unit has not been built go to capital city and build it.
If biggest three (five if Military?) cities don't have a Master Hunter go to biggest without and build Master Hunter.
If biggest three (five if Military?) cities don't have a Animal Standard(Totem) go to biggest without and build Animal Standard(Totem).
If to many units build
If the Myth building for the unit has not been built go to capital city and build it.
If biggest three (five if Military?) cities don't have a Master Hunter go to biggest without and build Master Hunter.
If biggest three (five if Military?) cities don't have a Animal Standard(Totem) go to biggest without and build Animal Standard(Totem).
If to many units build
- Master Hunter in this city or nearest city without one.
- Big Cat/Bear Cage in this city or nearest unhappy city with carnival but without one
- Animal Standard(Totem) in this city or nearest city without one.
- Find most unhappy city which does not have Governor Pets or Governor Menagerie go there and build the building.
Bear and Panda Bear
As with Cave Bear except build Dancing Bear before trying to build Bear Cage.
Hyena
If biggest three (five if Military?) cities don't have a Animal Standard(Totem) go to biggest without and build Animal Standard(Totem).
If to many units build
If to many units build
- Wolf Cage in this city or nearest unhappy city with carnival but without one
- Animal Standard(Totem) in this city or nearest city without one.
- Find most unhappy city which does not have Governor Pets or Governor Menagerie go there and build the building.
Dire Wolves
The sign of a good hunter, these units are designed to build Master Hunter buildings
If the Myth building for the unit has not been built go to capital city and build it.
If biggest three (five if Military?) cities don't have a Master Hunter go to biggest without and build Master Hunter.
If biggest three (five if Military?) cities don't have a Kennels go to biggest without and build Kennels.
If biggest three (five if Military?) cities don't have a Animal Standard(Totem) go to biggest without and build Animal Standard(Totem).
If to many units build
If the Myth building for the unit has not been built go to capital city and build it.
If biggest three (five if Military?) cities don't have a Master Hunter go to biggest without and build Master Hunter.
If biggest three (five if Military?) cities don't have a Kennels go to biggest without and build Kennels.
If biggest three (five if Military?) cities don't have a Animal Standard(Totem) go to biggest without and build Animal Standard(Totem).
If to many units build
- Master Hunter in this city or nearest city without one.
- Kennels in this city or nearest city without one.
- Wolf Cage in this city or nearest unhappy city with carnival but without one
- Animal Standard(Totem) in this city or nearest city without one.
- Upgrade
- Find most unhappy city which does not have Governor Pets or Governor Menagerie go there and build the building.
Wolves
If biggest three (five if Military?) cities don't have a Kennels go to biggest without and build Kennels.
If biggest three (five if Military?) cities don't have a Animal Standard(Totem) go to biggest without and build Animal Standard(Totem).
If to many units build
If biggest three (five if Military?) cities don't have a Animal Standard(Totem) go to biggest without and build Animal Standard(Totem).
If to many units build
- Kennels in this city or nearest city without one.
- Wolf Cage in this city or nearest unhappy city with carnival but without one
- Animal Standard(Totem) in this city or nearest city without one.
- Upgrade
- Find most unhappy city which does not have Governor Pets or Governor Menagerie go there and build the building.
Crocodiles
A bit special since their Myth building may not be able to be built because it is not on the coast.
Gorilla and Orangutan
Myth and Pets.
Event: On city work radius expands
If work radius now contains tundra wake all Subdued Mammoth units.
If work radius now contains desert wake all Subdued Camel units.
Waking the unit removes orders so that the AI will apply the correct actions to the unit.
If work radius now contains desert wake all Subdued Camel units.
Waking the unit removes orders so that the AI will apply the correct actions to the unit.
Event: On build city
If potential work radius contains tundra wake all Subdued Mammoth units.
If potential work radius contains desert wake all Subdued Camel units.
If any units are on Explore and can get to this city change their orders to go to this city.
Waking the unit removes orders so that the AI will apply the correct actions to the unit.
If potential work radius contains desert wake all Subdued Camel units.
If any units are on Explore and can get to this city change their orders to go to this city.
Waking the unit removes orders so that the AI will apply the correct actions to the unit.
Event: Open Boarders agreement made
If any subdued animal units are on Explore wake them.
Waking the unit removes orders so that the AI will apply the correct actions to the unit.
Waking the unit removes orders so that the AI will apply the correct actions to the unit.
Event: Acquire Technology Trade
Starting with Subdued Giraffe units build Carnivals.
How many cities are there? If there are more Giraffes than cities send a Giraffe to each city and build a Carnival.
How many cities are there? If there are more Giraffes than cities send a Giraffe to each city and build a Carnival.
Event: OnEndgameTurn
Check if there are too many animal units and activate extras. The number that is to many is based on techs so that by Trade+ any subdued animal is to many.
- at Tech Trade + one: All subdued animal units are surplus
- at start of game 3 except for herd units and units that will later upgrade then 5
- at Dog Domestication herd only animals become to many at 3