-
-
Notifications
You must be signed in to change notification settings - Fork 957
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
Add: AI/GS IsNoiseLevelIncreaseAllowed #7451
Conversation
a51629d
to
9804f2d
Compare
Can't you just test building an airport instead? Players are not able to directly query this, so it seems odd than AIs can. |
This idea came from another PR.
This is how I use it in an AI. Both |
DoCommand is slow, even in test mode. DoCommand slows down the whole thing. It's easier on the cpu, but makes the AI feel like it's falling asleep in comparison. With the test noise, I iterate 32 towns, without it, I iterate 5 towns in the same time-frame. |
API addition that may be used to check whether the noise that will be added to the nearest town if an airport would be built at a tile is allowed.
9804f2d
to
5e93c92
Compare
@@ -18,6 +18,9 @@ | |||
* \b 1.10.0 | |||
* | |||
* This version is not yet released. The following changes are not set in stone yet. | |||
* API additions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already an "API additions" section
The AI API is designed to only give information and allow actions which a human can also get/do (with some minor offset when it was absolutely needed). There is nothing in this function that can't already be done in scripts. Yes, it would take a bit longer, but a human would also take longer to figure out this question. New AI API entries are and should always be measured like this. "Can a human do it too?" As such, I am declining this addition. Either we should make this easily available for the human too, or the AI should be slow to process thing question. This could, how ever, easily be put in a library. It is the exact reason Pathfinders are in libraries, and not in the API. Tnx for the contribution though! Hope you understand why we are closing this :) |
Oh no TrueBrain, perhaps I failed at explaining things again? When I said "With the test noise", I meant those 3 lines in the code, not my API addition. My API addition is only mixing the 3 lines into 1 single command, to avoid repeating execution of the same code. Doing the test with those 3 lines vs doing the test with the new API command was meant to be an optimization only. :( |
No you're wrong. A human player does not have any way to read the current airport noise level of a town, the player cannot know whether it's possible to build a new airport without actually trying to build a new airport. If an AI can know whether it's possible to build an airport in a location without actually building the airport, then the AI is by definition cheating, because it's using information not available to a human player. |
AI Code 1 (1 below):
AI Code 2 (2 below):
|
API addition that may be used to check whether the noise that will be added to the nearest town if an airport would be built at a tile is allowed.