Advanced Civ

If the EnumMap templates themselves don't have alot of dependencies to other parts of the code. Creating a self contained project to develop a C++ standard compatible version should be possible.
And those replacement class templates could be simpler – thus easier to write – and less performant, which the new compiler might make up for, all in all. It's just that there is a bit of a zoo of class templates in use – enum maps (and sets, i.e. enum-to-bool) optimized for various usage patterns, including 2D versions that combine two types of simpler enum maps. Maybe a dozen in total. Well, their public member functions are largely the same, template parameter lists similar, so probably one could just define some of those varieties more or less as aliases of others.

OK, it's good have these challenges (also msxml3) spelled out in one place; I'll add a link here to the manual for whoever it might come to concern. Thanks for sharing your observations.
 
There are some issues with hotseat. Only the first player gets popups, e.g. for selecting production or research. Another issue was that in a recent game built spaceship parts just disappaered for the second player.
This happened with the 48civ dll.
 
Finally got around to looking into these Hotseat problems. Thanks for making me aware. The popup issue was introduced by v0.97 four years ago; will be easy to fix. Don't know when I'll upload another release though. Turning off autosaves (or saving less frequently) would be a workaround, but I guess that's a cure worse than the disease. Remarkable that you played all the way to spaceship parts despite this bug. The disappearing parts I can't readily reproduce. I've given both players Rocketry and Composites through WorldBuilder and used the '+' key cheat (with the city bar selected in Debug mode) to immediately complete Apollo and a couple of Casings for each player. Those didn't seem to disappear in between turns, nor upon saving and reloading. Some idea about the specific circumstances, or a savegame?
 
The United Nations is completely broken in v.1.10. There are just constant reelections only and nothing else. (Just like in the real UN, I must admit. But this is not the realism I would like.).
Which version should I use, where this bug has not yet been introduced?

Also AI is too peaceful. I had an unlucky start, cornered with limited space. I was behind my competitors in every aspect, with an army more than twice as weak. And they just let me to focus on development, not even bothering to demand a tribute except for one case. Then I was the first one to discover the astronomy and expand to the new continent, while they were focused on military technologies to build their armies which they had no intention to use. After that I quickly took the lead.
In the lategame my two main rivals, both with armies comparable to mine, simply allowed me to calmly build my spaceship and launch it. Instead of trying to stop me, they began to fight each other. Boring.
All in all the K-mod AI looks significantly more challenging and adequate in its military decisions. It plays to win.
I wonder if I enable the legacy K-Mod AI aggressiveness, will AdvCiv add any of its AI features? Or will it be the same as if I were playing a regular K-mod, except for the changes in the rules?

Are there any mods for Civ5 that make the AI as competitive as this mod or K-mod?
 
Last edited:
Perhaps none of the votes was applicable? That will result in an early election (same in BtS). Though it could also be that something is broken. In a quick WorldBuilder test it seemed to work correctly. (Mass Media through WorldBuilder, complete UN by pressing "+" key in Debug mode while the city bar is selected, let an AI leader become Secretary General – then I see that leader propose Diplomatic Victory after 5 turns. Though this specific choice is randomized.)

So not even wars between the AI civs in your game until the endgame? Is there a savegame/replay/screenshot to be had? I guess it could be some rare combination of peaceful leader personalities. Well, that sounds rather improbable. Or something about the settings (that could perhaps be adjusted for a tenser game) ...

The Legacy AI option will re-enable the K-Mod logic only for decisions about war and peace and closely related matters. The bulk of the effort in terms of AI programming in AdvCiv is in that war/peace component, but there are still plenty of other AI changes that are unaffected by the Legacy option, notably to relations modifiers (things like "our mutual struggle brings us together"). It'll still mostly be AdvCiv that way as opposed to being mostly K-Mod. Well, of course AdvCiv is in no small part K-Mod in any case. :)

I can't give the K-Mod declarations of war a lot of credit for sophistication. That part is largely as in BtS (which is why I felt motivated to change it): If there's no important reason (mostly: attitude, military power ratio) not to start a war, let's roll some dice and either start war preparations now or otherwise probably sometime later. Plus more unit production than in BtS (I think AdvCiv will scale that back somewhat even with the Legacy option) and more efficiency overall. Naturally, a simple, effective mechanism can be far preferable to something complex that fundamentally doesn't work or is badly balanced. The AdvCiv AI can be tweaked for more aggression through some XML settings. Maybe that'll push it to the spot where you like what the K-Mod AI does.

Can't answer about Civ 5.
 
There were several wars between AI civs. Mostly short ones. One civ was even completely eliminated. So I was not completely correct - to some extent they used their armies.
But no one attacked me throughout the entire game, even when I was an easy target.
Only at the very end, after I launched the spaceship, minor civ, Chinese Mao, declared war on me. But he was too weak to pose any threat to me. I would like the two main rivals, Lincoln and Pacal, to have a greater will to win and try to stop me, when it became obvious that I was heading towards space victory.

As for the UN. I was elected Secretary General a few times. But there were no decisions that I could choose to put to a vote.
There was also no voting for a diplomatic victory(it was enabled in the options). Only elections of the Secretary General.
Sorry, no savegame. It's on the another PC that I don't have access to right now.

Anyway, thanks for the reply and for the mod.
 
Last edited:
Finally got around to looking into these Hotseat problems. Thanks for making me aware. The popup issue was introduced by v0.97 four years ago; will be easy to fix. Don't know when I'll upload another release though. Turning off autosaves (or saving less frequently) would be a workaround, but I guess that's a cure worse than the disease. Remarkable that you played all the way to spaceship parts despite this bug. The disappearing parts I can't readily reproduce. I've given both players Rocketry and Composites through WorldBuilder and used the '+' key cheat (with the city bar selected in Debug mode) to immediately complete Apollo and a couple of Casings for each player. Those didn't seem to disappear in between turns, nor upon saving and reloading. Some idea about the specific circumstances, or a savegame?
I unfortunately no longer have the save. I think they might have disappeared when player 1 completed a part.
 
I've pushed the bugfix for the missing popups to GitHub by now. Perhaps any remaining Hotseat players can, for the time being, get the latest version from there; will just have to rename the unzipped folder. I've also (largely?) worked around the known BtS issue with missed end-of-turn messages. It seems that, upon switching the active player at the end of a human turn, any messages triggered at the end of that turn, e.g. completed techs and buildings, get discarded. I'm now letting the DLL preserve those messages and show them again once the active player role has once again switched. A few Civ4lerts had also still not been working correctly in Hotseat. (I've seen the city-become-unhappy alert displayed over and over once it had triggered.) And the game should no longer pause for combat animations that aren't visible to the active player. For network games, I've noticed that, apparently, one human player ending their turn had (sometimes?) caused on-screen messages to be cleared for the other humans. Should also be fixed. And that's pretty much the modest changelog for v1.11 so far.

@Unsee: If you already had all the votes needed for victory, that would've blocked the victory vote. Don't know if you could've been that far ahead of everyone else by the time that you became Secretary General. Well, at worst I suppose the issue will resurface before long. Mao declaring war after space launch – yes, that sounds like too little too late, especially too late.
 
Making another run with legacy aggressiveness enabled. Hope to survive until the creation of the UN so that I can test it again.
Meanwhile, I noticed something strange in the behavior of the AI.
Mansa refuses to use his fleet to destroy my defenseless fishing boats and blockade the cities. He simply patrols with his fleet along his coast.
AI could create so many problems for me if it used its galleys to land its troops near my defenseless cities while my armies advanced on the ground.
But that's too much to ask of him.
However, once he used the galleys to land a settler with a garrison on my land and create a city, which I captured without any problems.
We need a neural network self-learning AI for the civ series, like the one that easily defeats professional players in StarCraft.
Do you think we can expect one in the near future?
Spoiler screenshot :

civ4sh.jpg

 
Last edited:
Well, how did it go? There's some little AI code I added to allow attacks by sea even when there is a land path, but I guess the conditions for that are very narrow, I practically never see it happen myself. AI naval invasions are quite heavy-handed in general, so getting those to occur opportunistically is not close at hand. The patrolling, I don't know, I could investigate with a savegame. Possible that Mansa Musa hopes to conquer your city intact or wants to keep his ships out of your territory for some greater measure of safety.

I've never trained or integrated a neural network, don't really know how much of a priority AI is e.g. in Civ 7, what their budgets are ... so I'm not sure at all what to expect. With all the attention given to neural networks, a Civ-type game seems like an obvious application. There ought to be some scientific work, maybe on Free Civ, already. The rote steps of a naval invasion – loading a mix of troops into ships, synchronizing their movement a bit – sounds like something a neural network could do well enough, even if it's not very well trained or calibrated or what. Making most moves look at least somewhat sensible and in that sense human-like, ensuring that cities are not left undefended, stacks not exposed to collateral damage ... that sounds tougher. I'd like it best if tactical decisions just didn't have such a high impact or weren't part of the game at all. City placement is something the AI can do pretty well. Tech choices also, and war and peace. It's not great, but easy enough to avoid terrible or overt mistakes. Those decisions are also more interesting for me as a player than e.g.covering my cities and resources with quick reaction forces.
 
f1rpo,
I love your mod and have been playing it almost exclusively for many years now. I play large maps. I can win on Emporer, and sometimes on Immortal if I build the pyramids. But no matter how many times I have tried on Deity, and I have tried far too many times (it's a bit of an obsession, really) I have never even come close. I used to do better a few years ago, I believe, but I think it has gotten even harder since.
It is my belief that you have changed the AI attitude towards the human player on Deity. The AI always attacks me at the very beginning. China even rushes me with archers when I'm the Mongols. If I manage to survive the beginning and get stronger, the AI will still single me out, usually dogpiling.
If I am correct and you have altered the AI attitude toward the player on Deity level, may I ask exactly where and how?
Thanks for any info, and thanks for your excellent work.
 
I'm not aware of a bias against human players when it comes to war planning or relations modifiers. Maybe the high AI production discounts and human production penalties lead the AI to conclude that human players are (much) easier targets than AI players, or some similar indirect effect. Also possible that such considerations are somehow having an exaggerated effect that outweighs considerations of fairness. I've not even finished a game on Immortal myself (I've been meaning to), and I don't think I've played past turn 100 on Deity and even that only a couple of times and not recently. So Deity is not a deliberately calibrated challenge; I see its main purpose in letting players experience what that "would be like." Well, I did already take away the 2nd free settler because I was immediately getting boxed in, and I would be happy to adjust the AI behavior, too, if I can figure out what makes it single out humans. Do you have a savegame where the AI is just about to start war preparations against you and there seems to be a better target? Alt-hover on the scoreboard in Debug mode (requiring the chipotle cheat) will show wars in preparation. If the AI has recently started to prepare for war, that might also be good enough. AI logfiles at that point would also do, if savegame compatibility is an issue. Those logs can be enabled in Assets\XML\GlobalDefines_devel.xml (low value for REPORT_INTERVAL, setting UWAI_REPORT_THRESH to -50 or -100 could also be a good idea), and logging needs to be enabled in CivilizationIV.ini. Even if I don't change anything or not soon, I might then be able to explain the AI behavior.
 
Any idea why there might be synchronization errors in the game over the network? Mistakes have become too frequent, every turn


[111729.359] WRN: Our connection to NetID 1 was closed remotely
[111729.359] DBG: Removing connection-level player info for NetID 1 (state=2)
[111729.359] DBG: SYNCLOG: Got remove player message on normal turn 452
[111729.359] DBG: SYNCLOG: Sending HotDrop notice for turn 453
[111729.359] DBG: SYNCLOG: Executing HotDrop notice on turn 452
[111729.359] DBG: SYNCLOG: Hot turn set to 454
[111729.359] DBG: SYNCLOG: Checking in NetID 1 for turn 452
[111729.359] DBG: SYNCLOG: Checking in NetID 1 for turn 453
[111729.359] DBG: SYNCLOG: Will remove NetID 1 on turn slice 454
[111729.359] DBG: SYNCLOG: All Checked In for Turn 452
[111729.359] DBG: SYNCLOG: STARTING TURN 453
[111729.375] DBG: SYNCLOG: Received EndTurn for Player 0 (NetID 0) - Checking in for Turn 453
[111729.625] DBG: SYNCLOG: All Checked In for Turn 453
[111729.625] DBG: SYNCLOG: STARTING TURN 454
[111729.641] DBG: SYNCLOG: Received EndTurn for Player 0 (NetID 0) - Checking in for Turn 454
[111729.641] DBG: SYNCLOG: Executing RemovePlayer NetID 1, TurnSlice 454 - Sender 0!
[111729.641] DBG: Removing NetID 1 from Portal!
[111729.641] DBG: Checking if we're connect complete! PeersReady=yes :: AlreadyComplete=yes
[111729.891] DBG: SYNCLOG: Executing hot join message (type=60, sender=0) on hot turn 454
[111733.984] DBG: Resetting the portal! (m_bConnectComplete=false)
[111733.984] WRN: Cleaning up MP Layer - closing connection to Net ID 0
[111733.984] DBG: Removing connection-level player info for NetID 0 (state=2)
[111734.656] WRN: Disconnecting from entire Peer Network!
[111737.313] WRN: Disconnecting from entire Peer Network!
Civ4BeyondSword2015_2024_04_22_23_13_29_595.jpg
 
I'm unfamiliar with this log; don't even know what is meant by "portal" and "hot drop". Direct IP Connection game? Not a problem with just BtS or other mods? Unless this is ultimately due to out-of-sync errors caused by the DLL (doesn't look like it in your screenshot), I can probably be no help.
 
Thank you for your long response. I will try to keep some save logs in the future. Actually, while I've played and lost a huge number of Deity games, and have won a number on Emperor, I've not played hardly any on Immortal. I'm trying that now, and have also been attacked right out of the gates and numerous times, so maybe that's just the way it is at the highest difficulties.

However, I really do think the AI considerations have been out of whack at Deity sometimes, at least once I can survive long enough to get fairly strong and am still being what I feel is overly targeted. But it's interesting to hear that it not due to any changes that you have deliberately programmed. While I will try to get you some save logs on Deity in the future, the truth is that I've convinced myself over and over again that it is senseless to even try to play at that level. So I'm focusing on Immortal now. Perhaps Emperor is actually best and the most fun, but I'm still up for the challenge at Immortal for the time being.

Once again, thanks for your response, and thanks for the best AI in the best 4X ever made, imho!
 
I'm unfamiliar with this log; don't even know what is meant by "portal" and "hot drop". Direct IP Connection game? Not a problem with just BtS or other mods? Unless this is ultimately due to out-of-sync errors caused by the DLL (doesn't look like it in your screenshot), I can probably be no help.
Log network-2056.txt, direct IP, and via GS. This is what PythonDbg.log says

16:15:36 TRACE: Error in gameUpdate event handler <function onGameUpdate at 0x19497FB0>
16:15:36 TRACE: 'ascii' codec can't encode characters in position 9-12: ordinal not in range(128)
16:17:35 WARN : SpyUtil - incorrect previous game turn found, ignoring

16:23:58 TRACE: Error in gameUpdate event handler <function onGameUpdate at 0x19497FB0>
16:23:58 TRACE: 'ascii' codec can't encode characters in position 9-12: ordinal not in range(128)
PY:OnUnInit
UnInit Python

PythonErr.log
Traceback (most recent call last):
File "BugEventManager", line 368, in _handleDefaultEvent
File "OOSLogger", line 29, in onGameUpdate
File "OOSLogger", line 129, in writeLog
UnicodeEncodeError: 'ascii' codec can't encode characters in position 9-12: ordinal not in range(128)
Traceback (most recent call last):
File "BugEventManager", line 368, in _handleDefaultEvent
File "OOSLogger", line 29, in onGameUpdate
File "OOSLogger", line 129, in writeLog
UnicodeEncodeError: 'ascii' codec can't encode characters in position 9-12: ordinal not in range(128)


There is no problem in other mods (K-Mod, vanilla)
 
Last edited:
@Conqueror Worm: I've started an Immortal game and played until 100 BC. My only neighbor, Isabella, did attack me with Archers in 400 BC despite Pleased attitude (same religion). Having checked the logs, she only seemed to have started war preparations when she discovered Iron Working, however. One might say that gave her the reassurance that she would be able to conquer multiple cities in the medium term. I also suspect that she hadn't quite gotten to Pleased attitude at the time that she started preparing. In 1200 BC, I already feared that she was going to attack as she had 5 Archers in her city closest to mine, but Debug info and logs show that the had no war plan at that point. She was only expecting to conquer one city then, and this was barely worth the trouble. At such an early turn, fairness was also duly taken into account. I didn't feel targeted unfairly in this game. It did feel a little unfair that I was boxed in at 4 cities without access to metals and therefore had only Chariots and (potentially) Archers to defend myself with. This surely made me an attractive target once Isabella got Swordsmen. I managed to scare off Isabella's stack – still just Archers and one Spearman, and in 200 BC Brennus attacked Isabella. I took a square peace treaty then, and he's taken a Spanish city. The log shows that Isabella had foreseen that danger but hadn't given it much weight. I doubt that Brennus will overwhelm Isabella soon; looks like she'll go back to Pleased attitude toward me before long. Maybe we can get along until I get a stack of Catapults (9 turns to Construction); I might still win. Perhaps ultimately not the right game to determine whether humans have enough of a chance to avoid early wars. Some tweaking may well be needed; but, fundamentally, the AI logic seems to work as intended.

If we can agree on the settings, we could perhaps both try playing the same game on Immortal. I wouldn't be heartbroken to abandon my meager 4-cities edge-of-the-jungle kingdom. Perhaps others would want to play along as well. Or maybe at some later time; then you could first test the water and see whether Immortal is balanced enough to be enjoyable.
Maybe also not quite the scratch that keldath is itching for. :)

@Rawwwrr: GS is GameSpy? But that's defunct ... Anyway, also with Direct IP, you say. I guess the SpyUtil warning can't mean much; without the Better Espionage Screen (not present in AdvCiv), that module shouldn't really be in use. The codec warning might be related to Cyrillic characters; also doesn't sound like it could sever the network connection (particularly not when there's no problem in K-Mod). Don't know what to make of the gameUpdate event handler. Doesn't happen, of course, if I just set up a network game locally by connecting to localhost. :undecide:
 
@Rawwwrr: GS is GameSpy? But that's defunct ... Anyway, also with Direct IP, you say. I guess the SpyUtil warning can't mean much; without the Better Espionage Screen (not present in AdvCiv), that module shouldn't really be in use. The codec warning might be related to Cyrillic characters; also doesn't sound like it could sever the network connection (particularly not when there's no problem in K-Mod). Don't know what to make of the gameUpdate event handler. Doesn't happen, of course, if I just set up a network game locally by connecting to localhost. :undecide:
By GS, I meant the server raised by Zulan(?) (https://github.com/civ4-mp/client ) In the game, just click "internet games"
 
@Rawwwrr: I hadn't noticed the PythonErr.log you've posted. I suspect that your system's locale settings cause the encoding to fail. It may help (can't easily test it myself) to replace
pFile = open(szNewFilename, "w")
with
pFile = codecs.open(szNewFilename, "w", "utf-8")
in Assets\Python\Contrib\OOSLogger.py
and to import codecs near the top of that file. The fact that the OOSLogger attempts to write a log shows that there is in fact an OOS error. I'm guessing that the unhandled UnicodeEncodeError prevents the usual on-screen OOS error message from being shown. So fixing the encoding issue will probably not fix the disconnects. The cause of the OOS error will be difficult to find if I can't reproduce it. The (repaired) OOS log could be helpful, but I would need to compare the logs of at least two different human players – that will show how the game state has diverged at the time that the DLL notices that the game is no longer in sync. I assume that the disconnects occur during AI turns? MPLog.txt would then be interesting, provided that RandLog and MessageLog are enabled in Civilization IV.ini. Setting __LOG_ALL to 1 in Assets\Python\CvEventManager.py could also narrow things down a bit; this will cause some game events to be logged to PythonDbg.log. Furthermore, I could provide a DLL with logging of AI decisions enabled (that log can only be activated through the DLL). A different approach would be to go back to earlier versions of AdvCiv to determine which one introduced the issue, but that's quite laborious for you, and I'd probably still have to compile intermediate versions of the DLL to pinpoint the specific DLL change that is responsible (bisection).
 
Top Bottom