Unofficial BTS 3.13 patch

I should mention that I do have the "workers don't change existing improvements" option set and the "workers don't chop forests" setting as well.

Then my guess is the workers refuse to replace your existing roads with railroads because you have this set.

They probably can't know for sure that railroads are strictly better than roads.
 
Railroads aren't (or shouldn't be) considered "improvements", so that shouldn't apply.

Bh
 
Then my guess is the workers refuse to replace your existing roads with railroads because you have this set.

I've had this option enabled since about a week after Vanilla was released. Believe me, it never affected railroading before 3.13. Besides, plenty of my roads did get upgraded to railroads, just not all of them.
 
Hmm, I am getting a crash on loading a savegame when using a modular XML mod. I got this crash when I tried to load a game I'd been playing before applying your patch, and thought "no big deal". But I started a new game with my mod and your patch last night and played a few hours, and this morning I crash trying to load it.

I don't have a debugger installed at home so I can't give a traceback, but perhaps a zip of the mod and the savegame?
 
Railroads aren't (or shouldn't be) considered "improvements", so that shouldn't apply.

Yep, automated workers will replace (at least some) roads with railroads regardless of the "Leave Old Improvements" settings. Back in an early vanilla Civ4 version this wasn't the case, but it was fixed in an early patch (can't remember exactly which one).
 
As I probably mentioned, I don't turn on full automate until I've completed all the improvements I care about. Then I just put the workers on auto after that to make useless roads and fix spy damage. Later build railroads and lumbermills.

I should mention that I do have the "workers don't change existing improvements" option set and the "workers don't chop forests" setting as well.

You might want to try the "Automate trade network" option then. Workers on this setting will build (and replace after destroyed) roads, railroads, and resource-related improvements, and this particular type of automation doesn't appear to be affected by the bug. I think this type of automation also results in Forts over resources that are not in any fat crosses (IMHO a good thing, but not everyone agrees), but I'm not positive about that. You won't get lumbermills this way though.

Of course this doesn't remove the issue, because as Todd Hawks said, the primary concern is how much it gimps the AI.
 
^^ But that setting doesn't repair improvements that have been bombed or sabotaged. Or are you saying that it does?
 
^^ But that setting doesn't repair improvements that have been bombed or sabotaged. Or are you saying that it does?

Yep, it does. I use it for that all the time. Same with newly discovered resources, like when oil appears at Sci Method... they're off building wells or forts on it. They dont' start on it until the next turn though---so I usually end up just overriding the automated workers and fixing it myself sooner, if I'm in a big hurry to get the improvement up and running. Is there a 1-turn wait with fully automated workers too? Since I've never been brave enough to click on the Full Automate button, I have no clue :).
 
Basically the solution for the player (who likes automation.. I do) is
have many workers on 'Automate' (to take care of improvements)
have some on 'Trade Network' to get those last bits of Railroad.
 
Actually, it does seem that if you leave 'em to it on fully automated, the workers do eventually get around to building railroads everywhere. It's just not as quick as when you keep on top of them. So I guess the AI's all right in the end, or at least not especially handicapped on this score. The workers just seem to be lazy, not utterly incompetent!
 
Is there any chance the game actually thinks corporation execs are military units that contribute to the powergraph? In my current Emperor game Mansa was thru the roof in power with mine absolutely piddly, yet when I've invaded him it's been a complete walkover, most of his cities 'defended' by 2 or 3 actual units and about 10 executives. This and insane rampant global warming every turn has pretty much ruined this game for me, so i'll be making some changes to the execs and global warming before playing again.
 
Actually, it does seem that if you leave 'em to it on fully automated, the workers do eventually get around to building railroads everywhere. It's just not as quick as when you keep on top of them. So I guess the AI's all right in the end, or at least not especially handicapped on this score. The workers just seem to be lazy, not utterly incompetent!

Well, it turns out that the "problem" is caused by a random check that it makes. The curious thing is that nothing about this check was changed from 3.02 -> 3.13 - did anyone see this bug in 3.02?

Basically, what happens is when a unit is "initialized", it is assigned a random number (they call it a "birthmark"). When it's deciding what an AI worker should do, it checks that "birthmark" to see if it's divisible evenly by 3. If it is, then the worker will start building railroads (assuming there's nothing better to do). If it's not divisible evenly by 3, then the worker won't try to build railroads. Which means the worker will idle.

I believe this was done deliberately to ensure that there were always AI workers on hand, if something needed building in a hurry. For example, if an AI pasture was destroyed, there would be a pool of AI workers ready to rebuild it immediately. However, I'm not sure that maintaining idle workers is preferable to having to wait a few turns before having one free to work on a new project. So unless there's any objections, I'll remove the "divisible by 3" check, so that all available workers (with nothing better to do, remember) will work on railroads.

I'm away until tomorrow morning, so the release won't be until then. Oh, and I'm still looking into the Executives situation.

Bh
 
Obviously, it would be best if the AI didn't need to let the workers idle in order to have them available for important orders, like restoring the nation's single quarry after a tornado smashed it for the thirteenth time. A human player would have the workers building railroads, then (in a situation like I described above) immediately reassign them to rebuild the quarry, and afterwards continue building railsroads. Is it possible for the AI to act similarly?

Btw, how is the AI programmed? Does it first prioritize possible actions, and then assign available workers to them, or does it loop over each worker and have him check what he could do?
 
Well, it turns out that the "problem" is caused by a random check that it makes. The curious thing is that nothing about this check was changed from 3.02 -> 3.13 - did anyone see this bug in 3.02?

Basically, what happens is when a unit is "initialized", it is assigned a random number (they call it a "birthmark"). When it's deciding what an AI worker should do, it checks that "birthmark" to see if it's divisible evenly by 3. If it is, then the worker will start building railroads (assuming there's nothing better to do). If it's not divisible evenly by 3, then the worker won't try to build railroads. Which means the worker will idle.

I believe this was done deliberately to ensure that there were always AI workers on hand, if something needed building in a hurry. For example, if an AI pasture was destroyed, there would be a pool of AI workers ready to rebuild it immediately. However, I'm not sure that maintaining idle workers is preferable to having to wait a few turns before having one free to work on a new project. So unless there's any objections, I'll remove the "divisible by 3" check, so that all available workers (with nothing better to do, remember) will work on railroads.

I'm away until tomorrow morning, so the release won't be until then. Oh, and I'm still looking into the Executives situation.

Bh

Maybe it is also there so that not every AI worker starts building railroads when they are invented. Maybe railroads have a high priority on the buildlist or something like that. Or maybe the worker code looks around in the neighbourhood for something to do and just after the invention of railroads, there are always non-railroaded squares in the neighbourhood so every worker starts building railroads without the 1/3-2/3 code (which would lead to neglection of other activities). Just guessing of course, but there must be some reason that they only let 1/3 of the workers work on railroads.

Can you change (update) the 'birthmark"? If you can, would the following pseudo-code work: If worker is idle and birthmark is not a multiple of three, then update worker birthmark to a multiple of three. Or in human speech, if you're part of the two thirds of the workers who aren't working on the railroads, but don't have anything better to do, then start working on those railroads.;)

Of course, if some terrain improvement was destroyed after all the workers started working on railroads, then maybe it wouldn't be repaired quickly. Maybe some other events could cause the 'birthmark' to be updated again to a number that is not a multiple of three. Say, bombing damage or random event damage or pillaging. (Of course, you don't want the worker getting stuck in an updating the 'birthmark' loop, but I don't think you'd do something like that.)
 
Obviously, it would be best if the AI didn't need to let the workers idle in order to have them available for important orders, like restoring the nation's single quarry after a tornado smashed it for the thirteenth time. A human player would have the workers building railroads, then (in a situation like I described above) immediately reassign them to rebuild the quarry, and afterwards continue building railsroads. Is it possible for the AI to act similarly?

Ok, they would do that - sort of. But what they wouldn't (or couldn't) do is stop what they are currently doing (ie, building railroads) and move to rebuild the quarry. What they'd do is finish whatever railroad they were working on, move to rebuild the quarry, then go back to building railroads. Personally I don't see anything wrong with that behaviour. It's certainly better than having 2/3rds of the workers (on average) idling.

Btw, how is the AI programmed? Does it first prioritize possible actions, and then assign available workers to them, or does it loop over each worker and have him check what he could do?

The latter.

Bh
 
Maybe it is also there so that not every AI worker starts building railroads when they are invented.

That wouldn't happen. The "build railroads" action is a pretty low priority for workers. If there is anything more important to do, they'll definitely do that. So you'd rarely have workers building railroads at the expense of something else.

Can you change (update) the 'birthmark"? If you can, would the following pseudo-code work: If worker is idle and birthmark is not a multiple of three, then update worker birthmark to a multiple of three. Or in human speech, if you're part of the two thirds of the workers who aren't working on the railroads, but don't have anything better to do, then start working on those railroads.;)

Pratically speaking, I don't think that would deviate from simply removing the div by 3 check. It would just delay it a single turn. I'm not sure that'd be useful.

Bh
 
The latter.Bh

I see. In that case, your change might even improve performance (for as long as railroads can be built). Does the AI perform the same checks for each and every idle worker, or does it leave the loop as soon as it encounters one worker who cannot find anything to do at all? Because if the former is true, then your change (which will greatly decrease the number of idle workers as long as railroads can be built) will reduce the number of workers to loop over in each turn.

I had hoped that the AI prioritized jobs to do and then assigned available workers to them, because then any "emergency rebuild" of a destroyed improvement would be relatively easy to implement (e.g. set a priority threshold; if a job on the list has a priority higher than the threshold, then find the nearby workers with the lowest priority on their current jobs, and reassign them). But if the AI isn't already set up this way, then implementing this would probably require a major rewrite (and it might not even work well in the end due to possible performance issues).

Anyway. I can see the merit in having a small "reserve" of idling workers as a task force which can fix things immediately when they break, but I don't think that this reserve needs to be 2/3 of the total number of workers. I'm not sure whether reducing the reserve to (say) 10% of workers is better than having no reserve ... might be another option to consider. But having no reserve should work well under most circumstances. When you have a sizeable workforce laying railroads, then the chance that *some* workers will become available for new tasks each turn (due to having finished their current orders) is very high anyways.
 
Well, it turns out that the "problem" is caused by a random check that it makes. The curious thing is that nothing about this check was changed from 3.02 -> 3.13 - did anyone see this bug in 3.02?

Basically, what happens is when a unit is "initialized", it is assigned a random number (they call it a "birthmark"). When it's deciding what an AI worker should do, it checks that "birthmark" to see if it's divisible evenly by 3. If it is, then the worker will start building railroads (assuming there's nothing better to do). If it's not divisible evenly by 3, then the worker won't try to build railroads. Which means the worker will idle.

Wow, this is hilarious! :lol: I agree with removing it.
 
That wouldn't happen. The "build railroads" action is a pretty low priority for workers. If there is anything more important to do, they'll definitely do that. So you'd rarely have workers building railroads at the expense of something else.

Ok, then I fully agree with you. The divisible by three code seems quite useless and counter productive. I don't think a reserve of workers is that valuable.
 
I have edited CIV4UnitInfos.xml (based on 3.13 patch). Maybe you would like to use it as a part of the "unofficial patch".
Changes:
- Added flank attack vs catapults and trebuchets to cuirassier, conquistador, cavalry, cossack
- Added flank attack vs catapults, trebuchets and cannons to gunship

[I don't know if it needs a little tweak, though. I have added flank attack always setting the following parameter in XML:
<iFlankingStrength>100</iFlankingStrength>
Perhaps this strength should be lowered in the flank attack bonus of Cavalry vs catapults (for example).]

It can be downloaded from:
http://forums.civfanatics.com/showthread.php?t=242149
 
Back
Top Bottom