[MOD] More Naval AI

Tholal

Emperor
Joined
May 19, 2009
Messages
1,676

Attachments

  • advanced_scoreboard.jpg
    advanced_scoreboard.jpg
    103.5 KB · Views: 1,562
  • FFH_sevopedia.jpg
    FFH_sevopedia.jpg
    328.9 KB · Views: 1,655
There are some handy functions built into Civ4 for identifying areas, since areas in Civ4 are really continents you can use these to help the AI decide if, or how many, ships they'll need. I used this in my Civ4 mod to prevent the AI from building too many ships (obviosuly not a problem in FfH). I'll see if I can dig up the old python code from before I moved it to the DLL to give you some ideas. You can probably use similar code to refine how you determine which AI to assign to the units having them maintian a larger navy if they're split across multiple areas or switching to a more aggressive AI if they're at war with somebody on a different area.
 
I just realized that I didn't really talk about the net result of my changes. I'll edit my original post later, but for now here's a quick summary.

  • AI will build boats, settle islands and make sea assaults (decent job of settling; sea assaults are kind of hit or miss)
  • AI civs that begin with coastal empires will hit the water techs earlier
 
* Wont settle on on-tile islands - Even on larger islands they will sometimes drop off settler groups only to leave them sitting there doing nothing for the rest of the game. As near as I can tell, what often happens is that the settler group gets dropped off at the wrong island, and then spends the rest of the game trying to get across without the help of a boat. This appears to be an FfH specific problem.

This is because FfH has a check, in the SDK, to stop AI units from moving if they can't move in any direction. This is to prevent a WoC issue. Don't think it would be an issue to exempt one tile islands from this rule (I did it before without noticing a problem) but it requires SDK modding :p

As the settler is surrounded by water it can't move in any direction, therefor the AI is not allowed to use it in any way (including settling).
 
This is because FfH has a check, in the SDK, to stop AI units from moving if they can't move in any direction. This is to prevent a WoC issue. Don't think it would be an issue to exempt one tile islands from this rule (I did it before without noticing a problem) but it requires SDK modding :p

As the settler is surrounded by water it can't move in any direction, therefor the AI is not allowed to use it in any way (including settling).

you can remove the whole code without problem (done in wildmana)
 
Here are some screenshots to show the comparison between base Ffh2 and my mod.

I used a setup that is a difficult map to play and one the AI really has trouble with. I chose a small archipelago map with high water, eight civs, ancient start, no Acheron. There was no human interference at all, and both playthroughs used the exact same start and map.



First picture shows the starting layout.



Here are the results for the base game. As you can see, the game was really very static aside from the appearance of Minister Koun, Hyborem and Basium. But despite building ships, none were ever assigned as settlers or assault ships, so everyone stayed on their own little island. Not a single inter-island settlement was ever built, and no enemy troops ever landed on foreign soil.



Then here's the game with my mod installed. This round was much more dynamic. Not only did everyone settle at least one city off their starting island (though the Balseraphs soon got stuck in one of those situations were the settler lands in the wrong spot and then never moves again), but there were also a number of naval assaults over the centuries. Obviously, the Lsjolfar tore the Sheaim up, but the Elohim also took the two southernmost cities from the Hippus (hard to see due to the culture borders). The Sidar also acquired the easternmost Bannor settlement.



And here we have a final comparison showing the status at turn 350 (which is near the end in a quick game) between the two versions (before is base Ffh2). The Sheaim have been conquered, and the Svartfalar responded to an ill-advised war declaration from the Bannor by destroying all their ships, mounting a trade embargo around their capitol and taking a border island city.
 
This looks very interesting. I've been playing on Pangaea maps lately, since the AI seems to have such problems with navies. This mod looks like a vast improvement so far.
 
Tholal, if you don't mind I'd like to look at what you've done and see what we can merge to RifE. :goodjob:

Yeah. No problem. What I've done so far is fairly crude. The main issue I discovered was that no naval units were ever being assigned assault or settler status, so simply getting those into the mix makes a huge difference.
 
yeah, Kael merged only the dll side of my basic naval AI, not the XML settings, that's why you saw no settle ships.
 
I have a new version that I'll post either tonight or tomorrow. Here's a quick preview of the changes:
  • Caught and fixed an issue that would result in newly founded cities trying to immediately build another settler
  • Did away with trying to use the AI_ESCORT_SEA script on naval units as they would never do anything useful
  • Added a check whenever war status changes to convert missionary and animal AI units to the AI_ATTACK script
  • Some naval units will now take an appropriate crew promotion when created
  • Added a check to convert the first Caravel created to a SETTLER_SEA AI to see if I could help the computer players make that first ocean crossing
 
Beta 1.1 released (see first post for more info). I'll be heading on vacation on Friday, so there won't be any new versions released for a couple of weeks.
 
I was hoping to show further developments in the world, but the game went into one of those infinite hangups around turn 447. This image shows the map state at turn 5, 100, 200, 300, 400 and 440, respectively. This test was done with the latest version of Erebus Continents, low cohesion, high water, x-wrap -- everything else on default settings



The Lanun had their sizable island all to themselves and they took full advantage, planting cities all around the coast and launching successful assaults of the Calabim and the Hippus, wiping both from the map.

The Balseraphs chose a different path, using Loki to snag the 2nd Sheaim city and then waging a continuous, eternal war against the Elohim (restarting it as soon as possible after every cease-fire). They didn't build a single city all game, instead relying on their conquests, which were only mildly successful. But their aggression basically ensured that all of the civs on their island would never amount to a world power, though the Elohim did try to escape the insanity by moving some of their people to a tiny island in the northern hemisphere.

The Khazad were mostly content with sitting on their two cities, though they did join the Lanun in attacking the Hippus, securing a city on that island and then branching off to another nearby. But then they summoned Basium, declared war on the Sheaim and the Doviello, subjugating both. The Grigori also jumped into the fray, taking the Sheaim's lone offshore colony and joining the Khazad in beating the evil civilization on their home turf.
 
Top Bottom