Computer player logic: tax/science/luxuries distribution

tupi

Warlord
Joined
Jun 25, 2011
Messages
241
Location
Russia
Maybe it's not too interesting, but I want to share it anyway, so new thread here. M.b. it's better to create sort of common thread for any previously unknown game rules of civ 1 extracted by decompilation/disassemby?

For clarification: 1 point of taxes is 10% in menu. So, tax rate + luxuries rate + science rate = 10 (100%)

AI civilization performs the following steps every turn (in city loop function, when city number is 128):

These steps are executed only if civilization is not human player's civilzation and 3rd debug flag is set to 1.
(you can learn about debug flags in darkpanda's thread about SVE file format here: https://forums.civfanatics.com/threads/sve-file-format.493581/page-3)

1) set LUXURIES to 10-(SCIENCE+TAX)
2) if at least 1 city of civilization in disorder and SCIENCE+TAX > 6 then increase LUXURIES by 1
3) every 4th turn, if SCIENCE+TAX < 8 and no cities are in disorder and civilization has no cities of size > 5 OR in all such cities number of happy citizens are not equal to number of unhappy citizens,
then reduce LUXURIES by 1
4) if LUXURIES is less than 0 set it to 0
if LUXURIES is more than 4 set it to 4
5) set SCIENCE to (10-LUXURIES)/2
if leader is civilized, then increase SCIENCE by 1
if leader is militaristic, then decrease SCIENCE by1
6) if gold treasury > game_turn+100 then increase SCIENCE by 1
7) if civilization knows ROBOTICS then set SCIENCE to 0
8) set TAX to 10-(SCIENCE+LUXURIES)

also AI sets new TAX rate when it chooses new government (which usually happens every 8th turn, even if 'new' and 'old' govt are the same and no revolution happens. Also it happens next turn after revolution, when AI sets anarchy flag back to 0):
TAX = 4-government/2;
where despotism is 1, monarcy is 2, communism is 3 and republic is 4
but AI doesn't change science rate here (I guess AI don't use tax/science rate anywhere anyway until the next turn, so it's ok that tax+sci can be > 10 here for some time...)

Also, when the game spawns a new civ, by default its tax distribution is 4 tax and 4 science. But immediately after that, tax level is changed to 3 and increased by 1 if leader is militaristic or decreased by 1 if leader is civilized. Then science rate is defined as 9-tax_rate.
 
Last edited:
Oh wow, that's interesting ... so if I used jcived to grant robotics to every civilization, then no AI research would take place? (Except if they obtained Railroad from the human player and built Darwin I suppose).
 
Yep, I tested it. But they still can get some advances from huts. And probably from caravans (if they got Trade before somehow, of course). I noticed long time ago that AI stops all reseaching later in the game (they never get Fusion Power by themselves), but I didn't know what exactly triggers it. Even more: I remember once Greeks got Robotics from me (from city capture mb) but they could not build full SS anyway, because their research was stopped altogether and they didn't know Space Flight or Plastics (I guess Robotics has a high priority for militaristic leaders because of Artillery, so Alexander took it from me first).

What I don't know (though it's pretty easy to check in code and I should do it someday), it's what will happen when AI somehow still reseach full tech tree and then try to get some new tech. Will it crash the game? Or nothing will happen? In other words: this rule 'stop at Robotics' exists just for AI to don't waste their money on useless for them techs or it's actually to prevent game from crash (as only human player has Future Tech counter).
 
Last edited:
Aaand today I learned that AI doesn't pay for maintainance of city improvements at all! It's, like, the biggest cheat of them all... That's why it doesn't have problems with its economy...
 
Last edited:
I seem to remember conquering enemy cities with all sorts of improvements, colliseums etc. and scratching my head how come AI it doesn't have maintenance problems like I do :).
 
Top Bottom