Advanced Civ

@Lanstro: I can only test networked multiplayer on a single machine (connecting to 127.0.0.1); no problem then. Realism Invictus has been plagued by a mysterious black terrain glitch, but I've been assumning that this is specific to Realism Invictus. Anyway, sounds like this breaks multiplayer entirely for you, which is of course unfortunate.

Regarding Foment Unhappiness (FU :)), AdvCiv does empty the Granary's food store when a city shrinks, which normally avoids a loss of more than 1 population. The MP mods at RealmsBeyond double all active mission costs (RtR) or disable them entirely (Close to Home), so there do seem to be balance issues at least in zero-sum situations. Not sure about FU specifically. Do you have a concrete example in which the mission was especially devastating – so that we can maybe compute some amount of gold that corresponds to the total damage inflicted?

@arcvoodal: BBAI introduced those cost modifiers. A means of adjusting all tech costs of a given era is clearly nice to have for modders, but it's not obvious to me why jdog5000 chose to progressively increase costs with each era starting in the Medieval era. It could have to do with the BBAI tech diffusion system, but that's optional and disabled by default. More likely, he felt that his AI changes had increased the overall tech pace or he intended it as a balance change to stop the middle and late game from flying by as fast as it sometimes does in BtS. K-Mod increased the costs only a little bit more; to compensate for AI changes, I would assume – although the K-Mod AI has a reputation for actually researching more slowly than the BtS AI due to increased investments in military units and a higher number of wars. Finally, karadoc introduced a kind of rubber band:
K-Mod 1.45 changelog said:
Inflation rate now increases with global tech state. Previously inflation only depended on how many turns had past, and so if the global tech rate was very high (due to lots of tech trading), players would reach high end-game yields and still have very little inflation - which would increase the tech rate further. With this change, there will be higher inflation in games which have lots of tech trading. (And the inflation will be slightly higher for players with better tech!)
I didn't keep that change (actually never adopted it). Upon re-reading it, maybe tying inflation to tech progress was a good thought after all. I was worried about getting the same tech pace in every game, regardless of how many wars are being fought. As for my own changes, I've been trying to match the historical time line for some famous discoveries, e.g. the Printing Press and oceangoing ships around 1450. Well, games that exhibit a typical amount of cooperation should match that time line, others should fall behind it or get ahead of it. To that end, I've adjusted those cost modifiers several times – but also increased the difficulty-based modifiers (Civ4HandicapInfos.xml) and introduced a separate modifier for the AI so that the AI civs get their techs cheaper than humans on the highest levels. I've also adjusted the years-per-turn formulas to add some turns to the BC years and quite a number of turns (which usually aren't reached) to the 21st century. I also removed the hidden 20% tech cost reduction for knowing just a single prerequisite of a tech. The trend has been that AI research was getting faster and faster – apparently through AI changes though I rarely knew exactly which change was responsible when noticing that research was getting ahead of the real time line in all-AI games –, and then I compensated through tech cost modifiers or, eventually, through the years-per-turn progression.
 
I've learned a lot about civIV all these years later just from reading your impressive and comprehensive manual. I've never played with espionage; coupled with the culture modifications, I've been hesitant to dive in with your mod but I must admit now that was a mistake. Your mod is great and i'm deeply appreciative of your hard work.
 
@Furloughed: Thanks for stopping by to state this. Not sure I understand you correctly regarding espionage. In my mind, the mod mostly makes that even easier to ignore. Anyway, glad that you've managed to accustom yourself.
Edit: Oh, must be in reference to the removed "No Espionage" option; I see.
 
Last edited:
hey
how are you dear friend?

in case you are listening,
i think there is a bug in bonus health and happiness.

there are 2 resources that i had given their health and happiness -1 and +1 accordingly.

but, in the city calcs, looks like the negative value of health is being converted to happiness. (in this example , there is no grocer , its a later tech).

health.JPG
totalhealth.JPG
 
Hey, keldath. I'm listening, just not doing much else. Can't readily reproduce your issue. I've tried giving Sugar 1 bad health, started a new game (to make sure that the cached CvCity::m_iBonusGoodHappiness etc. aren't out of date), WorldBuilder'd myself Calendar and a Sugar resource, then also a Gold resource. The totals I got in the tooltip were correct.
 
Hi keldath, I hope you are well, too. :)
 
oh hi @Civinator ,
nice to see you on the civ4 area.

@f1rpo

hey , sorry to bother on another thing,
ive been tracking some assets.
and i possibly found a small issue in advc code.

this -> ::kill:
Code:
FOR_EACH_ENUM(Commerce)
    {
        //keldath test
        int frr = kOwner.getFreeCityCommerce(COMMERCE_CULTURE);
        changeCommerceRateTimes100(eLoopCommerce,
                -100 * kOwner.getFreeCityCommerce(eLoopCommerce));
    } // </advc.001>

i ran ai auto play,
assert popped -> FAssert(m_aiCommerceRate.get(eCommerce) >= 0) -> ::setCommerceRateTimes100;

so i tracked it,
here is the situation:

louis xii , took a city from the english.
then, they traded it back to the english.


there assert found a -100 culture in the above.
the 100 culture comes from 1 * -100 from the trait CREATIVE that LOUSI XII got .

when the city culture calc is done, on the kill fn, looks like the 100 culture is deducted from the comparison of
FAssertMsg(iTotalRate == iRate, "Player's special commerce did not equal the sum of their cities'");
in player.cpp.

i think the -100 * kOwner.getFreeCityCommerce(eLoopCommerce)) should not be calculated to the nation that took the city
since this getFreeCityCommerce(eLoopCommerce) equals to 1 from the train creative.
or something that is relevant to the auiqre and kill functions.

--
edit -> huh - could it be that due to the fact that the city is occupied -:
void CvCity::doCulture()
{
if (GC.getPythonCaller()->doCulture(*this))
return;
// <advc.099b>
if (isOccupation())
return; // </advc.099b>
// <advc.125>

and it is being traded back like this
this is iOldRate = m_aiCommerceRate.get(eCommerce);
equals to 0?
--
ill try this:

Code:
if (!isOccupation())
    {
        FOR_EACH_ENUM(Commerce)
        {
            //keldath test
            int frr = kOwner.getFreeCityCommerce(COMMERCE_CULTURE);
            changeCommerceRateTimes100(eLoopCommerce,
                -100 * kOwner.getFreeCityCommerce(eLoopCommerce));
        } // </advc.001>
    }

yup! i think that did the trick, i dont see the asert no more.
i got a reproducible savegame with my dev doto if you want.
b4.JPG
aftr.JPG
 
Last edited:
Thanks for looking into that. I can reproduce the problem by razing a city with a Creative leader. That causes 1 culture to be subtracted from the new owner's total without that 1 culture ever having been added – due to this isDisorder check:
Spoiler :
Code:
void CvCity::updateCommerce(CommerceTypes eCommerce)
{
	int iNewRate = 0;
	if (!isDisorder())
	{
		iNewRate += (getBaseCommerceRateTimes100(eCommerce) *
				getTotalCommerceRateModifier(eCommerce)) / 100;
		iNewRate += getYieldRate(YIELD_PRODUCTION) *
				getProductionToCommerceModifier(eCommerce);
	}
	// ...
I'm not quite sure, but I have some hope that your fix, i.e. checking for occupation in CvCity::kill, will indeed fix the issue without introducing new problems. Should be isDisorder to also cover Anarchy and to be consistent with CvCity::updateCommerce.
 
Long time no see, hope all of you are doing well!

I've been enjoying a couple of games during the summer, and in the last one I played a game with Random Personalities enabled. I noticed a couple of oddities regarding this.

Firstly, some of the leader themes were mixed up, but not all. Those that were, were invariably the theme of some other leader present in the game:
  • Isabella had Kublai's theme (only "Isabella Late" became "Kublai Late", not Middle, Early unknown)
  • Montezuma had Frederick's theme (only Middle, not Early nor Late)
  • Joao had Montezuma's theme (Middle and Late, Early unknown)
In all cases, upon finishing the theme, on next loop the correct theme was played (and apparently every subsequent loop after that). An interesting pattern here, is that in each case the wrongfully played theme has an "Intro" and "LP" variant:
  • Genghis/Kublai has Late "Intro" and Late "LP" for his Late theme, but not for his Middle theme.
  • Similarly, Frederick has Intro and LP only for the Middle variant.
  • And Montezuma has Middle Intro and LP (no late theme at all, I guess his Late = Middle).
Don't know if this is relevant, but this coincidence struck me as odd. Speaking of coincidences, I'm pretty sure Joao had Montezuma's personality, he was as aggressive as I've ever seen anyone in civ. He gave me a rough time even with a tech disadvantage, and he even forced me to take some unusual paths in the tech tree to ensure I had a military tech edge at every step (like rushing Artillery when he got Grenadiers against my Riflemen for instance).

Secondly, it appeared that each Leader's favorite Civic remained unchanged. Caveat: I'm not 100% sure how it's supposed to work with Random Personalities. My assumption is that the favorite Civic of each Leader is to remain secret until revealed, e.g. by "That goes against everything we stand for!" or "You have wisely chosen your civics". It could all of course be due to random chance, but I find it unlikely given that Ragnar (1937 CE save confirms); Charlemagne (1913 CE save); Boudica (1335 CE); Kublai (1937 CE); Suryavarman (1400 CE); Qin Shi Huang (1937 CE) all had the same favorite Civics as they normally do.

Each Leader's favorite Civic was also listed under the "Info" tab. I'm not sure how it's supposed to be in a Random Personalities game, but my impression is that the favorite Civics column should be "?" until revealed in-game. Not how it was in this game: The Info tab reveals leaders' favorite Civics that couldn't possibly have been revealed to me (340 CE save).

Thirdly, and totally unrelated to Random Personalities, it appears that in some rare cases, if an Irrigation chain of Farms is broken, not all Farms tiles update their new food output value correctly. I'm aware unworkable Farm tiles don't always display the correct value (i.e Biology Irrigated Plains Farm with 2F outside workable range of cities). In this game, however, the opposite happened. While at war, I pillaged a Farm that spread Irrigation to workable Farms inside my empire (I didn't want to depend on rival Irrigation anyway). One of the Biology Plain Farms displayed 2F output, but the city working that tile received 3F from that tile (1956 CE). On restoring the Irrigation to the broken chain, the Farm correctly yields 3F, but displays 2F still on the tile itself. (see attached pictures).

Thinking of this, should Farms spread Irrigation to rivals at all? Not sure if it's worth changing even if you agree, just a thought I had while typing this.

Another thing that crossed my mind during this game was that perhaps Master and Vassal should be able to "jointly occupy" cities belonging to third parties. I tried to help my vassal suppressing revolts in a city, but my units couldn't lower the revolt chance. When a revolt happened there, my units were damaged anyway.

The manual at item [184] states:

"A city that fears for its safety or that is under Hereditary Rule can receive happiness from military units only if those units belong to the same team as the city or to a vassal or master of that team.

Only units of the same team as the city owner count toward culture garrison strength."

Of course Vassal/Master shouldn't help each other suppress revolts when one of them controls a city where the other has majority culture, which is probably the reason for the latter statement. Intuitively they should be able to help each other against third parties, and I think allowing this is in line with what was trying to be avoided from the (highly counterintuitive) BtS case.

Of course, as with the rival Irrigation thing, this is very minor also. Just something that was on my mind!

P.S If you need any save files, just let me know.
 

Attachments

  • 3-working-farm.png
    3-working-farm.png
    5.2 MB · Views: 26
  • 4-not-working-farm.png
    4-not-working-farm.png
    5.1 MB · Views: 27
Last edited:
Thanks for the detective work. Since I normally neither enable music nor play with Random Personalities, it's not surprising that I never encountered that issue. It seems that I broke this already in 2017 when I started using Git. In getIntroMusicScriptId, I had replaced a getLeaderHead call (displayed leader) with getPersonality (the true personality) for no apparent reason and without comment. Well, easy enough to fix.
An interesting pattern here, is that in each case the wrongfully played theme has an "Intro" and "LP" variant:
I don't think I've ever even been aware that those intros exist.

Regarding favorite civics, after having complained for some months that those should be based on the displayed leader – not on the secret personality – (while Jorunkun kept reporting issues with the BUG civics detector), I finally implemented it that way in v1.08:
v1.08 changelog said:
When playing with Random Personalities, favorite civics are based on the displayed leader head, not on the secret personality. This was easier for me to implement than fixing remaining issues with BUG's "Favorite Civic Detector" – and it makes more sense. [advc.130n]

For the irrigation issue, a savegame might indeed be helpful. Considering how difficult it is to notice this problem, I could well imagine that it has existed for quite some time. For health and happiness from (Preserved) Forests, I established the rule that the city owner needs to be able to enter the borders of the Forest tile owner in order to benefit, i.e. Open Borders or a vassal-owned Forest tile. The same would make sense to me for irrigation chains. Well, perhaps categorically cutting off all cross-border water flow when trade is suspended is unrealisticially harsh. Maybe only when at war. As it is, (human) players can always pillage to sever irrigation chains. Anyway, I'll probably leave it alone because it seems slightly challenging to implement a rule change; the game checks for irrigation chains through the general path finding code, which is a little convoluted (and overkill, but it works).

I agree that it's more intuitive and consistent to let civs in a vassal-master relationship help each other against third-party revolts. So I've just implemented that small change.
 
So my intuition was correct then, the true personalities shone through in their music :lol: .
I don't think I've ever even been aware that those intros exist.
It's funny to think I'd teach you something about the game, even if it's like, the most minute thing ever, when you have taught me SO much through your incredible documentation of the mod.

Regarding favorite civics, after having complained for some months that those should be based on the displayed leader – not on the secret personality – (while Jorunkun kept reporting issues with the BUG civics detector), I finally implemented it that way in v1.08:
Sorry I missed the favorite civic fact in both the changelog and the manual, which is slightly embarrassing. Especially considering I was, as I stated, unsure about the intended behavior.

For the irrigation issue, a savegame might indeed be helpful.
Sure thing, I'll attach a savefile. I only noticed the issue a couple of turns after I pillaged: Fortunately, I have an autosave from the turn I actually pillaged, so I'll attach that so you can reproduce yourself. To reproduce, pillage the Farm SE of the city of Faro (situated "south middle" on minimap).
When I do this again, the tile actually displays 3F output on the tile itself, contrary to the screenshot I posted earlier. Still, the Farm yields 3F to its city instead of 2F.

The same would make sense to me for irrigation chains. Well, perhaps categorically cutting off all cross-border water flow when trade is suspended is unrealisticially harsh. Maybe only when at war. As it is, (human) players can always pillage to sever irrigation chains. Anyway, I'll probably leave it alone because it seems slightly challenging to implement a rule change; the game checks for irrigation chains through the general path finding code, which is a little convoluted (and overkill, but it works).
Agreed. In my opinion, cutting off or redirecting water flow is a pretty hostile act, which would require substantial intent and effort from either the farmers or the authorities, so it seems harsh to have it happen just by having closed borders. During war it seems reasonable, though. But as you said, the player can always pillage to sever the chains.

I agree that it's more intuitive and consistent to let civs in a vassal-master relationship help each other against third-party revolts. So I've just implemented that small change.
Wonderful! Sometimes weaker vassals can't justify investing in suppressing the hostile population fully, so it'll be great to be able to help them out. In the AI on AI case, I've seen a couple of times combined master/vassal stacks in occupied cities where they'd suppress fully if they could occupy together, which is especially relevant during wartime in case a timely revolt could happen to enable the opposing side to attack.

Some miscellaneous:
Quote from manual [650]

AdvCiv:

Damage from nukes to combat units is 9 plus the roll of a single 140-sided die, i.e. a number from the interval [10,149] is chosen uniformly at random for each affected unit. (All units have 100 hitpoints.) This means that, the per-unit survival chance is 9/14 (64.3%). The chance of surviving two nukes in a row is about 17% (if I'm doing my math right).

BtS/ K-Mod:

Damage is 28 plus the sum of two 50-sided dice, resulting in a survival chance of ca. 85% for a single nuke and a very small (somewhat difficult to calculate) chance of surviving two nukes in a row – provided that there are no Bomb Shelters.
You're right, as long as I'm doing my math right! Exact calculation yields a 2-nuke survival odds of 81 / 490 ~= 16.531%.
Survival odds for 3 nukes in a row is 213 / 9800 ~= 2.1735%.
Survival odds for 4 nukes in a row is 17019 / 10976000 ~= 0.15506%.

Survival odds for 2 nukes in a row in BtS / K-Mod is 12341 / 625000 ~= 1.9746%.

Speaking of nukes, what are your thoughts on the Manhattan Project unlocking nukes for all players? I've always found it a little jarring that such an expensive project essentially is given for free to every other player (without compensating the one finishing the project at all). I suppose keeping such a thing secret is impossible: In real life the USSR was aware of the project, if I remember correctly. Still, it took them till 1949 to complete their own first successful trial.

Changing it, i.e to a National Project, is obviously a big gameplay change (I'd guess far outside the scope and spirit of the mod); it's by no means something I'm advocating for. I've just been thinking, from time to time, about whether it could be changed for the better in some way, and if so, how. I'm curious what you (and anyone else here) think of the Manhattan Project in this game.

Quote from manual [908a]

Reddit thread discussing the change (and arguing for a Bank discount from Financial).
I'm actually one of the redditors in that discussion! Fun to find myself referenced.

Lastly, I must once again express my heartfelt gratitude for the enormous effort you have put into this. You have given me and so many others so much enjoyment. The overall quality and painstaking attention to detail (as clearly demonstrated in the manual and here) are very inspirational and impressive. I'm no modder (I've only very rudimentary programming experience), but if I ever become one, I want to be like you.
 

Attachments

  • Washington CE-1954-July (send to firpo).CivBeyondSwordSave
    794 KB · Views: 6
hey @f1rpo buddy,

hope you are well. always makes me happy to see new commits :) thanks for the credit there :)

anyway,
noticed a small inefficient code and i changed it at my end:

in id CvUnit::finalizeInit():
Spoiler :

Code:
/* DOto 113 efficiancy change see below, spare one loop....
    if (getUnitCombatType() != NO_UNITCOMBAT)
    {
        FOR_EACH_ENUM(Promotion)
        {
            if (kOwner.isFreePromotion(getUnitCombatType(), eLoopPromotion))
                setHasPromotion(eLoopPromotion, true);
        }
    }

    if (getUnitClassType() != NO_UNITCLASS)
    {
        FOR_EACH_ENUM(Promotion)
        {
            if (kOwner.isFreePromotion(getUnitClassType(), eLoopPromotion))
                setHasPromotion(eLoopPromotion, true);
        }
    }

    */
    if (getUnitCombatType() != NO_UNITCOMBAT || getUnitClassType() != NO_UNITCLASS)
    {
        FOR_EACH_ENUM(Promotion)
        {

            if (getUnitCombatType() != NO_UNITCOMBAT)
            {
                if (kOwner.isFreePromotion(getUnitCombatType(), eLoopPromotion))
                    setHasPromotion(eLoopPromotion, true);
            }
            if (getUnitClassType() != NO_UNITCLASS)
            {
                if (kOwner.isFreePromotion(getUnitClassType(), eLoopPromotion))
                    setHasPromotion(eLoopPromotion, true);
            }
        }
    }
    //doto 113 efficiancy change end



edit

found another odd thing is cvcity:

the check is GC.getNumUnitInfos() > 116
ok so its prophet (hard coded ?)
and you got this -> getGreatPeopleUnitRate((UnitTypes)116)
this is puzzling -> why the GC.getNumUnitInfos() > 116?
Spoiler :

Code:
if (uiFlag < 16 && GC.getNumUnitInfos() > 116 &&
        // Great Prophet points. To save time. isHolyCity check not possible here.
        getGreatPeopleUnitRate((UnitTypes)116) > 0)
    {
        FOR_EACH_ENUM(Building)
        {
            if (getNumBuilding(eLoopBuilding) > 0 &&
                GC.getInfo(eLoopBuilding).getHolyCity() != NO_RELIGION)
            {
                m_aiShrine.add(GC.getInfo(eLoopBuilding).getReligionType(), 1);
                break;
            }
        }
    } // </advc.enum>
 
Last edited:
I noticed a tiny tooltip issue. If the garrison in an occupied city is weak enough that the revolt chance is > 0% after occupation period ends, the name of the key:

TXT_KEY_REVOLT_CHANCE_AFTER_OCCUPATION

is displayed in the tooltip instead of the value this key refers to (see screenshot).
 

Attachments

  • advciv-text-revolt-after-occupation.png
    advciv-text-revolt-after-occupation.png
    4.9 MB · Views: 26
So nice to see some life on this thread again. Just wanted to add that, like @Furloughed , I've come around to playing with espionage on thanks to AdvCiv. It's not the most well-designed subsystem, but I've made it part of my playstyle and the game is better for it.

Also, I've long since played with random personalities exclusively and am glad to see some discussion on it. I still get the odd error message regarding favorite civics, but don't understand the default system well enough anymore to say where the shuffle-up goes wrong. Was well impressed when @f1rpo was able to tell whose personality had been swapped for whose in our playalong last year. The only AI I can reliably guess right is Tokugawa. :)

I wish I could play some CIV, but I've had to uninstall it to be able to focus on work (I do consultancy-type projects; my life is either 80hr weeks, or mutli-day nonstop huge marathon 18civ global conquests in my pyjamas). Hope that by the time I come back to it in a coupla months, the Heinzelmännchen will have come back to do their thing ...

Yoroshiku from Paris. AdvCiv for life! :)
 
Top Bottom