1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

What would be the best way to make the AI less stupidly aggressive?

Discussion in 'CivBE - Modding Help & Mod Creation' started by Afterburner, Nov 7, 2018 at 9:22 PM.

  1. Afterburner

    Afterburner Chieftain

    Joined:
    Mar 13, 2005
    Messages:
    133
    I just started playing this again, and have been reminded about how much I hate how braindead the AI's aggression levels are.

    * AI declares war because I don't have enough units built to satisfy what IT thinks I should have
    * AI attacks my cities
    * AI loses because the few units I have are more than enough to repel an AI invasion
    * AI eventually sues for peace, with a warscore of 200-to-0.
    * AI waits 15 turns or so before starting the whole business over again

    Two of my neighbors in my current game have done this a dozen times each by now. It is ridiculous, and I am wondering if there is some way to change this behavior by editing an XML file.
     
  2. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,398
    Not via XML, but it's possible to do via lua. In Rising Tide, the logic by which AIs decide how much they like you and how they will engage you is modable in DiplomacyAI.lua, to be more precise, in the CalculateOpinion and CalculateApproach functions. The default functions only check for fear and respect with no regards for the actual situation on the map, so you could easily mod in a strength check to make them not attack you if they're extremely weak for example.

    At least in theory this should work, but I never really tested how well these values work out in an actual game and whether they're taken as "musts", or whether they're just a consideration for the AI system that is hardcoded in the C++ code which isn't accessible.
     
    Afterburner likes this.
  3. Afterburner

    Afterburner Chieftain

    Joined:
    Mar 13, 2005
    Messages:
    133
    Thanks! Is there a quick and dirty lua tutorial or guide somewhere? I have never heard of lua before now, so I haven't the faintest idea how to mess with it. But I'm a quick learner if I have a good guide.
     
  4. Ryika

    Ryika Lazy Wannabe Artista

    Joined:
    Aug 30, 2013
    Messages:
    9,398
    I learned the basics by watching some Youtube Tutorials and then went on to do some simple "Learning by doing" as needed to work stuff into my mods. Don't remember which videos I watched, but Lua isn't a very complicated language, so there probably isn't that much a teacher could do wrong if you're just looking for the basics.
     
    Afterburner likes this.

Share This Page