Single Player bugs and crashes v38 plus (SVN) - After the 20th of February 2018

I don´t think that this makes sense.View attachment 491412
Ah yes modern version of "worker was killed by pigeon"
Game doesn't know, that space worker units aren't normal workers for combat purposes.
@Thunderbrd is it possible to make space units be completely unattackable by most of non space units?
That is you would need special units, that can destroy space unit, when it is over earth.
It should be applied only where space unit can move into earth tiles.
 
Last edited:
I was wrong , this is getting very aggravating, sorry // / whereas my unit not only Master Hunter as before, do not move as they used to. i personally dont care about stack attack, that much, so pls have it the way it used to be on movement of individual units . .and not have this "blank" movement and then having to go back to that unit and click on it and then move it before it proceeds to next unit . . thx . .
If I could replicate this effect I would fix it. I don't see it happening but I'll try to catch it somehow. I need a save from right before it happens and instructions on how to make it happen.

In the meantime, click on the unit icon when this happens. It should clear it up. Or a rightclick or something said Joe.
 
Ah yes modern version of "worker was killed by pigeon"
Game doesn't know, that space worker units aren't normal workers for combat purposes.
@Thunderbrd is it possible to make space units be completely unattackable by most of non space units?
That is you would need special units, that can destroy space unit, when it is over earth.
It should be applied only where space unit can move into earth tiles.
Only thing I can think would be to give space units a special invisibility type that no land unit can get.
 
Only thing I can think would be to give space units a special invisibility type that no land unit can get.
Hmm this new type of invisibility could be named: Space Invisibility - units that are too high and too fast for conventional units.
Only spacecraft (aircraft that can go to space) should be able to kill them, if they happen to be on Earth tile.
Space units would be able to see each other.
 
No problem. I wrote it on the forums instead of the IDE so my indentation was ****ed up. Didn't notice it- sorry for posting it without correcting it myself!



The difference is the meaning of the %.
A) Currently (haven't changed yet) the meaning "how much food is needed".
B) After the change, it'll be "how slow will it the city grow".
So with +100% and base of 100, the city needs twice as much and grow at half speed, requiring an end result of 200 food. In this case, A and B give the same result.
With -50% and base of 100:
Option A will reduce the amount of food needed to 50. This means that the city will grow twice as fast. (with 600 food, the city will grow 12 times instead of 6)
Option B will reduce the amount of food needed to 67. This means that the city will grow 50% faster. (with 600 food, the city will grow 9 times instead of 6)

The problem with A is that stacking more of it is extremely efficient. in the above scenario, if the city got an additional -25%:
Option A requires 25 food, so the city will grow 4 times as fast (24 instead of 6)
Option B requires 57 food, the city will grow 75% faster.

We also open up the zone of -100% and below.


I'd probably change it to work with a macro (to avoid the super long function), as your solution seems better.

I have a head cold so my understanding is plummeting and my worrying is growing... changing the meaning of variables can be dangerous.

When talking about food and city growth there are four things the python code needs to know
  1. how much is needed for the next population. This is the total amount needed not the difference between what they have now and what is needed for growth

  2. how much is currently stored

  3. the expected change this turn ie amount added from all sources (eg workers, buildings and trade) minus what is eaten by the population ie population and settled specialists
    Note that we are in the place in the UI where this may be changed by moving people between plots, from specialists to plots and from plots to specialists.

  4. (new) total percentage stored by existing buildings. This is from a long standing player request for a change to the display
I can't remember if we turn these into percentages where #1 becomes 100% or we leave that for the exe.
If I could replicate this effect I would fix it. I don't see it happening but I'll try to catch it somehow. I need a save from right before it happens and instructions on how to make it happen.

In the meantime, click on the unit icon when this happens. It should clear it up. Or a rightclick or something said Joe.
Have not been able to replicate it after a save. Currently it is happening 2 out of 3 turns for me but then I have only had 6 attacks by a single unit:D
Only thing I can think would be to give space units a special invisibility type that no land unit can get.
So, unlike has been demonstrated on RL, I wont be able to shoot down a sattilite with a missile, nor stop a meteor hitting the Earth?
 
So, unlike has been demonstrated on RL, I wont be able to shoot down a sattilite with a missile, nor stop a meteor hitting the Earth?
You would need space dogs to hunt space animals.
That is units that can detect units with Space invisibility.

Currently space workers are getting killed by "pigeons".
Yep, you could lose worker to pigeons in earlier versions of mod.

I wonder how it would be possible for space workers to not be killed by premodern units without Hide and Seek combat mod though
 
Last edited:
If I could replicate this effect I would fix it. I don't see it happening but I'll try to catch it somehow. I need a save from right before it happens and instructions on how to make it happen.

In the meantime, click on the unit icon when this happens. It should clear it up. Or a rightclick or something said Joe.
ok see pic, move the tracker ONLY up ONE space to ATTACK the animal and u can see it has more movement but the screen goes blank where all the icons should be .. .

new game should be easy to load, current svn . .

or go one more turn and a new tracker will be built, and attack the animal right next to the city BUT only manually move him ONCE, . .
 

Attachments

  • AutoSave_BC-107750.zip
    AutoSave_BC-107750.zip
    680 KB · Views: 48
  • movement tracker.JPG
    movement tracker.JPG
    287.7 KB · Views: 66
That bug happened like constantly when I was testing hunting animals on Eternity on my space map (unit buttons suddenly disappearing and appearing) :p
Also I couldn't attack animals even though I had 1/2 movement points.
 

Attachments

I have a head cold so my understanding is plummeting and my worrying is growing... changing the meaning of variables can be dangerous.

When talking about food and city growth there are four things the python code needs to know
  1. how much is needed for the next population. This is the total amount needed not the difference between what they have now and what is needed for growth

  2. how much is currently stored

  3. the expected change this turn ie amount added from all sources (eg workers, buildings and trade) minus what is eaten by the population ie population and settled specialists
    Note that we are in the place in the UI where this may be changed by moving people between plots, from specialists to plots and from plots to specialists.

  4. (new) total percentage stored by existing buildings. This is from a long standing player request for a change to the display
Nothing to worry about in that regard, python is indifferent to how the total Food needed for city growth is calculated in the dll, because the dll does all the number crunching in this regard, so python should trust the numbers it get when it asks for them.

The XML tags that can reduce and increase the total amount of food the city needs for it to grow is what Raledon is talking about a change for.
A value of 0 for those tags means no change in food needed for city growth from this game object (like a building or a civic), this won't be changed.
Positive values for those tags will behave exactly like they used to.
It is the negative values that will affect the amount of food needed for growth differently.
So a building that has -100 for that modifier will no longer mean that the city need no food for growth, it will mean that that building halves the amount of food needed for growth in the city that it is built in.

The tag in question (I think) is the tag <iPopulationgrowthratepercentage>
The global define CITY_THIRD_RING_EXTRA_GROWTH_THRESHOLD_PERCENT functions exactly like the <iPopulationgrowthratepercentage> tag, so that too will be affected by the change, but only if it's set to a negative value.
 
Last edited:
Hmm this new type of invisibility could be named: Space Invisibility - units that are too high and too fast for conventional units.
Only spacecraft (aircraft that can go to space) should be able to kill them, if they happen to be on Earth tile.
Space units would be able to see each other.
You'd also have to assign the visibility to space units as well.
So, unlike has been demonstrated on RL, I wont be able to shoot down a sattilite with a missile, nor stop a meteor hitting the Earth?
You could give missiles the visibility factor, even though they are a land unit. And keep in mind, this is a hack for Multimaps not being up and running.
I wonder how it would be possible for space workers to not be killed by premodern units without Hide and Seek combat mod though
You don't have to have H&S running to have invisibility. The difference is absolute visibility or invisibility rather than shades of grey in-betweens and multiple types of invisibility and visibility ability being possible on an individual unit.
ok see pic, move the tracker ONLY up ONE space to ATTACK the animal and u can see it has more movement but the screen goes blank where all the icons should be .. .

new game should be easy to load, current svn . .

or go one more turn and a new tracker will be built, and attack the animal right next to the city BUT only manually move him ONCE, . .
OK, thanks! I'll take a look into it tonight. There are many different potential combat outcomes and which one is being processed to find this bug is what I have to identify. Since none of my tests are finding it, this should be good as long as it really does replicate. Rax posted a save as well but I'm not sure he's giving me specific replication instructions. I do NOT just play a game til a bug shows up, no matter how frequent, because games run on the debug dll take stupid long amounts of time to process.
 
@Toffer90
One thing I noticed with the math is that it's A*B*C (as was originally). Is it intentional?
This means that if each of the modifiers is -20%, we will reach 73% faster growth instead of 60.
The question is if it's WIA, or if it should be changed while we make changes.
 
@Toffer90
One thing I noticed with the math is that it's A*B*C (as was originally). Is it intentional?
This means that if each of the modifiers is -20%, we will reach 73% faster growth instead of 60.
The question is if it's WIA, or if it should be changed while we make changes.
Please present any alternative solutions that you may have. ^^

I guess we could add "+" the modifiers together before applying them.
Something like this:
Code:
int CvCity::growthThreshold() const
{
    int iThreshold = GET_PLAYER(getOwnerINLINE()).getGrowthThreshold(getPopulation());
    int iDenominator = 1;
    int iNumerator = 1;
    int iThresholdModifier = GET_PLAYER(getOwnerINLINE()).getPopulationgrowthratepercentage();
    iThresholdModifier += getPopulationgrowthratepercentage();
    if (getNumCityPlots() == NUM_CITY_PLOTS)
    {
        iThresholdModifier += GC.getDefineINT("CITY_THIRD_RING_EXTRA_GROWTH_THRESHOLD_PERCENT");
    }

    if ( iThresholdModifier < 0 )
    {
        iDenominator *= iThresholdModifier * -1 + 100;
        iNumerator *= 100
    }
    else if ( iThresholdModifier > 0 )
    {
        iNumerator *= iThresholdModifier + 100;
        iDenominator *= 100;
    }
    if ( isHominid() )
    {
        iDenominator *= 2;    //    Those barbarians are just so damned fecund!
    }
    iThreshold *= iNumerator / iDenominator

    return std::max(1,iThreshold);
}
 
Last edited:
Please present any alternative solutions that you may have. ^^
I guess we could add "+" the modifiers together before applying them.
Yeah, that's the alternative.
I don't know what is the intent behind it, though.
On the one hand, I like A*B*C type of math for various reasons. On the other hand, most bonuses in C2C are A+B+C, which leads to inconsistency.
 
Yeah, that's the alternative.
I don't know what is the intent behind it, though.
On the one hand, I like A*B*C type of math for various reasons. On the other hand, most bonuses in C2C are A+B+C, which leads to inconsistency.
If there are several buildings with this effect I'm pretty sure (assumption) they are added together "A+B", so why not add the civic one to the chain like so "building_A+building_B+civic_C"?

GET_PLAYER(getOwnerINLINE()).getPopulationgrowthratepercentage(); = Civics and Trait modifiers to threshold added together somehow.
getPopulationgrowthratepercentage(); = All building modifiers to the threshold added together somehow.

Could you check my assumption that the effect from several buildings are added and not multiplied together?

Edit: I looked into it.
The odd thing in the code for it in CvCity.cpp is that it stores the value for the thresholdModifier logarithmically as a float value. Whenever the value is called for the logarithmically stored number is normalized with a exp() function.

The CvCity::recalculatePopulationgrowthratepercentage() goes through all built buildings and run this function if the building affects the threshold:
changePopulationgrowthratepercentage(GC.getBuildingInfo(eLoopBuilding).getPopulationgrowthratepercentage(),true);

The CvCity::changePopulationgrowthratepercentage(int iChange, bool bAdd) Stores this value:
m_fPopulationgrowthratepercentageLog += (bAdd ? 1 : -1)*log((100+(float)iChange)/100);

And the CvCity::getPopulationgrowthratepercentage() which is used by the function we are really discussing returns this:
return (int) (exp(m_fPopulationgrowthratepercentageLog)*100 - 100);
 
Last edited:
If there are several buildings with this effect I'm pretty sure (assumption) they are added together "A+B", so why not add the civic one to the chain like so "building_A+building_B+civic_C"?

GET_PLAYER(getOwnerINLINE()).getPopulationgrowthratepercentage(); = Civics and Trait modifiers to threshold added together somehow.
getPopulationgrowthratepercentage(); = All building modifiers to the threshold added together somehow.

Could you check my assumption that the effect from several buildings are added and not multiplied together?
I'll dig into the actual code implementation and get an answer to make sure.
I assume that both of these gets sum the buildings and civics. The thing is that AFAIK, when it comes to production (for example), +5% production from a civic is the same as a building that grants +5% production.
Here it seems we multiply "third ring growth", getPopulationgrowthratepercentage and getPopulationgrowthratepercentage, so a +5% from a civ and a +5% from a building won't have the same effect.
I might be wrong on how it works on other places, which means that this is the correct method and I learned something new.
 
Here's an example of how multiple buildings contribute to the food threshold modifier:
  1. m_fPopulationgrowthratepercentageLog = 0
  2. changePopulationgrowthratepercentage(int 50, bool True)
    • // Building A iPopulationgrowthratepercentage = 50
  3. changePopulationgrowthratepercentage(int 25, bool True)
    • // Building B iPopulationgrowthratepercentage = 25
  4. A = getPopulationgrowthratepercentage() = 87%
-----------------------------------------------------
Detailed:
  1. m_fPopulationgrowthratepercentageLog = 0
  2. m_fPopulationgrowthratepercentageLog += log( ( 100+50.0 ) / 100 ); // == 0.17609...
  3. m_fPopulationgrowthratepercentageLog += log( ( 100+25.0 ) / 100 ); // == 0.27300...
  4. A = 10^(0.27300...) * 100 - 100 = 87.5 = 87%
    • // A = 1.5*1.25 * 100 - 100 = 87.5 = 87%

Looks like we were wrong in our assumption. ^^
// We thought the buildings A and B would be like this 50+25 = 75%​
 
Last edited:
Here's an example of how multiple buildings contribute to the food threshold modifier:
  1. m_fPopulationgrowthratepercentageLog = 0
  2. changePopulationgrowthratepercentage(int 50, bool True)
    • // Building A iPopulationgrowthratepercentage = 50
  3. changePopulationgrowthratepercentage(int 25, bool True)
    • // Building B iPopulationgrowthratepercentage = 25
  4. A = getPopulationgrowthratepercentage() = 87%
-----------------------------------------------------
Detailed:
  1. m_fPopulationgrowthratepercentageLog = 0
  2. m_fPopulationgrowthratepercentageLog += log( ( 100+50.0 ) / 100 ); // == 0.17609...
  3. m_fPopulationgrowthratepercentageLog += log( ( 100+25.0 ) / 100 ); // == 0.27300...
  4. A = 10^(0.27300...) * 100 - 100 = 87.5 = 87%
    • // A = 1.5*1.25 * 100 - 100 = 87.5 = 87%

Looks like we were wrong in our assumption. ^^
// We thought the buildings A and B would be like this 50+25 = 75%​

Huh, good to know.
Does it really use the log function? Do you see any reason for it instead of multiplying by the new value?
IE instead of your detailed-
1. float m_=1
2. m_*=(100+50)/100
3. m_*=(100+25)/100
4. A=m_-1= 1.5*1.25-1=0.875 (==87.5%)

This is assuming we choose to keep it as multiplying instead of summing.
 
This is assuming we choose to keep it as multiplying instead of summing.
Hmm that's a good question.

If ten buildings increase food needed for the city to grow by 20% should that equal 200% more food to grow or should it equal 519% more food for the city to grow?
Anyone beside me and Raledon got an opinion on this?

I'm leaning towards the cumulative system in this case as opposed to the multiplicative system.

Let's say we have a Nuclear winter autobuild that increase food to grow with 10 000 %

Then let's say that a minor disease autobuild has a 10% more food to grow, should that disease then combined with a nuclear winter result in
10 010% more food to grow, or should they combined have a heavy impact of 11 000%
That makes the disease far more devastating during a nuclear winter than what it would be without the nuclear winter. The disease goes from 10% to 1000% more food to grow due to the nuclear winter, the minor disease became a major disease....
With the cumulative system the disease would be relatively unimportant when compared to the nuclear winter.

What if we combine the nuclear winter with something like a fertility dance that decrease the food needed by 10% should that dance really have a 1 000% impact just because there is a nuclear winter present. Should the dance change 10 000% to 9 000% or should it change it to 9 990%?
 
Last edited:
So a building that has -100 for that modifier will no longer mean that the city need no food for growth, it will mean that that building halves the amount of food needed for growth in the city that it is built in.
Which is exactly what -100% means else where eg building requires stone which reduces cost by 100% does that.
 
Should be corrected now with the fix to promos earlier today. Existing units in an existing game may not behave quite as they should but as games progress now, I suspect this is corrected.
SVN10002: Forestry still doesn't work.
 
Back
Top Bottom