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

Unofficial BTS 3.13 patch

Discussion in 'Civ4 - General Discussions' started by Bhruic, Oct 5, 2007.

  1. Quagga

    Quagga Former Dictator

    Joined:
    Aug 31, 2006
    Messages:
    663
    Location:
    Li'l Rhody
    Done.

    I notice in the XML that there's iInstanceCostModifier, set to 0. I don't know what this does, but the naming suggests to me that it might be a cost that increases for multiple instances of a unit. Perhaps this could be exploited to reduce corporate executive garrisons instead of taking the hard limit approach.
     
  2. Bhruic

    Bhruic Chieftain

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    Good eye. This is what happens when I get lazy and don't follow through on fixes. :(

    I should have that fixed for the next version.

    Bh
     
  3. jkp1187

    jkp1187 Unindicted Co-Conspirator

    Joined:
    Aug 29, 2004
    Messages:
    2,496
    Location:
    Pittsburgh, Pennsylvania
    Thanks, ori!

    If I get some time to play around with this tonight, I will. (In the interests of not hijacking Bhruic's thread any more, I'll post in a new thread....)

    EDIT: Just so I'm clear, by "Spread factor" are you referring to the % chance of failure? Or the cost of spreading the corp?
     
  4. KrikkitTwo

    KrikkitTwo Immortal

    Joined:
    Apr 3, 2004
    Messages:
    12,316
    On the corporate executives,
    The problem is probably limited to the AI rushing, there is no check about the rush cost relative to the AI's target gold.. just the current gold.

    This means the AI can use up all of its gold one city at a time throughout its empire. If the check was against the target gold as opposed to the current gold, the AI would maintain a certain amount in the bank (for upgrades+corporate expenditures)
     
  5. Bhruic

    Bhruic Chieftain

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    It is most likely possible to force the AI to reserve the gold for the executives (incidently, it's not just rush buying that's causing problems, I did try reserving gold, but then the AI spent it on unit upgrades). I've been reluctant to do that. The problem with forcing it to reserve gold for executives is it makes the assumption that spreading a corporation is preferable to rushing/upgrading. And that's an entirely situational call. I can think of dozens of scenarios where rushing/upgrading is the preferable choice to make. So the solution can't simply be "always reserve gold for executives". That means we have to get into valuation, which is where the real difficulty starts. How do you judge whether it's more valuable to rush a building or spread a corporation?

    Bh
     
  6. Roland Johansen

    Roland Johansen Chieftain

    Joined:
    Apr 29, 2003
    Messages:
    4,292
    Location:
    the Netherlands
    Ah, the way I had understood it, there was little hope to program the AI to reserve money for executives. I understand your reluctance to do that as it could result in worse AI behaviour.
    Maybe we can come up with some relatively smart guidelines for the AI. We can criticise eachothers guidelines until they are somewhat reasonable. We don't have to go for perfection, just something that works reasonable and isn't too complicated. The more complicated the guidelines, the more likely there is some loophole we forget about.

    The most expensive part of spreading a corporation domestically is the investment of hammers in the corporate executive. If you spend that many hammers into something, then you should get something back for it. So whenever the AI decides to build an executive, then it should be used as quickly as possible. Whenever the decision is made to build an executive, the decision to actually use the executive and thus reserve money to use the executive should be implicit. If you don't plan to reserve money for the executive, then you shouldn't even build it.

    Ok, here is a very crude and simple guideline which is open for criticism:

    AI is at peace:
    Rule 1: Only build executives as long as you have less than 5 available or in production (set the AI corporate unit cap at 5 for all of its combined executives).
    Rule 2: calculate the value of creating a corporate office:
    value (domestic office) = Food*3 + hammer*2 + commerce (gold or science)*1 + culture/3 + 8 (if you have the headquarters) - (value already present competing corporate office +5)
    value (foreign office) = 8 (if you have the headquarters and no other competing corporate office of which you have the headquarters exists)

    Value domestic is calculated when number of executives build and under construction is smaller or equal to the number of domestic cities without the corporate office. Otherwise it is 0. Value foreign is calculated if there is a foreign city to which the corporation can be spread.

    Generate a random number between 5 and 20. When this number is smaller than the value of the corporate office (foreign or domestic), then build an executive.
    Or use this value in another way to see whether it is desirable to create a corporate executive or build something else. Other constructions are probably also valued in some way.

    Rule 3: Reserve enough money to create a number of corporate offices equal to the number of executives available. The amount of money needed is dependent on the whether the corporations should be spread domestically or foreign and whether another competing corporation is present, so ideally the corporate executive should be build with a predetermined use. (just like units are often created with offensive or defensive purposes) That way the cost of their use could be calculated and the correct amount of money could be reserved.

    When at war:
    When losing don't build executives.
    When winning:
    Rule 1 with a cap of 2 instead of 5.
    Rule 2 with a random number between 15 and 50 instead of 5 and 20.
    Rule 3 with the exception if a city is under threat of capture and cash rushing a unit or upgrading a unit in the city is possible.


    Ok, it must be apparent that I don't know how the code looks like. Still, it might spark some thoughts among others and might be a stepping stone.
    The main point is that if you decide to build the executive, then you should use it since the hammer investment is the largest investment in creating a corporate office. Whenever you decide to create a corporate executive the value of the corporate office should be such that you're willing to reserve money for it.
     
  7. Bhruic

    Bhruic Chieftain

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    Grrr. If this keeps up, I'll spend more time fixing bugs I introduced instead of bugs native to 3.13.

    I've got to stop assuming that stop that has no obvious purpose actually has no purpose. Oh well, at least I figured out what was causing the problem (and rectified it - next release).

    Bh
     
  8. KrikkitTwo

    KrikkitTwo Immortal

    Joined:
    Apr 3, 2004
    Messages:
    12,316
    Well upgrading shouldn't be too much a problem... from my limited undestanding, the AI's "Gold target" includes

    1. Unit upgrades (for all units it has to upgrade) [1/2 in peace time]
    2. a Basic amount (based on cities, population, and game turn)
    3. amount required to spread a corporation*2
    * the whole value is reduced by 3 if a tech is almost done and the gold can fund deficit research

    So if it has units to upgrade, it will try to save enough to upgrade them all
    If it has a corporation present it will try to save enough

    Any of Unit Upgrade, Corporate spread or Rush buying are all used without a gold limit so turn order determines which happens first.

    I'd suggest
    Rush buy limited to not taking the gold below some fraction of Target gold say '1/2' (except in 'essential'/'rush being really important' type cases)

    and somehow prevent the AI from upgrading below the cost to spread a corporation if corporate executives present are greater than 1


    Finally, for fixing the symptoms just strengthen the fix you already have... make the value of building an executive
    1. Divide by (1+ (Number of executives already present) Squared)

    instead of the divide by 2, divide by 5 issue

    So the more executives the AI has the less likely it will build more
     
  9. kniteowl

    kniteowl Pirate Captain :P

    Joined:
    Dec 27, 2005
    Messages:
    1,269
    Location:
    NZ
    the Executive problem has left me confused lol... Why not allow the AI to spread corporations at a cheaper price, would that help? It'd be similar to how the AI is allowed cheaper unit upgrades.

    It's kind of them middle ground between zero cost Corp spreading and changing AI behaviour of corp spreading
     
  10. Innocence

    Innocence Chieftain

    Joined:
    Oct 7, 2003
    Messages:
    63
    Don't be so harsh on yourself Bhruic - "can't make an omlet..." and all that :)

    Thanks for checking it out. Looking forward to next release :)
     
  11. Aquatic

    Aquatic Child of Surprises

    Joined:
    Dec 17, 2005
    Messages:
    91
    Without prejudice to any of the suggestions already made, one way to cut this particular Gordian knot may be to set up an 'alternating' system. The AI could say to itself something like:
    'If I have an executive available;
    and if I did not spread a corporation last turn;
    then this turn I will spread a corporation as opposed to rushing a building.'
    This would at least ensure that, after all the checks have been made whether or not to build an executive in the first place, the executives get used.
    Some of the things already suggested could even combine with this. I offer it only as possible strategy, one way of thinking around the issue.
     
  12. jray

    jray Chieftain

    Joined:
    Jan 31, 2006
    Messages:
    925
    Location:
    North Carolina (USA)
    Thanks for checking. Maybe it's situational and I forgot the exact details of the tiles... I'll let you know if I can reproduce it (and post a savegame file if so).
     
  13. jray

    jray Chieftain

    Joined:
    Jan 31, 2006
    Messages:
    925
    Location:
    North Carolina (USA)
    Just to add a comment to this earlier post of mine, in the example I encountered it was actually possible for all the units to walk hand in hand to the destination, as long as they used the road. The Woodsman 3 Warrior just got excited and went for the shortcut through the virgin forest, stranding everyone else there :).
     
  14. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    Bhruic,

    Have you thought about working this into the World of Civilization project?

    The WoC is a 'universal' standard for modding that can be used with the DLL by itself or as the foundation of any mod that wants TRUE modular loading.

    Check this out and/or send me a PM, http://forums.civfanatics.com/showthread.php?t=247968
     
  15. 50_dollar_bag

    50_dollar_bag Imitation Louis Vuitton

    Joined:
    Jun 13, 2005
    Messages:
    977
    Location:
    36 52 S 174 45 E
    I haven't read all the discussion on the executive problem, but can't you just impose a limit on how many executives the AI can build but let the Human build infinite? Or is the main problem the AI never having enough money to spread them?
     
  16. jpinard

    jpinard Martian

    Joined:
    Jan 18, 2002
    Messages:
    760
    Location:
    Enceladus, Saturn
    Not enough money.

    I like this idea. Too bad its not an option in handicap.xml
     
  17. Dagta

    Dagta Chieftain

    Joined:
    Jun 26, 2006
    Messages:
    97
    I think I found a bug in the latest version of the unofficial patch.

    When you build a Recycling Center in your city, buildings that produce unhealthiness (such as Drydock) still list the unhealthiness influence even with the Recycling Center present in the city.

    Thanks for all of your work, Bhruic! It's appreciated. :)
     
  18. Grump

    Grump Chieftain

    Joined:
    Oct 7, 2006
    Messages:
    100
    I tried out the latest version 1.105ish and it crashed my Beyondthesnore game. I had to revert back to the old one.
     
  19. _alphaBeta_

    _alphaBeta_ Chieftain

    Joined:
    Dec 28, 2005
    Messages:
    976
    Location:
    NJ, USA
    Well here's to opening up a whole can of worms. :beer:
    If indeed colonies can trade techs like they researched them by themselves, thus exempt from no tech brokering, I think this should be fixed. I agree with this poster. If I'm going through the trouble of playing a "no tech brokering" game, why would I want my colony to give away all my tech? If you like that idea, then you can play with unrestricted tech trading and turn those options off. I would personally like the option.
     
  20. oedali

    oedali Chieftain

    Joined:
    Apr 6, 2007
    Messages:
    840
    Gender:
    Male
    Location:
    Washington, DC
    I always play with the No Tech Brokering option and agree that this needs fixing. I think there's 2 parts to this:

    1. Techs inherited by the colony that the master traded for and can't trade - the colony should absolutely NOT be allowed to trade these away, this is a serious bug and I think most would agree.

    2. Techs inherited by the colony that the master researched and can trade - in this case my opinion is that the colony still should NOT be allowed to trade the techs, since essentially the master "traded" them to the vassal after the colony spun off.
     

Share This Page