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

(RFC): List of problems for ConstructionAutomation #11264

Open
10 of 16 tasks
SeventhM opened this issue Mar 5, 2024 · 3 comments
Open
10 of 16 tasks

(RFC): List of problems for ConstructionAutomation #11264

SeventhM opened this issue Mar 5, 2024 · 3 comments

Comments

@SeventhM
Copy link
Collaborator

SeventhM commented Mar 5, 2024

Before creating

  • This is NOT a gameplay feature from Civ VI, BNW, or outside - see Roadmap
  • This is NOT a gameplay feature from Vanilla Civ V or from G&K - If so, it should be a comment in Missing features from Civ V - G&K #4697

Problem Description

Right now I want to try to focus in on cleaning up ConstrcutionAutomation, or at least get the issues with the it documented to work on for later. Right now there's a few issues with the class

  • Ais solely looks at cost when deciding to build something. For example, If one building costs 1 and gives 1 culture, it will always be preferred over a building that costs 3 and gives a thousand culture. That's clearly a problem
  • Combined stats of a building aren't considered. A building with 2 science and 3 production is seen equal to a building with just 2 science when checking science and to a building with just 3 production when checking production
  • AIs don't consider production boosts for building them. I know I attempted to fix that in Allow AI to consider production bonuses when building #11254, but that only fixes the end choice. I.e., a faith building with a production boost is picked over an equally costed production building without one. But a faith building with a production boost won't be picked over an equally costed one without a production boost
  • AIs don't build buildings that give cities additional health
  • AIs don't consider the benefit of Courthouse styled buildings. Instead they generally assume the benefit is generally good, even in cities that would otherwise be unaffected. Ideally, this should instead be treated as a general stat increase of happiness
  • AIs don't consider population increases
  • There is a need to genericize some of the wonder logic
  • Stat increases are treated via isStatRelated. This accidentally includes percentage increases, which generally are different
  • AIs don't consider stat increases from other scources (policies, nation, other buildings). Just from the construction itself
  • Unlike tile considerations, AIs do not consider if they are running out of gold as a reason to build a gold building
  • Unlike tile considerations, AIs do not consider lower cities for a larger need for food buildings
  • AIs don't consider specialists. This one is a bit lower priority imo, bit still worth looking into eventually
  • AIs don't consider tile stat increases. Most notably, AIs don't notice if a building increases the stats of a tile that's not near any city. This could be an expensive thing to check, however
  • This file assumes production, making it unusable for gold buying, despite the obvious code overlap in the two ideas

If there's other issues, please point them out. Hopefully we can get the issues crossed off as we go

Related Issue Links

No response

Desired Solution

Fixes to the above

Alternative Approaches

Yes

Additional Context

No response

@SeventhM
Copy link
Collaborator Author

SeventhM commented Mar 5, 2024

Also pinging @tuvus in case he wants to look over some of these. Also, Uh, do you want me to ping you like this on issues/PRs or do you want to just look over them as you go?

@SeventhM SeventhM added the AI label Mar 5, 2024
@SeventhM SeventhM changed the title (RFC)?: List of problems for ConstructionAutomation (RFC): List of problems for ConstructionAutomation Mar 5, 2024
@tuvus
Copy link
Collaborator

tuvus commented Mar 6, 2024

Also, Uh, do you want me to ping you like this on issues/PRs or do you want to just look over them as you go?

No problem, you can ping me if you want. I probably won't see it if you don't ping me since I don't do regular checks on the issues or PRs unless they show on discord.

Unlike tile considerations, AIs do not consider if they are running out of gold as a reason to build a gold building

I definitely agree with this, the AI is somewhat incompetent with gold income. It seems to me that the best fix was just to make the AI cheat. There also aren't many gold production buildings early on in G&K anyway.

Ais solely looks at cost when deciding to build something. For example, If one building costs 1 and gives 1 culture, it will always be preferred over a building that costs 3 and gives a thousand culture. That's clearly a problem

I looked at this again and am startled to find that this is true. This might need to be fixed by evaluating them in two different places, once without the stat and once with.
Fixing this might improve the alpha frontier AI since all the buildings are so expensive and some of them don't provide much benefit.

Combined stats of a building aren't considered. A building with 2 science and 3 production is seen equal to a building with just 2 science when checking science and to a building with just 3 production when checking production.

Good point, why are we splitting up multiple add-building choices just to use the same evaluation algorithm for a different stat? The current method is certainly not very mod-friendly.

We will probably have more uniques in the future that need to be added, so keep in mind that this probably won't be a static list.

About buying buildings with gold. We probably need to rewrite that as well to use the production system. Currently, the AI only buys the building/unit in production. If I understand this correctly, if the AI half builds a building and buys it, it costs the same amount. Meaning the AI should not want to buy the current building/unit in production unless it just started if this is true.

@SeventhM
Copy link
Collaborator Author

SeventhM commented Mar 7, 2024

If I understand this correctly, if the AI half builds a building and buys it, it costs the same amount. Meaning the AI should not want to buy the current building/unit in production unless it just started if this is true.

This is actually one of the more minor issues in the grand scheme of things. There are actually two situations that can make this much worse

  1. AI cannot buy unbuildable constructions #10581
  2. Let's say we have 2 otherwise identical buildings. Building A has a production bonus given to it, but has a higher gold price than building B. Assuming the AIs consider the production bonus correctly, The AIs will basically always buy building A if it can and refuse to buy building B unless building A is built first. This is because A will always be in the production queue before B. This is true even if B is made free

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

No branches or pull requests

2 participants