I am posting this to continue discussing a question that (re-)appeared in the Frenzy AI revisited thread . Talking about AI strategies and concepts we came to the settling question: How to make the AI settle more intelligently?
Well, yes, that's one thing I did - and I wrote
This works, too, and it seems pretty efficient, but it is not extremely elegant and I would still prefer being able to take influence on settler's moves and orders. We could then develop "settling tactics" similar to other unit's/armie's tactics.
Has anybody tried to SLIC settlers to move and settle? Successfully?
My impression is, that settlers are moving during a different turn phase than all other units and we simply don't have SLIC-access to this turn phase at all. Therefore, none of the event handlers I tried to use to control settlers using MovePathOrder()/MoveToOrder() ... as well as Settle()/SettleOrder() did work.
If some people can confirm this theory we could possibly put this issue on the fix list for the source code project.
However - my "SLICing the settlers"-experiment can be examined here: MoT_s_settling.slc and here: MoT_strategies.txt (near the bottom of the latter).
Originally posted by Martin Gühmann
... you just need to set the settling priority very high and the map will be filled with AI cities ...
... you just need to set the settling priority very high and the map will be filled with AI cities ...
- a set of settling strategies plus
- a small framework of SLIC to determine the AI's choice of settling strategies using
[**] their government-specific city-max (thanks to player.government[] this is much easier now)
[**] the "average" human's number of cities to determine the AI's "desired number of cities"
[**] and a little bit of variation accoring to gamestage
[**] (additional parameters to be added / additional refining in future)
The problem with this set of measures is, that they will "fill the map with cities", but they won't necessarily do it more intelligently. They will still settle too close or too far, they will still try to settle in foreign territory, if they are neighbored by a superior HUMAN they will still not dare settling close to him (at least sometimes and for some reason I haven't yet researched), and they will stop settling at all at some point between ancient age and renaissance no matter how high I set their settling priority in strategies.txt and how ridicoulosly small their "empire" is.
First thing I did, because I really hated having to expel each and every foreign settler, the AI nonetheless immediately settling between my cities if I forgot to expel one of their "little dudes": - wrote a small handler 'DontSettleHere': simply return STOP at SettleOrder if on foreign territory (this goes for the HumanPlayer, too, of course)
The consequence was, that the AI would leave their settler there forever because it obviously can't manage to assign a new goal to this settler (again: no matter which priority is set). The same thing happens if a settler is hindered in settling at his original goal by some other reason. I tried to overcome this problem by - stealing a function from IW I think (but I can't find the source at the moment, please don't beat me if I am not correct) to evaluate settling locations (of course it would be useful to get SLIC-access to the terrain's SettleScore, too)
- moving settlers to good settling locations (like any other army, I thought) and
- force them to settle there using Settle() or SettleOrder()
This didn't work out and so I - wrote a function to simulate settling: SettleNow()
OK this works. The problem would be still, that once the AI has sent out a settler his goal seems to be determined once and forever and they will never re-task him whatever happens. Therefore I had to write - a function to keep track of the "first three" settlers of each AI civ to detect if they are moving at all, to force settling if they accidentially stumble over a good settling tile, and to
- "beam" paralyzed settlers home (actually the paralyzed guy is killed and a new one is created in a random city - giving the AI the chance to assign to the new unit a different goal, raising the chance of accidentially stumbling across a good settling location).
This works, too, and it seems pretty efficient, but it is not extremely elegant and I would still prefer being able to take influence on settler's moves and orders. We could then develop "settling tactics" similar to other unit's/armie's tactics.
Has anybody tried to SLIC settlers to move and settle? Successfully?
My impression is, that settlers are moving during a different turn phase than all other units and we simply don't have SLIC-access to this turn phase at all. Therefore, none of the event handlers I tried to use to control settlers using MovePathOrder()/MoveToOrder() ... as well as Settle()/SettleOrder() did work.
If some people can confirm this theory we could possibly put this issue on the fix list for the source code project.
However - my "SLICing the settlers"-experiment can be examined here: MoT_s_settling.slc and here: MoT_strategies.txt (near the bottom of the latter).
Comment