Something odd is going on

alberts8

Emperor
Joined
Aug 16, 2012
Messages
1,967
I just started a new AI Autoplay. After a while i stopped it because i noticed something in the bbai.log. As you can see in the Denmark has lots of units with UNITAI_HUNTER_ESCORT but new units get built instead of exiting units answering to the hunters escort request.

The next issue is that the Stone Spearman hasn't UNITAI_HUNTER_ESCORT set as valid UnitAI but the AI chooses this unit anyways???

Code:
[685656.125] Denmark stats for turn 122:
[685656.125]     Gold rate: 0
[685656.125]     Science rate: 100
[685656.125]     Culture rate: 0
[685656.125]     Espionage rate: 0
[685656.125]     Treasury: 02228
[685656.125]     Total gold income from self: 60
[685656.125]     Total gold income from trade agreements: 0
[685656.125]     Unit cost (pre inflation): 0
[685656.125]     Unit supply cost (pre inflation): 0
[685656.125]     Maintenance cost (pre inflation): 7
[685656.125]     Civic upkeep cost (pre inflation): 0
[685656.125]     Corporate income (pre inflation): 0
[685656.125]     Inflation effect: 0
[685656.125]     Is in financial difficulties: no
[685656.125]     Total science output: 53
[685656.125]     Total espionage output: 18
[685656.125]     Total cultural output: 85
[685656.125]     Total population: 7
[685656.125]     Total food output: 39
[685656.125]     Total production output: 72
[685656.125]     Num cities: 1
[685656.125]     National rev index: 6
[685656.125]     Number of barbarian units killed: 35
[685656.125]     Number of animals subdued: 3
[685656.125]     Civic switches: 6
[685656.125]     Total num civics switched: 16
[685656.125]     Total turns in anarchy: 2 (1%)
[685656.125]     Current civics:
[685656.125]         GOVERNMENT: Chiefdom
[685656.125]         Rule: City States
[685656.125]         Power: Strongman
[685656.125]         Society: Caste System
[685656.125]         Economy: Barter
[685656.125]         Military: Tribal Warfare
[685656.125]         Religion: Divine Cult
[685656.125]         Welfare: Survival
[685656.125]         Garbage: Burn Garbage
[685656.125]         Immigration: No Borders
[685656.125]         Education: Oral Tradition
[685656.125]         Language: Trade Language
[685656.125]         Agriculture: Subsistence Agriculture
[685656.125]         Currency: Metals
[685656.125]         Labor: Community Labor
[685656.125]     Civic switch history:
[685656.125]         Turn 2:
[685656.125]             No Language -> Native Language (no anarchy switch)
[685656.125]         Turn 6:
[685656.125]             Ignorance -> Oral Tradition (no anarchy switch)
[685656.125]         Turn 13:
[685656.125]             Militia -> Banditry (no anarchy switch)
[685656.125]             Irreligion -> Folklore (no anarchy switch)
[685656.125]         Turn 47:
[685656.125]             Primitive -> Tribal (no anarchy switch)
[685656.125]             Banditry -> Tribal Warfare (no anarchy switch)
[685656.125]             Unorganized Labor -> Community Labor (no anarchy switch)
[685656.125]         Turn 67:
[685656.125]             Anarchism -> Chiefdom
[685656.125]             Communalism -> Barter
[685656.125]             Folklore -> Divine Cult
[685656.125]             Garbage Anywhere -> Burn Garbage
[685656.125]             No Agriculture -> Subsistence Agriculture
[685656.125]         Turn 103:
[685656.125]             Obedience -> City States
[685656.125]             Tribal -> Caste System
[685656.125]             Native Language -> Trade Language
[685656.125]             No Currency -> Metals
[685656.125]         City Copenhagen:
[685656.125]             Population: 7
[685656.125]             Production: 72
[685656.125]             Food surplus: 11
[685656.125]             Local rev index: -1
[685656.125]             Maintenance: 5
[685656.125]             Income: 60
[685656.125]             Science: 52
[685656.125]             Espionage: 18
[685656.125]             Culture: 85
[685656.125]             Net happyness: 33
[685656.125]             Net health: 13
[685656.125]             Food trade yield: 0
[685656.125]             Production trade yield: 0
[685656.125]             Commerce trade yield: 0
[685656.125]             Properties:
[685656.125]                 Disease: value(-47) change(-10)
[685656.125]                 Crime: value(-144) change(0)
[685656.125]                 Water Pollution: value(80) change(0)
[685656.125]                 Air Pollution: value(-32) change(1)
[685656.125]                 Education: value(531) change(5)
[685656.125]                 Flammability: value(42) change(0)
[685656.125]                 Tourism: value(33) change(0)
[685656.125]             PropertyBuildings:
[685656.125]                 Education: Education (Intuitive)
[685656.125]                 Education: Education (Brilliant)
[685656.125]                 Education: Education (Argumentative Awareness 1)
[685656.125]                 Education: Education (Argumentative Awareness 2)
[685656.125]                 Tourism: Tourism (Level 1)
[685656.125]     Units:
[685656.125]         Scout (UNITAI_EXPLORE): 1
[685656.125]         Clubman (UNITAI_SETTLER_SEA): 1
[685656.125]         Spiked Clubman (UNITAI_SETTLE): 1
[685656.125]         Stone Axeman (UNITAI_CITY_DEFENSE): 1
[685656.125]         Wood Spearman (UNITAI_HUNTER): 1
[685656.125]         Stone Spearman (UNITAI_HUNTER_ESCORT): 24
[685656.125]         Archer (UNITAI_CITY_DEFENSE): 6
[685656.125]         Atlatlist (UNITAI_CITY_DEFENSE): 1
[685656.125]         Tribal Guardian (UNITAI_PROPERTY_CONTROL): 1
[685656.125]         Tengri Shaman (UNITAI_MISSIONARY): 1
[685656.125]     Buildings constructed by units:
[685656.125]         Health Spa: 1
[685656.125]         Myth - Opossum: 1
[685656.125]         Military Standard (Animal mascot): 1
[685656.125]         Feather Worker: 1
[685656.125] Exp for promotion present (8 vs 3)
[685656.125]     Denmark's Archer 1 (Copenhagen) chooses promotion City Garrison I
[685656.125] Exp for promotion present (8 vs 6)
[685656.188]     Denmark's Archer 1 (Copenhagen) chooses promotion City Garrison I
[685656.188]     Denmark calculates upgrade budget of 2 from 2228 current gold, 9 target
[685656.188]     Unit Scout (16390) for player 0 (Denmark) at (13,15) advertising for work
[685656.188]     Unit Scout (16390) for player 0 (Denmark) at (13,15) - no work available
[685656.188]     Hunter for player 0 (Denmark) at (13,15) found no urgent contractual work
[685656.188]     Unit Atlatlist (40975) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Atlatlist (40975) for player 0 (Denmark) at (10,8) found work at (10,8) [to join -1]
[685656.188]     ...already at target plot.
[685656.188]     Unit Stone Spearman (40981) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (65545) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57361) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57378) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57380) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57381) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57382) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57383) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (65540) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (65543) for player 0 (Denmark) at (10,8) advertising for work
[685656.188] Player 0 (Denmark) begin Update City Sites ...
[685656.188]   City found value at (6, 4) is 22146
[685656.188]   City found value at (11, 5) is 23886
[685656.188]   City found value at (13, 8) is 1957152
[685656.188]   City found value at (13, 11) is 2932990
[685656.188]     Found City Site at (13, 11)
[685656.188]   City found value at (6, 4) is 22146
[685656.188]   City found value at (11, 5) is 23886
[685656.188]   City found value at (4, 9) is 725422
[685656.188]   City found value at (5, 9) is 894512
[685656.188]   City found value at (3, 12) is 1002330
[685656.188]   City found value at (7, 13) is 1049394
[685656.188]   City found value at (7, 14) is 1079512
[685656.188]   City found value at (4, 16) is 1265400
[685656.188]   City found value at (5, 16) is 1376770
[685656.188]   City found value at (5, 17) is 1412068
[685656.188]     Found City Site at (5, 17)
[685656.188]   City found value at (6, 4) is 22146
[685656.188]   City found value at (11, 5) is 23886
[685656.188]   City found value at (4, 9) is 725422
[685656.188]   City found value at (5, 9) is 894512
[685656.188]     Found City Site at (5, 9)
[685656.188]   City found value at (13, 4) is 13636
[685656.188]   City found value at (11, 5) is 23886
[685656.188]   City found value at (12, 18) is 250194
[685656.188]   City found value at (13, 18) is 294816
[685656.188]   City found value at (11, 19) is 551152
[685656.188]   City found value at (13, 20) is 643134
[685656.188]     Found City Site at (13, 20)
[685656.188] Player 0 (Denmark) end Update City Sites
[685656.188]     Unit Stone Spearman (40979) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (40984) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (40986) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (49175) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (65544) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57369) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57366) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57373) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57374) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57375) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57376) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (57377) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (65546) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Stone Spearman (73730) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Denmark's hunter (24587) at (10,8) [stack size 1] requests escort at priority 400
[685656.188]     Unit Archer (57372) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Archer (57372) for player 0 (Denmark) at (10,8) found work at (10,8) [to join -1]
[685656.188]     ...already at target plot.
[685656.188]     Unit Archer (57360) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Archer (57360) for player 0 (Denmark) at (10,8) found work at (10,8) [to join -1]
[685656.188]     ...already at target plot.
[685656.188]     Unit Archer (57362) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Archer (57362) for player 0 (Denmark) at (10,8) found work at (10,8) [to join -1]
[685656.188]     ...already at target plot.
[685656.188]     Unit Archer (73741) for player 0 (Denmark) at (10,8) advertising for work
[685656.188]     Unit Archer (73741) for player 0 (Denmark) at (10,8) found work at (10,8) [to join -1]
[685656.188]     ...already at target plot.
[685656.500]     Unit Stone Spearman (40981) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (65545) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57361) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57378) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57380) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57381) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57382) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57383) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (65540) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (65543) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (40979) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (40984) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (40986) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (49175) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (65544) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57369) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57366) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57373) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57374) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57375) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57376) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (57377) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (65546) for player 0 (Denmark) at (10,8) - no work available
[685656.500]     Unit Stone Spearman (73730) for player 0 (Denmark) at (10,8) - no work available
[685656.500]       Processing bids for tender for unitAI UNITAI_CITY_DEFENSE at (10,8) with priority 192
[685656.563]       City Copenhagen could supply unit Archer with base value 20358, depreciated value (after 1 turn production at distance 0) to 18322
[685656.563]       City Copenhagen wins business for unitAI build UNITAI_CITY_DEFENSE (training Archer)
[685656.563]     City Copenhagen pushes production of unit Archer with UNITAI city defense
[685656.563]       Processing bids for tender for unitAI UNITAI_HUNTER_ESCORT at (10,8) with priority 400
[685656.563]       City Copenhagen could supply unit Stone Spearman with base value 40209, depreciated value (after 2 turn production at distance 0) to 32167
[685656.563]       City Copenhagen wins business for unitAI build UNITAI_HUNTER_ESCORT (training Stone Spearman)
[685656.563]     City Copenhagen pushes production of unit Stone Spearman with UNITAI hunter escort
[685656.563] 4 out of 4 contracts satisfied, 5 unit employed, 25 left without work
 
I was about to bring up a similar observation, that Watchers are getting sucked into Hunter Escort roles as well. I know what needs to be done though, based on what you just showed.

What I don't understand here is why stone spearmen are looking for work but Copenhagen builds one anyhow before the units looking for work are checked to see if they can answer the call. That's a bug that drives me nuts. I've often wondered if this was taking place and now I see it specifically laid out like that it makes it obvious it's happening for sure. We'll have to sort that out.

What I need to do, however, about the poor escort determination, is to establish that hunter escorts must be a part of the repertoire of AI types the unit has listed. Not all AI types care if the unit specifically is designated for that potential role but there's a way to say, yes, we care and only want units that are declared to potentially be this AI type. An easy fix and I know right where to go for that.
 
Not all AI types care if the unit specifically is designated for that potential role but there's a way to say, yes, we care and only want units that are declared to potentially be this AI type. An easy fix and I know right where to go for that.

Units being chosen for other AI roles as they have defined as valid UnitAI's can only make trouble it shouldn't happen. What was the reason for this change?
If there are units which can fulfill other roles why not just add those UnitAI's in the xml?


Edit:

I just saw an Scout with UNITAI_SETTLE??
Code:
[697067.375]     Units:
[697067.375]         Scout (UNITAI_SETTLE): 1
[697067.375]         Hunter (UNITAI_HUNTER): 1
[697067.375]         Stone Maceman (UNITAI_CITY_DEFENSE): 1
[697067.375]         Stone Axeman (UNITAI_CITY_DEFENSE): 1
[697067.375]         Stone Spearman (UNITAI_HUNTER_ESCORT): 7
[697067.375]         Archer (UNITAI_CITY_DEFENSE): 6
[697067.375]         Atlatlist (UNITAI_CITY_DEFENSE): 3
[697067.375]         Tribal Guardian (UNITAI_PROPERTY_CONTROL): 1

And some new subdued animals??
Code:
[697066.500]         Chaser (UNITAI_SUBDUED_ANIMAL): 1
[697066.500]         Tracker (UNITAI_SUBDUED_ANIMAL): 1

Swimming Clubman?
Code:
[685656.125]        Clubman (UNITAI_SETTLER_SEA): 1
 
Last edited:
Units being chosen for other AI roles as they have defined as valid UnitAI's can only make trouble it shouldn't happen. What was the reason for this change?
If there are units which can fulfill other roles why not just add those UnitAI's in the xml?


Edit:

I just saw an Scout with UNITAI_SETTLE??
Code:
[697067.375]     Units:
[697067.375]         Scout (UNITAI_SETTLE): 1
[697067.375]         Hunter (UNITAI_HUNTER): 1
[697067.375]         Stone Maceman (UNITAI_CITY_DEFENSE): 1
[697067.375]         Stone Axeman (UNITAI_CITY_DEFENSE): 1
[697067.375]         Stone Spearman (UNITAI_HUNTER_ESCORT): 7
[697067.375]         Archer (UNITAI_CITY_DEFENSE): 6
[697067.375]         Atlatlist (UNITAI_CITY_DEFENSE): 3
[697067.375]         Tribal Guardian (UNITAI_PROPERTY_CONTROL): 1

And some new subdued animals??
Code:
[697066.500]         Chaser (UNITAI_SUBDUED_ANIMAL): 1
[697066.500]         Tracker (UNITAI_SUBDUED_ANIMAL): 1

Swimming Clubman?
Code:
[685656.125]        Clubman (UNITAI_SETTLER_SEA): 1
Well things are a lot more screwed up than I thought then. You've noted a lot of them that shouldn't be able to pick a unit from outside the specified AIs entirely. 90% or more AI types demand only those that are specifically stated in the xml. To answer your question would take longer than I have atm so I'll try later.
 
I had a look in worldbuilder, and found an archer with the UNITAI_WORKER_SEA. ^^

Something is definitely wrong here, though most units I looked at in my game had reasonable UNITAI assignments.

Also found a Hunter with UNITAI_CITY_ATTACK and another Archer with UNITAI_INFILTRATOR.
 
Last edited:
In my game enemy cities have like 35-50 Stone Spearmans, can that be related to this topic, or is normal behaviour for Deity difficulty?
 
@Thunderbrd

Please revert the UnitAI changes you made since the release of v38, i keep seeing odd things

//TB Note: New game theory being introduced here - a unitAI should NEVER change its AI when upgrading!
//This was causing an infinite spam of units that the game couldn't get enough of a count of because
//the AI kept upgrading their best pick for something and then upgrading it to another unit that couldn't be that AI type.
//NOW, we should ALWAYS maintain the role a unit was designed for.
//Watch for odd problems this might introduce elsewhere though.

The NotUnitAIs tag exists to take care of that. I had this Problem then i introduced the UNITAI_HUNTER_ESCORT but adding that unit ai to all invalid upgrades as NotUnitAI fixed it without radical dll changes. Some things are caused by bad xml setup and should be fixed in the xml and not in the dll.
 
I have made changes. Some of the reported effects, nearly all, could be explained with the operational theory of what the problem amounts to. Unfortunately there's a little guesswork to take here. IF I'm accurate as to why the problem is happening, then the changes I've just made should correct the issue.

But we need to take a look regularly at the unit AI assignments.
 
@Thunderbrd

Please revert the UnitAI changes you made since the release of v38, i keep seeing odd things



The NotUnitAIs tag exists to take care of that. I had this Problem then i introduced the UNITAI_HUNTER_ESCORT but adding that unit ai to all invalid upgrades as NotUnitAI fixed it without radical dll changes. Some things are caused by bad xml setup and should be fixed in the xml and not in the dll.
Which would take months, if not years, of effort to resolve. In that particular case, there were a nest of bugs coming from that bad decision to have unit AI's change when they join other groups. I'm pretty sure the odd things you're seeing are limited to a small section of errors.
 
Isn't possible to just add those special UnitAI's to a wider range of units instead?
At the moment, some AIs haven't been added to any units at all and are thus just selecting the best units. However, to maintain integrity, I've closed those loopholes as well.
 
Great that you guys work so hard for this mod. Are you going to release this remedy as a patch?
Gotta make sure it's working first. That will take some getting samples.

@alberts2 - remind me again how to autorun the AI if you would
 
Which would take months, if not years, of effort to resolve.

That's one of the reasons i keep saying that this mod has too much content.

The issue with building replacements disabling other buildings is another problem that could be improved with proper xml setup but doing that for 6000 buildings............

I wrote a C# Programm to make all kinds of modifications to the c2c xml for the schema validation changes which i'am going to commit soon. It's possible to write code to add NotUnitAI's to Upgrades if they don't have all the UnitAI's. The same goes for adding replacement buildings as or prerequisites to other buildings.
 
@Thunderbrd

Please revert the UnitAI changes you made since the release of v38, i keep seeing odd things



The NotUnitAIs tag exists to take care of that. I had this Problem then i introduced the UNITAI_HUNTER_ESCORT but adding that unit ai to all invalid upgrades as NotUnitAI fixed it without radical dll changes. Some things are caused by bad xml setup and should be fixed in the xml and not in the dll.
Some problems here cannot be solved by NotUnitAI settings because the problem at upgrade is with valid AI types being adopted and screwing up the intent of that unit. We simply have to consider this in the unit upgrade chains that units can no longer upgrade to a type that doesnt have a valid AI of the type the unit has now. That may find some problem spots but certainly not something that crestes the issues noted. That problem is related to the best unit for ai selection process and interestingly it seems to only be an issue with brokerage requests. I am not 100 percent sure I've found the root reason that broker calls can avoid some proper filters but I've only had a limited amount of time to find it. After the changes I am introducing some theories will either be proven true or I will need to comb through the unit selection process even more carefully.

I understand the request to revert but you would only want to do that if things were working before and they were NOT at all working well. So, imo, we are better off fixing the problems we have now than we are to move backwards. We won't let this rest til its good I promise that. As you know from firsthand experience this realm is a mess of odd design decisions and bugs such that fixing a problem will often create another. So that doesn't mean we must not allow those fixes... it means we just keep finding there's something more to address and keep moving forward.
 
Top Bottom