1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

[MOD] More Naval AI

Discussion in 'More Naval AI Modmod' started by Tholal, Mar 18, 2010.

  1. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,629

    Attached Files:

  2. Seven05

    Seven05 Warmonger

    Joined:
    Dec 5, 2005
    Messages:
    1,928
    Gender:
    Male
    Location:
    USA
    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.
     
  3. [to_xp]Gekko

    [to_xp]Gekko WM junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,718
    Location:
    Seyda Neen, Vvardenfell
    awesome :D
     
  4. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,629
    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
     
  5. snarko

    snarko DLLer

    Joined:
    Dec 9, 2003
    Messages:
    1,512
    Location:
    Sweden
    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).
     
  6. Sephi

    Sephi Chieftain

    Joined:
    Jan 25, 2009
    Messages:
    2,908
    you can remove the whole code without problem (done in wildmana)
     
  7. Nor'easter

    Nor'easter Chieftain

    Joined:
    Feb 25, 2007
    Messages:
    1,236
    As someone who started a navy brainstorming thread about a month ago, I definitely agree with what you did with Cargo Space and streamlining the Upgrade Paths, should help make things easier for the AI.
     
  8. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,629
    That thread was definitely part of my inspiration.
     
  9. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,629
    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.
     
  10. ExMachina

    ExMachina Chieftain

    Joined:
    Jun 5, 2008
    Messages:
    203
    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.
     
  11. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    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:
     
  12. [to_xp]Gekko

    [to_xp]Gekko WM junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,718
    Location:
    Seyda Neen, Vvardenfell
    that test looks seriously awesome O.o
     
  13. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,629
    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.
     
  14. Sephi

    Sephi Chieftain

    Joined:
    Jan 25, 2009
    Messages:
    2,908
    yeah, Kael merged only the dll side of my basic naval AI, not the XML settings, that's why you saw no settle ships.
     
  15. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,629
    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
     
  16. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,629
    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.
     
  17. [to_xp]Gekko

    [to_xp]Gekko WM junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,718
    Location:
    Seyda Neen, Vvardenfell
    thanx! :)
     
  18. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,629
    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.
     
  19. [to_xp]Gekko

    [to_xp]Gekko WM junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,718
    Location:
    Seyda Neen, Vvardenfell
    amazing what you're doing man :D
     
  20. Shoobs

    Shoobs Chieftain

    Joined:
    Mar 31, 2010
    Messages:
    185
    Keep up the good work!
     

Share This Page