Bug Reports and Technical Issues

Congress allowed me to build Kamarunstadt (in the SE position) in Africa. However, it already existed in the NW-position, leading to a conflict with myself that I had to accept.

Spoiler TXT_KEY_CONGRESS_DEMAND_PLOT :
Civ4ScreenShot0237.JPG
Tell me if you need a savegame for either of my problems today :)
 
A save for the congress issue would help.
 
A save for the congress issue would help.
Okay then.

Next turn, the congress should give you the option to demand Kamarunstadt which already exists; I was able to replicate the issue from this file.

Edit: You might also want to look at France deciding NOT to use their settler in the Carribean in that savegame. I found that weird.
 

Attachments

Last edited:
Hello,
I encountered a few bugs with the resurrection on the release version of the mod (using linux+wine6.5, i also installed all the module proposed by the installer). I'll give a description of when it happens in-game, what i have gathered on the problems and the workaround i applied. I'll name the bug 1,2 (Bug 2 is exactly the one encountered here) and 3 and give the log and the save the turn before the problem happens.

Playing China (no civilization switch) on the 3000BC scenario on marathon speed, after a collapse the viking civilization resurrect itself turn 871 as its cities kept were all independent at the time. Bug 1 happens and stop the resurrection limiting the viking to the city of Copenhagen.

Bug 1:
In the function doResurrection of Stability.py :
  • A list of units to flip lFlippedUnits or relocate lRelocatedUnits is made by the call of flipOrRelocateGarrison including units inside the city.
  • When completeCityFlip is called bFlipUnits is true
  • In completeCityFlip when flipUnitsInCityBefore is called some units are killed
  • After the city flip flipOrRelocateGarrison tries to flip unit that were already destroyed by the flip.
I tried two workaround to correct this bug first to set bFlipUnits to false here in check resurrection
Code:
       if pOwner.isBarbarian() or pOwner.isMinorCiv(): #1591 stability.py
           #completeCityFlip(city, iPlayer, iOwner, 100, False, True, True, True) #original
           completeCityFlip(city, iPlayer, iOwner, 100, False, True, True)
       else:
           completeCityFlip(city, iPlayer, iOwner, 75, False, True, True)
Then after failing to correct the bug by changing RFCUtils.py to its version as of commit f8ee4ba2083c4b33cfdfc74cfda2bf9980f78c0c (as commit on the file showed bugfixes where made for unit manipulation) i commented the lines responsible for removing units in flipUnitsInCityBefore
Code:
def flipUnitsInCityBefore(tCityPlot, iNewOwner, iOldOwner): #123 RFCUtils.py
   plotUnits = units.at(tCityPlot).owner(iOldOwner)

   flippingUnits = plotUnits.where(lambda unit: not is_minor(unit) or (not unit.isAnimal() and not unit.isFound()))
   #removedUnits = plotUnits.where(lambda unit: not unit.isCargo()

   data.lFlippingUnits = [unit.getUnitType() for unit in flippingUnits]

   #for unit in removedUnits:
       #unit.kill(False, -1)
I didn't try to modify flipOrRelocateGarrison as not handling the garrison here seems to lead to unwanted behavior for the flip of a civilization owned by a major civ, the true solution i tried to implement was to filter the garrison from the lFlippedUnits just before the flip by comparing unit and city location like this :
Code:
       if pOwner.isBarbarian() or pOwner.isMinorCiv(): #1591 stability.py
           filter(lamdba unit : location(unit) != location(city),lFlippedUnits)
           completeCityFlip(city, iPlayer, iOwner, 100, False, True, True, True) #original
It didn't work, but i tested under the hypothesis that only lFlippedUnits would be of importance and filtering lRelocatedUnits may allow to stop the exception from happening.

Bug 2:
Already reported here changing RFCUtils.py and corrected in the git version (as of commit f8ee4ba2083c4b33cfdfc74cfda2bf9980f78c0c, no new exception were introduced for this resurrection as i tried to change just completeCityFlip and the whole file)

Bug 3:
Still in doResurrection of Stability.py :
  • When trying to add former colonies, the check to insure that cities in lCityList are not in the list does not actually work and cities added in getResurrectionCities are added again
  • The script do its work until it encounter one of the duplicate city, as the city flip invalidated the city an exception is thrown when calling city.isCapital()
I worked around this problem by applying the following modification to the loop.
Code:
    lCityLocation = [location(city) for city in lCityList] #1560 added
   # add former colonies that are still free
   for city in players.minor().alive().cities().where(lambda city: city.getOriginalOwner() == iPlayer):
       if pPlayer.getSettlerValue(city.getX(), city.getY()) >= 90:
           #if city not in lCityList: #original
           if location(city) not in lCityLocation:
               lCityList.append(city)
AFAIK this could work as a fix to this bug.

Hoping this is as useful as can be.
 

Attachments

tiny civilopedia description error:
The description of Burj Dubai reads something like "desert plots of the city get at least 2 food / 2 currency".
Can be fixed to the actual effect: "desert plots of the city get additional 2 food / 2 currency."
 
The description is correct. That is what it is intended to be. If the game behaves differently, than the code is wrong, not the description.

Do you have an example when this happens? From my experience it works fine.
(EDIT: I just checked it again and it still seems fine to me.)
 
Last edited:
This is probably my own fault, from moving the various barbarian and independent cities (in this case Iuliomagus) left and right before the European civilisations spawned, but, the log tells me to report the bug, so here I am:
upload_2021-4-4_13-35-45.png

I play without a cap on the experience units maintain upon promotion*, without tech trading, with random seeds, and so in order to load this savegame you'll probably need the 'GlobalDefines' and 'RFC 3000 BC' that I attached, together with the autosave.

Obviously, given that I as such play a modified version of the latest Git update, you are entirely free to ignore this - I'm just doing what the log tells me to do.

*Though apparently I did this wrong, and every unit loses all experience and all promotions upon promoting? How could that be a result of setting 'MAX_EXPERIENCE_AFTER_UPGRADE' to '999'?
 

Attachments

Last edited:
The description is correct. That is what it is intended to be. If the game behaves differently, than the code is wrong, not the description.

Do you have an example when this happens? From my experience it works fine.
My gem hills in southern Africa got +2 currency, I'm pretty certain. The description would have me expecting no additional currency.

Also, Windmill desert hills yield 3 Food, 2 Hammers, 5 Currency: Civ4ScreenShot0249.JPG
I mean, investing 2000 Hammers (3 great engineers and change) still means that you invested a lot of buck into not enough bang, but it's supposed to be even weaker?
 
I did some test and bonus food and currency is given if the plot without improvement is under 2 food or currency. I think it is what is meant by the at least +2 food,+2currency for instance a test with a corn farm only gave my +1 food as the tile already made one food. For the mine, was the gem always there or was it a discovery from mining ?
 
My gem hills in southern Africa got +2 currency, I'm pretty certain. The description would have me expecting no additional currency.

Also, Windmill desert hills yield 3 Food, 2 Hammers, 5 Currency: View attachment 592691
I mean, investing 2000 Hammers (3 great engineers and change) still means that you invested a lot of buck into not enough bang, but it's supposed to be even weaker?

It doesn't provide +2C. If you remove the Burj Khalifa with the WB, you'll see that the tile produces 6C instead of the 7C it does now. So it is only a +1C bonus for that tile. That is because the effect is affects the natural tile yield. (Terrain, features, resource) All other aspects that change the yield (improvements, routes, buildings like levee etc.) are applied after that effect.

Normally the natural yield of a desert gem hill is 1P1C. The Burj Khalifa sets the food and commerce of at least 2, making it 2F1P2C. (That means that the +1 from the gems is basically lost.) Then you apply the addtional yield from the mine or windmill and you will get the yield you have in your game.

I do. Yes, it takes a huge amount of hammers to build. But it is a late wonder, giving you plenty of time to acquire Great Engineers or gold to rush-buy it. It can turn useless cities into monsters.

Don't build it in any desert city. While it does provide food and commerce to deserts, it doesn't allow you to improve those tiles. So regular desert tiles will still only provide 2F2C, which isn't terrible, but not great either. Instead, build it in a city which has many desert hills. You can mine this tiles (because this is already possible even without the Burj Khalifa), giving you production. Combine this with the food and commerce from the Burj Khalifa and you have a juicy 2F3P2C. (or even more if there is a minable/quarriable resourece) Don't build windmills, because the food and commerce from them don't stack with the Burj Khalifa, resulting in a loss of production yield. Also don't build it in cities with many flood plains. The effect of the Burj Khalifa doesn't stack with them.

Mexicali/Tuscon in the USA are great spots for this wonder, as they have many desert hills.
 
I can cancel my tribute to the Moors - but the Moors are paying tribute to me:
upload_2021-4-5_15-40-58.png
 
Do you have the save where the reminder shows up?
 
Oh, yes, of course, I am silly for apparently not having attached it. Do whatever you like and go to the next turn.
 

Attachments

Hello again, (still on wine 6.5 with the release)
I encountered another series of bug while launching a game with the Ottomans (speed normal and difficulty regent), seeing as the exceptions started as soon as i went out of auto turn i unfortunately do not have a save for verification, i also didn't have the time to investigate what happens so i only have the attached logs (i'll try to get more information later).

I did some further investigation on the first bug i reported sooner. Contrary to what i thought doing
Code:
if pOwner.isBarbarian() or pOwner.isMinorCiv(): #1591 stability.py
          filter(lamdba unit : location(unit) != location(city),lFlippedUnits)
          filter(lamdba unit : location(unit) != location(city),lFlippedUnits)
          completeCityFlip(city, iPlayer, iOwner, 100, False, True, True, True) #original
did not suppress the exception, i don't know why but maybe using != isn't doing what i think it does.
 

Attachments

filter returns the filtered list, it does not modify the list in place.
 
Not exactly a bug but something that messes up historical accuracy a little: When I play as Canada I'm two techs away from Chateau Frontenac and it's built somewhere else before I have a realistic chance of doing it.
 
"It's impossible to vassalize far away civilizations until the discovery of Astronomy":
upload_2021-4-9_19-4-4.png

Astronomy isn't a technology anymore - which one should it be?
 
Was it designed that you need 5 civilizations to exist for a Secular victory?
... that was a lot of hours.

civ4screenshot0044-jpg.593285


Side-note: If I didn't have an old-ass computer, I could confirm any victory not requiring the existence of other Civs is possible with Polynesia.
 

Attachments

Last edited:
Stability.py, line 972: iNationalism is not a civic. It should be iNationhood.

Both core.py and stability.py contain a Civics() class. Maybe it's a good idea to rename one to avoid confusion.
 
Back
Top Bottom