Advanced Civ

@xyx: Having looked at a few Auto Play games, your map indeed makes a pretty convincing case for Gold not being a major balance problem at least in all-AI games. Human players may benefit more, especially on difficulty levels with high expenses.

Yeah, after looking at some recent snowball games I’ve played, I think it is more about land distribution. An AI is much more likely to runaway if it can expand unopposed or has a weak AI neighbor. World wonders and new buildings and units just excaberate the problem because of course the tech leader ends up snagging them before anybody else.
 
I also think it's very much about land distribution (though I somewhat expected that isolated starts are a problem). Perhaps the strongest starting locations allow for expansion and offer some trading partners, followed by isolated starts with much land, followed by less land but many trading partners. Would be interesting to investigate this more closely, because of its implications for tech trading, research output, and tech diffusion. For example,making research more expensive in favor of increased tech diffusion would obviously penalize isolated starts and thus somewhat counter the benefit of lots of room for expansion.
 
I still think the starting resource algorithm should be tweaked. I ran some AI tests today and noticed that resources that can cluster can cause runaway AIs. One in particular was a double gem/double silk start. That caused an insane runaway AI that had double the next highest score by 1100 AD and had found 6 of the religions! I went back and removed one gem and one silk and that toned things down on the next run. So, I would say any bonus resource that can cluster (gems, precious metals, ivory, wine, plantation) are likely culprits.

I also think the disparity in starts can be ridiculous. I had one today with literally no bonus resource in the starting fat cross. I didn’t know that was possible. I know different people enjoy different styles of play but I think more balanced starts lead to better games (or introduce a mechanism to slow down runaways).
 
I ran some AI tests today and noticed that resources that can cluster can cause runaway AIs. One in particular was a double gem/double silk start.

hmm, not sure. I tried this 5 times (with random leaders) using the map script attached, but this did not lead to runaways (after 100 turns at least) with an average rank of 3.6 and an average score of 348. By comparison, the starting location to the right of the two gems/two silk location yielded a rank of 1.4 and a score of 396, so, if anything, the latter location is too strong, but, alas, I can't really see why. This map also had an isolated start, but this did neither fare well on this map, average rank of 4.4 and score 326.

It would be interesting to see your map causing that gross runaway.
 

Attachments

  • MCmap3.7z
    7.1 KB · Views: 110
  • mc3.JPG
    mc3.JPG
    509 KB · Views: 153
hmm, not sure. I tried this 5 times (with random leaders) using the map script attached, but this did not lead to runaways (after 100 turns at least) with an average rank of 3.6 and an average score of 348. By comparison, the starting location to the right of the two gems/two silk location yielded a rank of 1.4 and a score of 396, so, if anything, the latter location is too strong, but, alas, I can't really see why. This map also had an isolated start, but this did neither fare well on this map, average rank of 4.4 and score 326.

It would be interesting to see your map causing that gross runaway.

Yeah, it doesn't always cause it, but I think it is a factor. That particular AI also found 6 religions, which may have played a part too. I really hate how religions are founded by a tech and not a great prophet. I wish I could mod that myself, but I am limited to xml.
 
I really hate how religions are founded by a tech and not a great prophet. - there are 2 mods that does exactly this.
loop for platypings mods - true prophets.

@f1rpo
hye friend,
well taking things slow, also dont have that much time these days.
you always manage in the and , im certain youll finish your task at hand.
havnt decided whether just to wait on 097 or get the latest hotfix and some commits from what you said.
cheers.
 
Yeah, it doesn't always cause it, but I think it is a factor.

yes, but probably not as much as we thought. Maybe the better approach is to see whether replicable runaways can be observed when the same map is played repeatedly and then see what makes the associated start so good.

I really hate how religions are founded by a tech and not a great prophet. I wish I could mod that myself, but I am limited to xml.

If you are happy with a rough implementation for AdvCiv, it's not difficult to do on the python side. I attached a working proof of concept which simply removes religions by techs and instead adds an action to prophets along with a (very basic) AI routine. Basically a new special building is added which can only be constructed by prophets and triggers founding of a religion (picked at random). [Edit: I found a a better way to do this.] A proper implementation is of course much more work. If you want to use this, you'd have to do the necessary xml changes for yourself (such as defining a reasonable icon for founding a religion, making sure that prophet points can be generated much earlier, making the religion techs useful again, and so on), but maybe - if you really hate the religion by techs mechanism so much - you find that useful.

Generally, this would be better done using the SDK, but I doubt this is in the scope of AdvCiv, simply because all that required gameplay changes.
 

Attachments

  • prophetsFoundReligions.7z
    41.1 KB · Views: 102
Last edited:
yes, but probably not as much as we thought. Maybe the better approach is to see whether replicable runaways can be observed when the same map is played repeatedly and then see what makes the associated start so good.



If you are happy with a rough implementation for AdvCiv, it's not difficult to do on the python side. I attached a working proof of concept which simply removes religions by techs and instead adds an action to prophets along with a (very basic) AI routine. Basically a new special building is added which can only be constructed by prophets and triggers founding of a religion (picked at random). A proper implementation is of course much more work. If you want to use this, you'd have to do the necessary xml changes for yourself (such as defining a reasonable icon for founding a religion, making sure that prophet points can be generated much earlier, making the religion techs useful again, and so on), but maybe - if you really hate the religion by techs mechanism so much - you find that useful.

Generally, this would be better done using the SDK, but I doubt this is in the scope of AdvCiv, simply because all that required gameplay changes.


Hey, thank you! I’ll take a look. As long as the AI can use it I can do the rest. I’ve had a pagan temple with mysticism in my mod mod for a long time so great prophets come early.

I don’t have a save but the surrounding land was better (more grassland, more land in general, long rivers, and less coastal). I’ve made many mods to AdvCiv, so I’m dealing with a lot of moving parts. I’ve been on a long quest to stamp out the runaway issue. It is a boring outcome. When I become the runaway I just quit and start a new game. I was playing a great close game yesterday and then my neighbor took off and got 7 techs ahead. In that game I think it was his multiple shrines, which allowed him to run the slider near max.

The easiest way to fix the issue would be a general rubber band mechanism, rather than tinkering with multiple other factors. I believe there is a high correlation between tech level and runaways. If each tech takes longer and longer for the tech leader, other players can catchup.
 
Last edited:
As long as the AI can use it...

Well, sort of. The AI will found religions, but there's no elaborate decision when to (not) do it. Basically, the AI will found a religion if no religion has been found so far and is is less likely (up to some random noise) to do so
  • the more holy cities it owns
  • if it runs a state religion
  • the more religions have already been founded
This clearly could be improved, as could be added some personality flavor to the decision which religion is founded and so on. If you eventually use this in your mod, I'd be happy to hear some suggestions.
 
Well, sort of. The AI will found religions, but there's no elaborate decision when to (not) do it. Basically, the AI will found a religion if no religion has been found so far and is is less likely (up to some random noise) to do so
  • the more holy cities it owns
  • if it runs a state religion
  • the more religions have already been founded
This clearly could be improved, as could be added some personality flavor to the decision which religion is founded and so on. If you eventually use this in your mod, I'd be happy to hear some suggestions.

Ok will do. I'm looking over the files. I assume I need to use your Jewish building template to create a building for each religion and then add each building to the great prophet unitinfo?
 
I assume I need to use your Jewish building template to create a building for each religion and then add each building to the great prophet unitinfo?


No, no need to do this. It's a dummy building acting like a world wonder that can be build max. 7 times (replace this by the number of religions in your mod). Whenever this is build (by a prophet), a random religion is founded. This could easily be changed to let players choose a particular religion, but I decided to keep it simple for the time being. I just chose the jewish temple icon in absence of a better idea.

This also means that no new religion can be found in a holy city. Again, it would be easy to change that.


Edit: no longer applies, see above
 
Last edited:
No, no need to do this. It's a dummy building acting like a world wonder that can be build max. 7 times (replace this by the number of religions in your mod). Whenever this is build (by a prophet), a random religion is founded. This could easily be changed to let players choose a particular religion, but I decided to keep it simple for the time being. I just chose the jewish temple icon in absence of a better idea.

Edit: this also means that no new religion can be found in a holy city. Again, it would be easy to change that.

I pm'd you so we don't clutter the thread, thanks :)
 
Sorry to trouble you, but here's the rest of the assertations encountered from the same build that I talked about in the fixed point thread. I apologize in advance for not providing enough context (why isn't there an easy way to copy-paste the callstack\backtrace in VS...)

Spoiler Assertations :


Assert Failed

File: ..\.\CvPlayerAI.cpp
Line: 8695
Func: CvPlayerAI::AI_considerOffer
Expression: bHuman
Message:

----------------------------------------------------------


Assert Failed

File: ..\.\WarUtilityAspect.cpp
Line: 488
Func: WarUtilityAspect::partnerUtilFromTrade
Expression: skip || item->m_data.m_eItemType == TRADE_GOLD_PER_TURN
Message:

----------------------------------------------------------
skip is false,
m_eItemType is TRADE_SURRENDER or m_eItemType is TRADE_VASSAL





Assert Failed

File: ..\.\CvGame.cpp
Line: 6383
Func: CvGame::doTurn
Expression: kActivePlayer.isHumanDisabled()
Message:

----------------------------------------------------------


Assert Failed

File: ..\.\CvTeamAI.cpp
Line: 769
Func: CvTeamAI::AI_getAttitudeVal
Expression: !bAssert || iCount > 0
Message:

----------------------------------------------------------


Assert Failed

File: ..\.\CvGame.cpp
Line: 7743
Func: CvGame::updateMoves
Expression: m_iUnitUpdateAttempts != iMaxUnitUpdateAttempts - 5
Message: Unit stuck in a loop

----------------------------------------------------------
Not sure which unit so not very useful...


Assert Failed

File: ..\.\CitySiteEvaluator.cpp
Line: 466
Func: AIFoundValue::evaluate
Expression: static_cast<int>(iCultureModifier) >= static_cast<int>(0)
Message: Index expected to be >= 0. (value: -769)

----------------------------------------------------------

This happens the same turn a civ dies.


Assert Failed

File: e:\civ\firaxis games\sid meier's civilization 4 complete\beyond the sword\mods\advciv\cvgamecoredll\EnumMap.h
Line: 578
Func: EnumMapBase<enum TeamTypes,bool,0,enum TeamTypes,enum TeamTypes>::get
Expression: eIndex >= First() && eIndex < getLength()
Message:

----------------------------------------------------------

When shutting down abruptly (clicking the X button)

void CvInitCore::setCiv(PlayerTypes eID, CivilizationTypes eCiv)

eID is 0
eCiv is NO_CIVILIATION

This causes an Access Violation:
CvGameCoreDLL.dll!CvPlayer::getPlayer(PlayerTypes ePlayer) Line 46
at e:\civ\firaxis games\sid meier's civilization 4 complete\beyond the sword\mods\advciv\cvgamecoredll\cvplayer.h(46)

Exception thrown: read access violation.
CvPlayer::m_aPlayers was 0x1110112.



Assert Failed

File: ..\.\CvUnitAI.cpp
Line: 1060
Func: CvUnitAI::AI_currEffectiveStr
Expression: iCombatStrengthPercent > 0
Message: Non-combat unit?

----------------------------------------------------------

Caused by CvUnitAI::AI_assaultSeaTransport calling kLoopUnit.AI_currEffectiveStr(NULL, NULL, true, iCollateralDamageScale);

Note that if pOther is NULL, currEffectiveStr will always be 0 and hence cause the assert
It appears that it's not ok to ever pass a NULL... :p

 
Sorry to trouble you, but here's the rest of the assertations encountered from the same build that I talked about in the fixed point thread.
Thanks for the bug reports @keldath, the friendly modder, and @devolution, the compassionate tester. :p
Spoiler :
hey,
in ScaledInt.h: [...]
In my defense, when compiling a debug build, the missing return value in ScaledInt.h is, for some reason, not reported.
I apologize in advance for not providing enough context (why isn't there an easy way to copy-paste the callstack\backtrace in VS...)
C2C has added a library, StackWalker it was I think, to include the call stack in the assertion popup. Didn't look like an easy thing to cherrypick though.

The second one and last one in the list should be fixed by now, i.e. WarUtilityAspect:: partnerUtilFromTrade and AI_currEffectiveStr; I've also run into those. The latter was caused by a dead unit in the transport's group. (Which is, apparently, no problem.) Oh, and the EnumMap access out of range is probably also fixed.
Note that if pOther is NULL, currEffectiveStr will always be 0 and hence cause the assert
I don't think that's true. kLoopUnit.AI_currEffectiveStr(NULL, NULL,... doesn't always trigger an assertion. In fact, here's hoping that it never does that anymore.
CvPlayerAI::AI_considerOffer
One AI civ asking for something for free from another. Hopefully I'll catch it in the debugger someday.
This happens the same turn a civ dies.
The four assertions above I assume. Anyway, sounds like I should test player death (active and non-active) during AI Auto Play sometime.
When shutting down abruptly (clicking the X button)
I often exit that way. Might not happen on my OS, or perhaps I don't see it because of my antiquated VS version. Though, in a quick test, I did reach a debugger breakpoint in the code that frees the CvPlayer array (CvPlayer::freeStatics via CvGlobals::uninit) ...
 
I also think it's very much about land distribution (though I somewhat expected that isolated starts are a problem). Perhaps the strongest starting locations allow for expansion and offer some trading partners, followed by isolated starts with much land, followed by less land but many trading partners. Would be interesting to investigate this more closely, because of its implications for tech trading, research output, and tech diffusion. For example,making research more expensive in favor of increased tech diffusion would obviously penalize isolated starts and thus somewhat counter the benefit of lots of room for expansion.
I remember isolated civs in BtS being virtually always way behind in tech. With K-Mod and AdvCiv, isolated civs take advantage of needing hardly any military, and there is a good deal more warfare among civs that can reach each other by land. On the bottom line, the balance has shifted a bit too far in favor of isolation. (Considering that it's possible to have the best of both worlds through a coastal water connection.) Lately, I've made some AI changes specifically to reduce the frequency of inconclusive wars and to make the AI more willing to attack across the sea in order to stop a peaceful victory. I'm not sure right now if those changes are already included in v0.96e. In any case, it hasn't helped very much. For example, I'm attaching a screenshot from a recent all-AI game. The dip in Pacal's and Capac's score is from a nuclear war between the two. Meanwhile, isolated Ethiopia won a culture victory. In fairness, Ethiopia fully claimed the small continent to its west, which required Galleons, played nice with Pacal and Capac and trained a large military once naval invasions became a possibility; so one can't say that this victory was entirely undeserved.

There ought to be a way to get this right through AI decisions on war and peace. I mean, not being able to trade tech is a major disadvantage ... I suppose one could also make the AI a little bit more rational about tech trades, i.e. make the "don't want to trade just yet" and "fear you becoming too advanced" conditions more narrow.

As for dividing the land more evenly – on the maps you've posted (@xyx), the distribution of starting sites isn't bad I think. In the first one, the two continents in the south/ southeast basically support 1.5 civs each. Moving Portugal (in the attached screenshot) farther southeast might've been a bit fairer overall, but I'm not even sure. In the second map, the potential for improvement is more obvious; one civ is needlessly close to the South Pole. Even if the land can't be distributed fairly, the game could try to make up for that when normalizing the starting surroundings. But an algorithm that directly aims at partitioning the land instead of just maximizing distances isn't a low-hanging fruit.

I still think the starting resource algorithm should be tweaked. I ran some AI tests today and noticed that resources that can cluster can cause runaway AIs. One in particular was a double gem/double silk start. That caused an insane runaway AI that had double the next highest score by 1100 AD and had found 6 of the religions! I went back and removed one gem and one silk and that toned things down on the next run. So, I would say any bonus resource that can cluster (gems, precious metals, ivory, wine, plantation) are likely culprits.

I also think the disparity in starts can be ridiculous. I had one today with literally no bonus resource in the starting fat cross. I didn’t know that was possible. I know different people enjoy different styles of play but I think more balanced starts lead to better games (or introduce a mechanism to slow down runaways).
(Sorry to quote the whole post; it's taken me so long to respond that I don't think it's fresh on anyone's mind.) I think we agree that Wine and Plantation resources, including Silk, are fairly weak resources at game start. The first Ivory source is pretty good ... So I take it that the problem is that some civs have a much higher number of resource tiles in the BFC of their capital than others. Or are the clusters so large that civs can get a huge boost once they reach Calendar? I'm pretty sure that I've never seen a starting site with 0 resources. What map script is this? Huge world size maybe? (I don't test that size often.)

I attached a working proof of concept which simply removes religions by techs and instead adds an action to prophets along with a (very basic) AI routine. [...] Generally, this would be better done using the SDK, but I doubt this is in the scope of AdvCiv, simply because all that required gameplay changes.
I also don't think that religions are valuable enough to spend a GP; not nearly. What I'd like to do is lower the value that AI civs assign to founding a religion in the (very) early game, and more or less stop AI civs from bee-lining to the tech that founds their favorite religion when that will imply founding earlier religions along the way. Or change whatever it is that makes the AI found too many religions too early (flavor values could also be responsible). I'm also not opposed to a rule that prohibits civs from founding religions in quick succession. One such rule I had in mind was "can't found a religion while owning a holy city without a shrine," but that makes it impossible for India to found both Hinduism and Buddhism. More generally, one civ founding two of the early religions isn't a problem. In fact, it could help make the later religions more valuable as there are fewer civs proliferating an early religion. So now I'm more in favor of religion-specific restrictions; e.g. "can't found Hinduism without owning a Buddhist city" and vice versa and "can't found Judaism when owning a holy city without a shrine." Well, those rule changes are probably not going to happen, but the AI changes might go a long way.

[...] The easiest way to fix the issue would be a general rubber band mechanism, rather than tinkering with multiple other factors. I believe there is a high correlation between tech level and runaways. If each tech takes longer and longer for the tech leader, other players can catchup.
The Dawn of Civilization code would be quite easy to adopt as an XML option if I do it (note to self) based on CvPlayer::m_iTechScore instead of tech rank and total tech value:
CvTeam::getTechLeaderModifier
CvGameTextMgr.cpp, game text

I think I'd like something like a "groundbreaking" penalty better – for being the first/ only one to research a technology. Feels a little less artificial. But I wouldn't want players to be able to infer the techs (or current research) of other/ unknown civs, so, ideally, it should be based only on civs that have already been met, but without punishing civs for having met few – or many – other civs. (Well, I guess disadvantaging civs with few contacts a little would be OK.)

The inflation formula from K-Mod 1.45 (which I haven't merged into AdvCiv) increases inflation for all civs when research is fast overall, but civs with a higher research score face (even) higher inflation than those with a low research score. That's another thing that I could easily include as an option. (Those options would go into TechDiffusion_GlobalDefines.xml.)
 

Attachments

  • isolated culture victory.jpg
    isolated culture victory.jpg
    277.4 KB · Views: 140
  • MCmap2.jpg
    MCmap2.jpg
    364.6 KB · Views: 136
  • MCmap3.jpg
    MCmap3.jpg
    361.9 KB · Views: 133
Last edited:
I think we agree that Wine and Plantation resources, including Silk, are fairly weak resources at game start. The first Ivory source is pretty good ... So I take it that the problem is that some civs have a much higher number of resource tiles in the BFC of their capital than others. Or are the clusters so large that civs can get a huge boost once they reach Calendar? I'm pretty sure that I've never seen a starting site with 0 resources. What map script is this? Huge world size maybe? (I don't test that size often.)

I am using the Realism Invictus Planet Generator. I love all of the customization features it provides and it works with the mods I've made to the game. However, it can be very stingy with starting resources or too generous. I just think every starting location should have at least one of the basic food resources (corn, rice, wheat, cow, deer, pig, sheep, clam, crab, fish).

Btw, the infinite loop bugs have been greatly reduced, but I just got one. I really don't know what I am doing, but I was able to muck around in the debug mode and I think I found the culprit. Two AI units are having their "Leading Group" and "Group" numbers constantly increasing. I don't think that should be happening.

I just wonder if it is related to some of the changes I've made. It a Jaguar and a Composite Bowman (mod unit). They are near jungle. I made it so Jaguars can enter jungle but CBs cannot.
 
Last edited:
The Dawn of Civilization code would be quite easy to adopt as an XML option if I do it (note to self) based on CvPlayer::m_iTechScore instead of tech rank and total tech value:
CvTeam::getTechLeaderModifier
CvGameTextMgr.cpp, game text

I think I'd like something like a "groundbreaking" penalty better – for being the first/ only one to research a technology. Feels a little less artificial. But I wouldn't want players to be able to infer the techs (or current research) of other/ unknown civs, so, ideally, it should be based only on civs that have already been met, but without punishing civs for having met few – or many – other civs. (Well, I guess disadvantaging civs with few contacts a little would be OK.)
For context, I designed that penalty especially to counter very good players who start as an early civ and wildly outpace the assumed tech curve of the game, according to which new civs spawn in with corresponding starting techs. That's obviously a very RFC related concern.

I also have a less blunt instrument (implemented here) of a scaling penalty or boost for the upper and lower 25% by total beaker value of techs researched, which probably comes closer to the idea of rubber banding. Its effect also scales with game era and could be adjusted to taste (or even moved to CvEraInfos.xml, now that I think about it), for example by dropping the backwards boost to 0 if you don't like it:
Code:
static const int lTechBackwardsBonus[NUM_ERAS] = {0, 20, 30, 40, 50, 60, 75};
static const int lTechLeaderPenalty[NUM_ERAS] = {0, 0, 20, 25, 30, 40, 50}
 
Top Bottom