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
AI Won't Build Cities Right by Cities Belonging to Other AIs #119
Conversation
…ities. If a settler is heading towards a destination, and that tile or a neighboring tile has a city, then it will seek a new destination instead. This new destination will take into account its current location, i.e. it will prefer locations closer to it rather than walking back across the empire, if a location nearby is available.
…om here, but now it's in its own component. Also add a fix in PlayerAI so it doesn't crash if an explorer AI has nowhere to move. Not sure why this happens yet, and it's rare, but the new print statement (and ability to set a breakpoint) ought to help figure it out.
Later on we'll have to consider when a path is blocked, but for now this avoids a possible null situation.
8c47425
to
dc8dae3
Compare
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.
For the main task, it looks okay, but it's going to have conflicts with Flintlock's changes, for example in PlayerAI.cs. That isn't all bad, some of the conflicts like the unit movement ones will be better afterwards. But I'm not going to try to rebase it right now. Hopefully it'll be merged tomorrow.
Tested things out with the latest changes. This change appears to be working as expected. I did notice that with the latest architectural changes, the AI isn't sending out galleys anymore - which goes back to what I mentioned in #148 . But that's not related to the settler changes here. It was actually kind of fun watching the AI duke it out with animations, the Dutch and Greeks had a big border war that went back and forth as they randomly attacked each other. |
Teach the AI not to build cities where other AIs have already built cities. If a settler is heading towards a destination, and that tile or a neighboring tile has a city, then it will seek a new destination instead. This new destination will take into account its current location, i.e. it will prefer locations closer to it rather than walking back across the empire, if a location nearby is available.
This branch adds two new AI players (for a total of 3).