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

Version 1.00 discussion thread

Discussion in 'Civ4 - Better AI' started by jdog5000, May 17, 2010.

  1. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Yes ... the AI is watching you. ;) Looking at power buildups by neighbors and reacting preemptively is a new capability for Civ AI, and the only way the AI could fend off early rushes.
     
  2. LunarMongoose

    LunarMongoose King

    Joined:
    Jan 29, 2006
    Messages:
    731
    Gender:
    Male
    Location:
    Boston, MA, USA
    That block of code you pointed out is indeed messed up - it looks like the author misunderstood the purpose of the vanilla code, and the fact that canAttack(*pDefender) already checks the combatLimit() situation. It should indeed be reverted; good find.

    HOWEVER. I am pretty sure that code is NOT responsible for the AI refusal to capture empty cities thing you guys are seeing. For one thing, it is inside an "if (bAttack)" block (as your code quote showed), which means it won't even apply unless there was something there to attack ie not an empty city. Secondarily, if the problem were with CvUnit::canMoveInto() then it would be causing the same problem for human players as well, but I suspect if that were the case people would've been more upset than they were.

    JDog mentioned a possible cause with a line in AI_pickTargetCity() in his response before he poofed on us again which is in his 1.02a files on SF, so I would strongly recommend giving that a try as it would explain why it's an AI-only problem.

    I couldn't reproduce this problem 3 weeks ago btw (which I made a post about), and I still can't after trying again just now - both with JDog's current code, and with his line reverted. So I'm not sure I can help much heh.
     
  3. Maniac

    Maniac Apolyton Sage

    Joined:
    Nov 27, 2004
    Messages:
    5,588
    Location:
    Gent, Belgium
    The problem DID get solved when I reverted that code.

    Checks for a valid attack move are made in cases besides there being an enemy unit on the plot. Unfortunately I don't remember the call stack which leads to the problem.

    Regarding human players not encountering this, that would be explained by the AI never leaving cities empty.
     
  4. LunarMongoose

    LunarMongoose King

    Joined:
    Jan 29, 2006
    Messages:
    731
    Gender:
    Male
    Location:
    Boston, MA, USA
    Awesome, I don't have to worry about this any more then! Thanks dood. :) :) :)

    Those other cases still pass in a true value for bAttack though? Odd...

    Well, you could have a helicopter or something that can't capture cities, that is owned by you, an ally also attacking the same city, or by the barbarians, that takes out the last defender and leaves the city open for part of a turn.
     
  5. algieba

    algieba Chieftain

    Joined:
    Dec 23, 2010
    Messages:
    5
    sorry! mixed up the threads
     

Share This Page