Advanced Civ

@Leoreth: Oh. I should've re-read your earlier post about this modifier before searching for the source code. You obviously weren't talking about the leader penalty. :blush: Thanks for pointing me to the right place.

Great, I think I'll merge that and set it to 0 by default through EraInfos. Maybe separate values for human and AI. And see about the information leak later – which may not even bother the relevant players (not sure if it bothers me either).
 
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.)

I ran some more synthetic tests, by giving each AI the same land (using the mapscript attached) and letting them play 10 times for 150 turns. I recorded the average score (and the standardized score in parenthesis). Bottom line:
  • It's better to have trading partners than being isolated (compare red vs the cluster in the west)
  • It's better to have more than just a single trading partner (compare the one in the middle of the cluster in the west to its neighbors)
  • However, isolation is completely offset by having much uncontested land (see dark blue on the north-east continent)
  • Having to compete with another civ on the same landmass is far worst.
I think this very much confirms the general gut feeling, so it's probably fair to say that (much land + trading partners) > (much land + isolated) > (less land + trading partners) > (less land + isolated) > (less land + direct competition).

Now, add some unevenly distributed starting bonuses and I am pretty sure that one can easily create a map leading to replicable runaways.

Apart from bonus distributions at game start and attempting to optimize civ placement (I concur that this is actually pretty good as it stands), I am unsure whether something can actually be done about it. Warfare simply is a costly matter, as it is to be unable to trade techs or bonuses (and it's obviously a good thing that the Kmod/AdvCiv AI now knows to play out isolated starts).
 

Attachments

  • synthMap2.7z
    synthMap2.7z
    5.5 KB · Views: 77
  • synthMap.png
    synthMap.png
    3.1 MB · Views: 3,635
Last edited:
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.

Many of the flavors actually kill the AI. That said, I feel that the AI in AdvCiv makes much more sensible decisions concerning religions and is generally much less eager to found one (compared to BTS or KMod).

On this note a minor (and rather unimportant) bug report: I tried to add the xml part of the prophets stuff as a modular mod, but there's an BTS bug messing up the tech-tree when loading modular techs that have orprereqs set (so, basically just add, say, meditation as single tech to a modular mod). According to this post, this is related to loading some xml files to early (in pass 0 I guess), here's a quote of the readme:
Spoiler :

Some XML tables are loaded in two passes, and the code did load the second pass data into the wrong records for modular additions. Ever wondered why the tech tree or promotion prerequisites get mucked up if you modularize them? Now you *can* modularize those. The full list of Infos that define a second pass loader method and the values those load is:
CvTechInfo(OrPreReqs,AndPreReqs), CvPromotionInfo(PromotionPrereq,PromotionPrereqOr1,PromotionPrereqOr2), CvCivilizationInfo(DerivativeCiv), CvImprovementInfo(ImprovementPillage,ImprovementUpgrade), CvProjectInfo(PrereqProjects,AnyonePrereqProject), CvEventInfo(AdditionalEvents,EventTimes,ClearEvents).
Note Buildings and Units don't need to do that as their perceived self-referencing prerequisites actually refer to the respective "Class", and those are loaded far ahead. Otherwise, this bug may well not have slipped by QA.

Doesn't sound too difficult to fix, but again, I think this is rather unimportant (who uses modular techs anyway?).
 
@Leoreth: Oh. I should've re-read your earlier post about this modifier before searching for the source code. You obviously weren't talking about the leader penalty. :blush: Thanks for pointing me to the right place.

Great, I think I'll merge that and set it to 0 by default through EraInfos. Maybe separate values for human and AI. And see about the information leak later – which may not even bother the relevant players (not sure if it bothers me either).
I've already forgotten mentioning it to you, I assumed you stumbled upon this on your own. I noticed that the advance penalty only applies to players, I probably should try to see what happens if I remove that, but more importantly I wanted to call that out in case you port the code.

Information leak is probably only important in multiplayer games, where this option is probably not desirable anyway. Alternatively you could also limit the effect to account only for known civilisations - although then the aspect of helping out isolated starts is gone.
 
Hi there! I tried this AI mod last we and had a blast, thanks to the author(s) if they are still here, this mod is a jewel. Is it possible to play multi with it? How to proceed (overwrite the game files with the ones from the mod?)? Thanks for highlights!
 
Hi there! I tried this AI mod last we and had a blast, thanks to the author(s) if they are still here, this mod is a jewel. Is it possible to play multi with it? How to proceed (overwrite the game files with the ones from the mod?)? Thanks for highlights!
There's a bit of uncertainty as to whether the mod will work in multiplayer on all platforms. It seems to be working with the two PCs I have at home; apart from that, I've only the report from keldath to go by. If there is a (fundamental) problem, then a message saying that "the game may frequently go out of sync due to floating point calculations" should appear on the main interface at the start of the initial game turn. If that doesn't happen, then it's hopefully fine. I don't think there's ever been a networked multiplayer test with more than two players. I might've tried three instances on the same PC at some point(?). If you do give it a try, I'd be curious to know whether there were technical issues.

As with (to my knowledge) any mod, each player would have to install (under \Program Files\... or \Steamapps\...) and load the mod, and all installations would have to use the same version of AdvCiv (e.g. 0.96e, the latest on the download page).
 
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).
That's what the DLL normalization code tries to guarantee too. And RI's PlanetGenerator apparently uses the DLL for resource placement, starting locations and normalization. So I'm none the wiser as to why that doesn't work reliably. I've gotten the script to run, but, given the myriad of settings, the maps that you're getting could be completely different from what I'm seeing.
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.
Seems like a long shot for me to figure out the cause of this through deduction. But if you still have the savegame (which I realize I wouldn't be able to load): Could you tell me the UnitAIType, ActivityType and Mission(AI)Type of the two units involved? (Ctrl key in Debug mode; e.g. "attack", "GUARD_CITY", "HOLD".)

v0.97 might more or less solve the problem through new code for (detecting and) recovering from loops that involve units switching between selection groups indefinitely. That's where this
Assert Failed
File: ..\.\CvGame.cpp
Line: 7743
Func: CvGame::updateMoves
Expression: m_iUnitUpdateAttempts != iMaxUnitUpdateAttempts - 5
Message: Unit stuck in a loop
failed assertion came from. (I may have set iMaxUnitUpdateAttempts too low; got a failed assertion there myself that appears to have been a false positive.)
 
I ran some more synthetic tests, by giving each AI the same land (using the mapscript attached) and letting them play 10 times for 150 turns. [...]
Those tests are about early runaway leaders. A broader concern is whether civs on small continents generally have a better shot at winning the game than civs on large continents. Ideally, to win, a civ should have to do more than conquer its only neighbor and then play it safe. For what it's worth (not much), I've run one full game on your synthetic map, on Emperor difficulty, and got Brennus and Suryavarman on the largest continent. Two similarly warlike leaders with symmetrical starts; difficult for one to get the upper hand, but Brennus managed it eventually, then got quite a bit ahead of everyone else in score, far ahead in power, and, over time, launched invasions against four other continents, always taking a couple of cities, but failing to conquer any capitals (and often also failing to hold onto the smaller cities in the long run). It was enough for a Time victory because everyone else had been ravaged to some extent and didn't have enough land for a timely peaceful victory. Nice game for testing colonial vassals; Brennus created three of them.
Apart from bonus distributions at game start and attempting to optimize civ placement (I concur that this is actually pretty good as it stands), I am unsure whether something can actually be done about it. Warfare simply is a costly matter, as it is to be unable to trade techs or bonuses (and it's obviously a good thing that the Kmod/AdvCiv AI now knows to play out isolated starts).
Maintaing a military at peacetime is costly, but actual warfare should, in principle, only happen when it's advantageous for one side. Some reasons why this principle often doesn't apply:
* The AI tries to go after disliked civs (especially the worst enemy) even when the cost of war will likely outweigh the benfits.
* Some AI leaders try to win military victories for no rational reason although a Space victory (after some conquests) is probably often the safer route.
* War preparations arguably tend to be a bit shorter than the optimal duration. (Because I don't want the stakes to get too high.)
* It can be rational to start a war that is unlikely to accomplish much when the attacker is almost certain not to win the game peacefully.
There are good reasons for these behaviors, but they could be tweaked, maybe.

For the special problem of a civ that is initially isolated apart from coastal water connections: I'd like to revise the trade route assignment algorithm and the modifier formulas in a way that favors trade between any coastal cities. Trade between continents should be extra rewarding, but not too much so. (And a tech diffusion system that takes into account distances would also help.)

Many of the flavors actually kill the AI. That said, I feel that the AI in AdvCiv makes much more sensible decisions concerning religions and is generally much less eager to found one (compared to BTS or KMod).
K-Mod has indeed already put a break on early religions:
Code:
if (!bNeighbouringReligions)
{
    iReligionValue += 20;
    if (AI_getFlavorValue(FLAVOR_RELIGION) > 0)
        iReligionValue += 28 + 4 * AI_getFlavorValue(FLAVOR_RELIGION);
    if (GC.getGame().getElapsedGameTurns() >=
        32 * GC.getInfo(GC.getGame().getGameSpeedType()).getResearchPercent() / 100)
    {
        iReligionValue += 60;
    }
    if (AI_atVictoryStage(AI_VICTORY_CULTURE1))
        iReligionValue += 84;
}
(That's not the entire religion tech evaluation.) Nevertheless, for example in the Brennus game, Montezuma founded Buddhism on turn 27 and founded his second city only on turn 37. I mention the city because the first (small) benefit of a religion is that it can pop the borders of the second city – by getting founded there or, maybe, through a Missionary. Extra happiness in the capital also isn't going to matter before founding another city.
I tried to add the xml part of the prophets stuff as a modular mod, but there's an BTS bug messing up the tech-tree when loading modular techs that have orprereqs set [...]. According to this post, this is related to loading some xml files to early (in pass 0 I guess), here's a quote of the readme: [...]
That's an interesting old mod. I think I've managed to isolate the relevant XML loading code (Git commit); haven't tested it though. I've avoided the "Incremental Modular XML loading" changes, not only to avoid breaking something, but also because it adds more clutter to the XML loading code. Most of the other bugfixes in the mod were included in the unofficial patch, but some of them I fixed myself not too long ago. Kind of crazy that rheinig had already done that 10 years earlier.
 
Seems like a long shot for me to figure out the cause of this through deduction. But if you still have the savegame (which I realize I wouldn't be able to load): Could you tell me the UnitAIType, ActivityType and Mission(AI)Type of the two units involved? (Ctrl key in Debug mode; e.g. "attack", "GUARD_CITY", "HOLD".)

v0.97 might more or less solve the problem through new code for (detecting and) recovering from loops that involve units switching between selection groups indefinitely. That's where thisfailed assertion came from. (I may have set iMaxUnitUpdateAttempts too low; got a failed assertion there myself that appears to have been a false positive.)

Both are: attack, MISSIONAI_DEFEND, AWAKE

Btw, if you don't mind, what would be an easy way to delay global warming? Global warming is starting to occur 50 - 100 years too early in my mod, probably because of the inflated hammers versus vanilla.
 
There's a bit of uncertainty as to whether the mod will work in multiplayer on all platforms. It seems to be working with the two PCs I have at home; apart from that, I've only the report from keldath to go by. If there is a (fundamental) problem, then a message saying that "the game may frequently go out of sync due to floating point calculations" should appear on the main interface at the start of the initial game turn. If that doesn't happen, then it's hopefully fine. I don't think there's ever been a networked multiplayer test with more than two players. I might've tried three instances on the same PC at some point(?). If you do give it a try, I'd be curious to know whether there were technical issues.

As with (to my knowledge) any mod, each player would have to install (under \Program Files\... or \Steamapps\...) and load the mod, and all installations would have to use the same version of AdvCiv (e.g. 0.96e, the latest on the download page).

Just to let you know : we just finished a two hours cession without any problems (3 human players on a large map with 6 AIs. All with 0.96e). ;)
 
Some reasons why this principle often doesn't apply:
* The AI tries to go after disliked civs (especially the worst enemy) even when the cost of war will likely outweigh the benfits.
* Some AI leaders try to win military victories for no rational reason although a Space victory (after some conquests) is probably often the safer route.
Sounds like the age old utilitarian AI vs. "role playing" AI dichotomy. If you're ever tinkering with this again but don't wanna upset the balance between those two, maybe another option ("calculating AI"?) could be an idea? (Ah, options. The best friend of the indecisive programmer.)

I haven't looked into your code but judging from the manual this seems to be mostly a question of how strictly utilitarian and opinion based war utility factors are weighted, with the option the former could be emphasised more for players who want the AI to be a little more cutthroat about competing. I could even imagine to shift this weighting progressively with higher difficulty settings, to me at least difficulty arising because the AI is less compromising in attempting to get the maximum benefit and less amenable to good relations is more compelling than simple numerical AI advantages.
 
Both are: attack, MISSIONAI_DEFEND, AWAKE
Thanks; I've made a note.
Btw, if you don't mind, what would be an easy way to delay global warming? Global warming is starting to occur 50 - 100 years too early in my mod, probably because of the inflated hammers versus vanilla.
I'm not sure if this is specific to your mod. Earlier comments in that vein:
Spoiler :
the global warming is, in my mind, ridiculously quick. I have played with the limited city popuplation option, so, the global population of the map is not so much, and I don't even have the electricity in my cities that the pollution have been already too much and warming began. If the real one was so quick, maybe humanity should have donne something before it've been too late lol !
Considering how profitable is to kill forests in civ IV, the global warming mechanic probably needs to be revised. Also it fires way to fast in my experience (counting other mods that incorporates the mechanic), and being more progressive would make for a more engaging experience
On global warming: In the new game I'am playing it reached the sustainability threshold before I even build a single coal plant. I think the problem with the mechanic is how the values are calculated: you get pollution per pop, from buildings, resources and from having power. If I was to change the mechanic, I think that power should be the main drive for climate change, as it can be a good representation of a developed city that polutes more, and energy production is one of the main contributor to Co2 emissions. On the other hand, buildings shouldn't add to the value as it only makes sense for a small set of buildings, and in general the polluting ones are related to the energy sector

As for population and bonuses, while they are a factor of pollution, we do not know what is the standard of living of the people, that will be the main factor on deciding it
So long as it doesn't become too easy to avoid GW (and "Save the Planet" anger) by foregoing (fossil-fuel) power plants. It may well be that the real counterparts of the bad-health buildings add to GW primarily by consuming power, but, in the game, only Factory requires power. I'll have to look at the formulas. Counting bad health from population regardless of available tech sounds dubious if that's how it works.
To finally follow up/through on that:
Code:
(pCity->totalBadBuildingHealth() * iBuildingWeight)
+ (pCity->getBonusBadHealth() * iBonusWeight)
+ (pCity->getPowerBadHealth() * iPowerWeight)
- (pCity->unhealthyPopulation() * iPopWeight);
... seems to be the gist of it. No check for technologies.
Increasing
Code:
<!-- global warming threshold is # land plots * resistance. -->
   <Define>
       <DefineName>GLOBAL_WARMING_RESISTANCE</DefineName>
       <iDefineIntVal>9</iDefineIntVal>
   </Define>
should delay GW.

Thanks also @Kruos. I'll quote you on that in the initial post (I have a sentence in there somewhere about the current status of multiplayer compatibility). Well, I'll wait a bit just in case; sounds like there'll will be further sessions.

Sounds like the age old utilitarian AI vs. "role playing" AI dichotomy. If you're ever tinkering with this again but don't wanna upset the balance between those two, maybe another option ("calculating AI"?) could be an idea? (Ah, options. The best friend of the indecisive programmer.)
So long as it's not "pick your poison" as with Tech Trading vs. No Tech Trading. I've seen mods with a "Ruthless AI" option. I do have an XML file where the aspects of the war utility computation can be weighted: AI_Variables_GlobalDefines.xml#L17 There's also a parameter that moves all the personality values in Civ4LeaderHeadInfos.xml toward their median (#L203). That was intended for testing how rational the AI really acts when the role-playing elements are disabled. Predictably, I never really got around to such tests.

It's a bit much of a hassle to read through the comments in that XML file to figure out which weights are role-playing/ utilitarian. So having some form of presets could have merit. That said, players of this mod haven't really clamored for such options; requests have focused on things that the AI is just generally bad at, such as early naval war on watery maps, nuclear war or the AI being unwilling to make peace despite losing badly (that should be less of an issue in v0.97). Also, someone would have to experiment with the weights in order to find a configuration that plays well and differs noticeably from the default. (Well, as you wrote: if I'm ever tinkering with it again ...) I see some leeway for making AI attitude less decisive without making diplomacy unimportant. At some point, the behavior might differ too much from BtS though to be the default on the higher difficulty levels.
 
ust to let you know : we just finished a two hours cession without any problems (3 human players on a large map with 6 AIs. All with 0.96e).
thats wonderful.

I've seen mods with a "Ruthless AI" option
i always liked that option in revDcm mod (its origin).
 
Thanks also @Kruos. I'll quote you on that in the initial post (I have a sentence in there somewhere about the current status of multiplayer compatibility). Well, I'll wait a bit just in case; sounds like there'll will be further sessions.

Yes, there will be further sessions, I will give you some feedback for sure. ;)

EDIT: I noticed that with the mod loaded there are no musics played in game. I guess it's a matter of xml/folder config or things like that, could someone guide me to reactivate music play ingame?
 
Last edited:
EDIT: I noticed that with the mod loaded there are no musics played in game. I guess it's a matter of xml/folder config or things like that, could someone guide me to reactivate music play ingame?
Hadn't noticed your edit. I can't easily check with v0.96e right now. I normally play without sound, but I like to think that I've tested it before uploading v0.96, and it also works in my development build if I enable it on the Audio tab of the options menu. (The mod isn't supposed to disable it there by default or anything.) Still, it's conceivable that there is some problem I can't reproduce or only in multiplayer mode. What about your human opponents; also no music? Otherwise – it's possible to disable it by accident through Ctrl+M ...
 
Hadn't noticed your edit. I can't easily check with v0.96e right now. I normally play without sound, but I like to think that I've tested it before uploading v0.96, and it also works in my development build if I enable it on the Audio tab of the options menu. (The mod isn't supposed to disable it there by default or anything.) Still, it's conceivable that there is some problem I can't reproduce or only in multiplayer mode. What about your human opponents; also no music? Otherwise – it's possible to disable it by accident through Ctrl+M ...

Yes, my friends had no music with the mod loaded too. We tried to find the music option (thinking it was disabling by default) but it was not this. There is something weird with the music.
 
I've tried a Direct IP connection game with three instances of AdvCiv 0.69e running on the same PC. No problems with music. I can't test a LAN game. Also no music (no sound at all?) in single-player?
 
I've implemented, based on Leoreth's code, an XML option for rubber-banding research rates:
https://github.com/f1rpo/AdvCiv/com...e87df3d#diff-4ea5d953b4eec7480cb6d4c3d7cf1bc5
Without the TechBackwardsBonus (catch-up) part because I reckon one can get something similar enough out of the BBAI tech diffusion options. For reference:
[...] 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: [...]
--
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.
Could you tell me the UnitAIType, ActivityType and Mission(AI)Type of the two units involved? (Ctrl key in Debug mode; e.g. "attack", "GUARD_CITY", "HOLD".)

v0.97 might more or less solve the problem through new code for (detecting and) recovering from loops that involve units switching between selection groups indefinitely.
Both are: attack, MISSIONAI_DEFEND, AWAKE
I may have misunderstood this bug report. I was thinking of the kind of loop that causes the game to freeze, but I guess the loop actually plays out over several turns. In that case, the v0.97 changes I mentioned will be no help. I could imagine that the two units attempt to move onto the Jungle tile as a group, and that this causes the group to be split, leaving the CB behind. Then the Jaguar decides to regroup, returning to the CB etc. Not sure if this is consistent with your observations. K-Mod's "omniGroup" function compares the number of "impassables" (impassable terrain types plus impassable feature types) before allowing two groups to merge. Unless CB and Jaguar have the same impassable count, I don't see how they could form a group over and over.
 
I may have misunderstood this bug report. I was thinking of the kind of loop that causes the game to freeze, but I guess the loop actually plays out over several turns. In that case, the v0.97 changes I mentioned will be no help. I could imagine that the two units attempt to move onto the Jungle tile as a group, and that this causes the group to be split, leaving the CB behind. Then the Jaguar decides to regroup, returning to the CB etc. Not sure if this is consistent with your observations. K-Mod's "omniGroup" function compares the number of "impassables" (impassable terrain types plus impassable feature types) before allowing two groups to merge. Unless CB and Jaguar have the same impassable count, I don't see how they could form a group over and over.

No, it was the game freezing type.

Thanks for your help on the GW issue. I increased the number to 14 and it is working more realistically.

Looking forward to trying the new rubber band mechanism!!
 
Back
Top Bottom