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 0.81 Discussion Thread

Discussion in 'Civ4 - Better AI' started by jdog5000, Sep 20, 2009.

  1. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    (You can always get the latest stable release from the download thread or sourceforge. Development versions and updated source code can also be checked out from sourceforge.)

    The main focus of this release was on reducing turn times to speed up the mod. Many thanks to stmartin and the other behind the CAR mod and those who contributed to the discussion on profiling the DLL! The most significant time saving aspects of CAR were brought over or adapted, including the plot danger cache system and the attitude value cache system. In addition, the BBAI system for transports to retrieve stranded units is now massively more efficient. Large maps with many civs should be much more palatable in this version.

    Beyond efficiency, there are a lot of BtS and BBAI bugs and issues fixed in this version. Unofficial Patch 1.2 is included of course. In addition, a new era-based tech cost scaling system is included to allow easy rebalancing of tech pace. A hidden bonus where AI's would have their unit maintenance costs reduced by their number of cities after meeting the human player has also been removed in lieu of handicap adjustments for army size at this point.

    Specific desired feedback:
    - Game speed: Is the mod fast enough? If you experience really long turn times, please post a save.
    - Tech rate: Do you and the AIs get to the modern era too early or too late? Does spaceship victory timing seem right?

    Enjoy!

    New in Better BTS AI 0.81
    Spoiler :

    Added Unofficial Patch 1.2

    Bugfix
    - Fixed rare issue (introduced) with assault transports causing endless turns
    - Fixed bug (introduced) causing assault transports to oscillate in and out of cities under certain circumstances
    - Fixed bug causing AI to build only half as many workers as it wanted, then build too many under rare circumstances

    AI bonuses
    - Removed a hidden AI bonus for extra support free troops which favored larger empires

    Efficiency
    - Most calls to CvPlayerAI::AI_getPlotDanger really just need boolean, added new CvPlayerAI::AI_getAnyPlotDanger which is faster
    - New cache system for CvPlayerAI::AI_getAnyPlotDanger and CvPlayerAI::AI_getPlotDanger for plots verified safe or plots known to be border plots
    - Improved efficiency and reduced usage of costly new functions, CvPlot::isHasPathToEnemyCity and CvPlot::isHasPathToPlayerCity
    - Added CvSelectionGroup::isHasPathToAreaPlayerCity and CvSelectionGroup::isHasPathToAreaEnemyCity, faster versions of prior plot-based functions
    - Stranded status for groups is now cached
    - Small speed up for earlier rejection of paths to cities/plots in other land areas
    - Re-ordered sections in pathValid to reduce expensive calls
    - Greatly increased efficiency of BBAI function CvUnitAI::AI_assaultSeaReinforce
    - Adapted the getAttitudeVal cache system from CAR, significant turn time improvement on maps with many players

    War strategy AI
    - AI now considers whether team they're planning war against is already engaged, speeds up planning phase if that's the case

    War tactics AI
    - AI a little more selective about sending attack units after barb cities
    - AI more likely to raze barb cities far from its empire

    Tech Diffusion
    - Added new era-based tech cost modifier to re-pace tech progress

    Customization
    - Added iTechCostModifier to CIV4EraInfos.xml, allowing easy per era scaling of tech costs

    Unit AI
    - Improved AI_protect with a max path length designator and weighting by path length
    - Stranded units with no useful actions to take now check whether to load into transports, fixing issue with picking up stranded units in foreign cities

    Naval AI
    - Improved and fixed bugs in blockade breaking code (still needs to be better though ...)
    - Greatly reduced chances for naval vessels to sail en masse around entire continents to deal with single enemy ship
    - Transports will no longer consider switching unit types when they happen to be in someone else's city
    - Fixed issue with picking up units stranded in foreign cities

    Settler AI
    - Fixed issue where transport mostly full of workers would idle infinitely unsuccessfully trying to pick up a settler
    - When units are dropped off in new lands with settlers, they will now stay with the settler instead of often leaving, then returning to the new city after it's undefended for a turn

    Barbarian AI
    - Barb now more likely to send out small naval invasion fleet if it has one (happens on Terra maps now sometimes ...)
    - Barb attack city stacks will now attack colonists much more readily (mostly on Terra maps)
    - Barb cities now build more attack units, especially when in danger or when colonists are invading the new world
    - Barb cities much less zealous about building workers


    (EDIT: Also, the reported crash bug in multi-player games should be fixed)
     
  2. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    great. love u. :D
     
  3. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    There's a bug in 0.81 which causes a crash if all civ slots are full ... will have a fix up shortly.
     
  4. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Okay, the new version 0.81M which has the bug fixed. Sourcecode in the download has also been updated.
     
  5. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    Great, thank you jdog! :hatsoff:
     
  6. MaxCiv

    MaxCiv Chieftain

    Joined:
    Apr 7, 2006
    Messages:
    111
    Location:
    Ottawa - Canada
    Amazing job as usual Jdog! Thanks for all the hard work you put into this.
     
  7. Roland Johansen

    Roland Johansen Chieftain

    Joined:
    Apr 29, 2003
    Messages:
    4,292
    Location:
    the Netherlands
    I'm glad that you tackled the big problem of transporting units over the ocean. There are all kinds of problems with teaching the AI to do this in a smart way and thus it's a hard problem, but it's also a very important problem, so I'm glad that you've focusses on it during several updates. The recent worker production bug is also a good fix.

    As always, well done!
     
  8. Yakk

    Yakk Cheftan

    Joined:
    Mar 6, 2006
    Messages:
    1,288
    Minor issue -- there are a few XML files that are pretty similar to the originals.

    You can use modular XML loading to make things "tidier", only including the units that you change in the mod.
     
  9. MartinHarper

    MartinHarper Chieftain

    Joined:
    Feb 16, 2009
    Messages:
    132
    I was surprised that you set TECH_COST_FIRST_KNOWN_PREREQ_MODIFIER back to 20. I was expecting it to go to zero.

    Is iTechCostModifier a percentage increase/decrease?
     
  10. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Forgot to update the source code zip when reposting 0.81M ... the download has been updated, but the one important changed file is attached here to make life easier. Only needed if you're merging BBAI into your own mod.

    View attachment CvGame.zip


    I still might set that to 0 ... the new era system for slowing down tech rate is a much better solution for what initially led me to lower the first known prereq value. Now, to drop the first known prereq modifier to 0, tech rates would have to be boosted 20% across the board to keep the pace right.

    The 20% off tech thing is still illogical, but the fix (without changing all tech costs ...) is too complex. Still thinking ...
     
  11. tscolin

    tscolin Chieftain

    Joined:
    Sep 28, 2009
    Messages:
    4
    I'm getting about a thousand of these errors when i load next war. Vanilla next war mod that is, 3.19. Using bts better ai 0.81M, copied into base /assets. Steam version of civ 4 & bts, I don't know if that makes a difference.



     
  12. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Ahhh, of course ... Next War must have its own era definitions, so the newly added era field BBAI is looking for is not there. This should be easy to fix.
     
  13. tscolin

    tscolin Chieftain

    Joined:
    Sep 28, 2009
    Messages:
    4
    You're the best!
     
  14. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    tscolin:

    Please try out the following fix and let me know how it goes! In XML/GameInfo/CIV4GameInfoSchema.xml, find the following line:

    Code:
    		<!-- BBAI start: effectively modify cost for all techs from an era. -->
    		<element type="iTechCostModifier"/>
    		<!-- BBAI end -->
    
    and change it to read:

    Code:
    		<!-- BBAI start: effectively modify cost for all techs from an era. -->
    		<element type="iTechCostModifier" minOccurs="0" maxOccurs="*"/>
    		<!-- BBAI end -->
    
     
  15. tscolin

    tscolin Chieftain

    Joined:
    Sep 28, 2009
    Messages:
    4
    That seems to have done it. Loads game without errors. loads mod without errors. loads savegame without errors, and ran a few turns, with no errors.

    It Goes threw late late game turns a lot faster!

    Works great! Thanks!
     
  16. TopDog

    TopDog Chieftain

    Joined:
    Aug 27, 2005
    Messages:
    431
    Location:
    Auckland, New Zealand
    xoxoxoxo
     
  17. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California

Share This Page