 |
|  |
 |
|
ahenobarb
|
|
The first part of the code for #3 is done. The AI now build forts!
This script makes the AI now build forts around its capital city and after it has 6 cities, it begins building forts around its major cities as well. Major cities are defined as the cities in the top 30% in terms of population size.
Once the AI has determined to build a fort (a random number generator), is chooses a rondom direction (N, S, E, W) to build the fort. It uses the GetTilePoints search in the "NewSearch.slc" file to evaluate the tiles. When it gets a tile it checks if it is a hill or a mountain and prioritizes them to build the fort. Also, it values mountains over hills when building forts. If there is already a fort in that direction (since it's randomly chosen), it does not build another fort.
The "NewSearch.slc" file must be included either in your script.slc file, or you can open the Stacks.slc file and remove the // in front of the include statement. You must have one, but you can't have both.
Regarding the GetTilePoints search function, it searches the tiles that are pointed to by the corners of the city's map square, which is rotated to a diamond in CTP2. Look at the next post for an illustration.
Also, I will post a picture of the AI using the forts.
Attachment: stacksv.05.zip
This has been downloaded 5 time(s).
|
|
|  |
 |
|
ahenobarb
|
|
This is an illustration of the search. This illustrates a Northward search of the tile. The tile in blue is the city, those in green are the ones that are searched, and grey tiles are not searched. The direction of the search is bottom to top, left to right.
Attachment: gettilepoints_northsearch.jpg
This has been downloaded 79 time(s).
|
|
|  |
 |
|
Zaphod Beeblebrox
|
|
aachen, germany
Aug 1999 time: 05:27
|
|
forts should be priorizized on hot borders, and even there it is more usefull, to pack them in a way, that few fords block as much potential enemy paths by zoc, even if that sometimes means building a fort on some other terrain than a mountain or hill.
|
|
|  |
 |
|
ahenobarb
|
|
quote: Originally posted by Immortal Wombat
Sweet 
I'll reply here, but possibly a new thread may be useful to keep this discussion (which has a lot of potential to bloom) separate. 
Are you working from the assumption here that forts are always good? If the AI is paying their construction cost, then it begins to edge its way into the PW module.
[aside] In fact, it'll sit very well within that once the goal of building a fort has been set... [/aside]
So does the AI really need them all? Depending on how "aware" the AI is, it should probably start building (and manning) them on hot borders, then go on to cold borders (if PW is sufficient) and then into unoccupied space, territory-gap filling, road-bridges and so forth. |
IW, I agree with most of what you say. The assumption is that the AI needs to learn to build stacks of 12 and keep them stationed somewhere waiting for action. rather than just choose a random map point, I want the AI to build forts for this. So this code gets the AI to build forts, so I can work with telling the AI where to send units. The AI may not need them all, but I need them all for now so I can test code. In the picture above the probabilty of fort creation was set incredibly high, so I could make sure it was building them. I set the values lower in the code posted above. Also, I give the AI the PW to build the forts right away instead of asking it to build one later.
Since I'm focusing on stack creation not forts, this code will do for now. Later, I'd like to create an array to store the direction of the attacks and the frequency of attacks. More attacks, more forts. More forts in the right direction. Then there must be code so that a city knows if it is a border or not. Also, borders change due to settling and so forth, so the AI should check to see if this is an expanding border (so it should wait until it is no longer expanding in that direction). -- A lot of additional code would be required for that 
|
|
|  |
 |
|
ahenobarb
|
|
quote: Originally posted by Zaphod Beeblebrox
forts should be priorizized on hot borders, and even there it is more usefull, to pack them in a way, that few fords block as much potential enemy paths by zoc, even if that sometimes means building a fort on some other terrain than a mountain or hill. |
I agree about focusing on hot borders, that will be incorporated into future code. To you second point, the code instructs the AI to build forts on non-hill/mountain squares if it cannot find any hills or mountains in that direction. I guess I should have posted a picture that illustrated that as well, but this was my favorite because I could see that it had skipped over a lot of terrain to find the best spot.
the screen shots where the AI just put the fort in the default location, because there were no hills or mountains, didn't seem as interesting.
|
|
|  |
All times are GMT. The time now is 05:27. Apolyton Time is 00:27. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|