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

AI suggestions thread

Discussion in 'Civ4 - Community Enchancement Project' started by The Great Apple, Apr 19, 2006.

  1. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    I posted a thread up on the Stratagy and Tips forum about the current AI and ways to improve it.

    Not very many responses so far, although one of them points out quite a few minor flaws with the current AI which have quite far-reaching overall effects.

    Personally, I think 1), 2), 6), and 8) should be fairly easy fixes, with 7) only being slightly tougher. Anybody want to have a go?

    I also disagree with 9) myself - I think the AI's should have their personalities, and it adds quite a bit to the game.
     
  2. Chalid

    Chalid Black Dragon

    Joined:
    Nov 24, 2005
    Messages:
    1,742
    Location:
    Munich, Germany
    I think the AI can be improvend by far without actually changing it. There are just a lot of small changes where each one would bring great improvement.

    Example: Victory Conditions
    I have not yet found code that tells AI to archive a victory condition. But it should be relative simple to do so. The Ai has to decide which one or two Victory conditions it wants to archive (relative easy), and as result of this decision i believe there would be realtive small changes needed:
    - For culture 4 cities should get a flag that lets them prefer culture producing buildings, and increase their defense. Furthermore spare commerce should be convertet to culture with the slider at one point.
    - At space race it is already competeteive so there we would not need to do much.
    - For Conquest and Domination the affinity to make peace when the war goes well, has to be decreased, the AI_MILITARY weight must be a bit increased and the war threshold must be reduced.
    - Diplomatic hmm thats maybe more difficult, but some minor changes in the Diplomatic AI should do the trick.

    All of those are rather small changes but i'am quite sure that when well done they will do the trick. Especially as not every AI has to really archive one Victory condition, its enough to exert pressure on the player when only one or two of the many AIs in each Game make a good rush towards the Victory.

    Promotions: i'm working on this as there are some strange things... for example a Archer on a hill inside a city won't promote Gurillia.

    Now to comment the post above:
    1) Might be silly but sometimes not (keyword: coastal bombardement)
    2) Is dependend on the Values each improvement gets assigned. I might revise that one.

    4) & 5) Seems quite important on me. on the other hand, the ai often suicides units that sit in a city against a huge stack of doom. I think there have to be done several adjustmenst in this area.

    6) Could not veryfy that up to date, but might be corrected when i revise the improvements.
     
  3. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    Agree with victory conditions and promotions - needs to be sorted.

    I hadn't considered coastal bombardment, however surely the benifits of all those extra improvements you can get by the sea outweighs that? Hmmm.

    The unit AI seems to me to be one of the more complicated parts of the AI, as well as being one of the most critical, and time-intesnsive. It's also sometimes quite hard to define what is "better" with the it.

    I've been trying to put together a ruudimentry AI testing rig with limited success. I've managed to get the AI to play itself, with logging of the relative scores and powers. Next step is to see if I can get the game to restart after each test run - slightly more tricky!. The method I'm using to separate the AIs is also very crude, leaving the functions of the first half of the AI's alone whle changing the second half's functions.
     
  4. dsplaisted

    dsplaisted Chieftain

    Joined:
    Oct 4, 2005
    Messages:
    52
    I am working on a system for pluggable AI's, so you will be able to override whatever functions you want and choose for each player which AI you want to use. How are you determining which logic to use? Are you saying you are doing "if (playerID < (numPlayers / 2))" or something?

    Daniel
     
  5. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    Pretty much. Actually I'm using "if (playerID < ((numPlayers + 1) / 2))" with the human taking up the zero slot, but this may be just because that's the way I've implemented it.
     
  6. Chalid

    Chalid Black Dragon

    Joined:
    Nov 24, 2005
    Messages:
    1,742
    Location:
    Munich, Germany
    Do you use mirror maps and kind of mirrored leaders to test your AIs? That might be the best choice as you minimize Map and Leaderheadeffects, but generate a realistic surrounding.
     
  7. dsplaisted

    dsplaisted Chieftain

    Joined:
    Oct 4, 2005
    Messages:
    52
    I had the idea that the barbarians / animals took up the zero slot, but I don't think I actually saw it in the code, so that might not be right.

    Anyway, I wish I had more time to work on Civ 4 :) Hopefully I'll have some part of my AI framework out within a week.

    Daniel
     
  8. Chalid

    Chalid Black Dragon

    Joined:
    Nov 24, 2005
    Messages:
    1,742
    Location:
    Munich, Germany
    Barbarians are Slot 18, Player is Slot 0. Found that out during my testing on the promotions...
     
  9. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    I was going to try and crack the auto-restarting before I did this - I might just leave it to dsplaisted, as I'm not going to be able to do much work at all in the 9 week period starting Saturday (no compiler/Civ access)
     
  10. dsplaisted

    dsplaisted Chieftain

    Joined:
    Oct 4, 2005
    Messages:
    52
    :eek: :eek: Ouch! Nine weeks! What's going on? I'm going to Brazil for two weeks in about a week, and I thought that was bad :)

    Daniel
     
  11. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    I'm off back to university. I can't take my PC with me - it's far to big and bulky to transport - and besides, I won't really have much spare time anyway.
     
  12. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    About the AI framework:

    What would be ideal is if it were possible to run, say, 100 full game tests, where the AIs would play against each other on a well balanced (maybe mirrored) map, with random Civs, the results being recorded in a file without any user interaction required. This would give alot better indication of whether the new AI was better or worse in direct comparison to the old.

    Of course, we'd be designing AI's to beat AI's, which might all collapse in a horrible mess as soon as an unpredictable human comes along, so human testing would have to be a neccesity... but it would at least give a good indication.
     
  13. Padmewan

    Padmewan Chieftain

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    How is this coming along? As you all know, I've been prying into (more accurately, asking all of you to pry into) AI behaviors and was wondering if the goal at this point is to (a) optimize AI for vanilla or (b) optimize it to be "smart" under different mod conditions.

    Obviously AI is the "final layer" of any other mod that adds more game functionality. If we enable civics to have more effects, the AI needs to account for those effects.

    I've now learned that the AI is very delicately balanced and presumes a certain heirarchy of programming. For example, improvements are built based on "natural" values, and civic selections made on the basis of what improvements exist. This makes the AI blind to civic-adjusted improvement values, but also prevents it from digging itself into a hole where the more improvements it has, the more it likes the civic, and the more improvements it builds, etc... All of this is to say, sometimes making the AI only halfway smarter would actually be worse than leaving it stupid.

    OK, well none of this was actually work, just idle chatter...
     
  14. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    The AI is one of the things I'll start work on when I get back from uni. I'm not sure anybody else is doing anything on it at the moment.
     

Share This Page