Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement AI wonder building logic #505

Open
axx0 opened this issue Apr 3, 2020 · 0 comments
Open

Implement AI wonder building logic #505

axx0 opened this issue Apr 3, 2020 · 0 comments

Comments

@axx0
Copy link
Contributor

axx0 commented Apr 3, 2020

Courtesy of tupi from civfanatics forum
https://forums.civfanatics.com/threads/civ-1-explained-ai-wonders.656707/

As you know, in Civ 1 computer player is a cheating bastard and it gets Wonders for free. And here is the exact algorithm how it does that.
https://pastebin.com/QFP2ZEC0
This routine runs at the beginning of every turn right after check for global warming (in the same function). Game calls this fuction right after sea barbarian spawning and land barbarian spawning.
Some notes:
1)AI tries to build a wonder in a random city (0..127) at the beginning of every turn. Number of tries = game difficulty+1. Wonder is randomly selected (from 1 to 21) for each iteration.
2)AI never builds more than 1 wonder per turn.
3)Of course AI should know civ advance for wonder to build it. But it doesn't care if wonder is obsolete or not.
4)AI can build a wonder only if [population of city/100 > wonder cost in shields]. For example, most modern wonders cost 600 shields. This means AI can build such a wonder only in a city with population 7 or more.
5)on Chieftain difficulty, AI never builds a wonder if human player don't have a civ advance to build this wonder.
6)on Chieftain and Warlord difficulty AI never builds a wonder if this wonder is selected as current production in one of human player's cities. (except for Manhattan Project - actually AI will change wonder to MP in this case).
7)contruction of Wonder zeroes the shield counter in the city
8)AI actually pays for wonders with gold! But only 1$ per shield (full row = 10 shields here regardless of difficulty) and never more than 1/3 of its treasury. So even if it doesn't have enough money - it will still build a wonder and will only lost 1/3 of its gold for that. Accumulated shields should be counted as part of the wonder cost for 1$/shield discount, BUT shield counter is nullified BEFORE that, so it doesn't matter.
6)for Manhattan Project, there's some additional rules. AI builds it only if it knows Rocketry tech (for nukes). If human player knows Rocketry too, then AI will build it only if AI civ military_power <= human player's civ military power. Not only that, but Manhattan Project is always selected in first iteration IF AI knows Rocketry and player doesn't.
7)probably everybody knows, but if you have an embassy, you will get Foreign Minister report instead of Travellers report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant