Unofficial BTS 3.13 patch

If you want a limit, it's an easy fix. Check post #336.

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.
 
I think there is a small problem with the latest versions of the dll. The specialists page in the civilipedia shows a blank page for each of the specialists. It shows the picture of the specialist, but nothing else. v1.07 of the dll is fine. I don't have a copy of 1.08 or 1.09 to check if they were ok, but v1.10 and v1.105 both have the problem with the specialists page.

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
 
@jkp1187 & Roland Johansen:
Corporation Spread Cost scales with inflation so you might have different numbers in mind from looking at different times...

Regarding the spread factor, its determined by the corporationspread factor in civ4unitinfos.xml. The code itself does not seem to discriminate between buyout and spreading to city that has no competing corp, but it should not be too difficult to add such a check, look for
CvUnit::spreadCorporationCost
and
CvUnit::spreadCorporation
for the code :)
But this is going way offtopic since I don't believe this will make it into this great project, so I'll refrain from derailing this thread even more ;)

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?
 
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)
 
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
 
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

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.
 
Been playing with the 1.105 fix for several hours but suddently the game is haging at end of turn (Waiting for other Civilizations...).

I killed the game process and reloaded three time with the same happening at end of turn. If I revert to the original CvGameCoreDLL.dll and end the turn it proceeds as normal.

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
 
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
 
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
 
Grrr. If this keeps up, I'll spend more time fixing bugs I introduced instead of bugs native to 3.13.
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 :)
 
How do you judge whether it's more valuable to rush a building or spread a corporation?

Bh

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.
 
With that set up, the two warriors will correctly move A->C->O in a single turn. Or so they did when I set that scenario up.

Bh

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).
 
Yeah, I hear ya, but it'd be cool if the algorithm could check whether it's possible for the units to end up at the destination tile together, not necessarily walking hand in hand. I suppose there could be complications, though, when passing through a fog of war with possible enemy combatants.

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 :).
 
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
 
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?
 
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?

Not enough money.

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

I like this idea. Too bad its not an option in handicap.xml
 
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. :)
 
I tried out the latest version 1.105ish and it crashed my Beyondthesnore game. I had to revert back to the old one.
 
Well here's to opening up a whole can of worms. :beer:
Colonies get all techs their masters have, regardless of how he got them. They can also trade them all away as if they researched it themselves, even if their master didn't. Personally, I think all colony techs should be considered traded (and therefore not tradeable under no technology brokering), ...

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.
 
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.
 
Top Bottom