Advanced Civ

"Fatal error: memory allocation failure-exiting program reason bad allocation." It looks like I've reached the limit, departures through the move, at best. Played with modified CIV4WorldInfo.xml, CIV4ReligionInfo.xml. I also used the CivilizationIV.ini settings, which allowed in the XXL World mod to move much further without crashes, albeit with much longer downloads. EXE has also been patched for more RAM usage

<WorldInfo> <Type>WORLDSIZE_ULTRA</Type> <Description>Ultra</Description> <Help>Ultra World</Help> <iDefaultPlayers>48</iDefaultPlayers> <iUnitNameModifier>0</iUnitNameModifier> <iTargetNumCities>11</iTargetNumCities> <iNumFreeBuildingBonuses>20</iNumFreeBuildingBonuses> <iBuildingClassPrereqModifier>175</iBuildingClassPrereqModifier> <iMaxConscriptModifier>150</iMaxConscriptModifier> <iWarWearinessModifier>-95</iWarWearinessModifier> <iUnitCostPercent>84</iUnitCostPercent> <iGridWidth>102</iGridWidth> <iGridHeight>102</iGridHeight> <iTerrainGrainChange>3</iTerrainGrainChange> <iFeatureGrainChange>3</iFeatureGrainChange> <iResearchPercent>235</iResearchPercent> <iTradeProfitPercent>5</iTradeProfitPercent> <iDistanceMaintenancePercent>130</iDistanceMaintenancePercent> <iNumCitiesMaintenancePercent>5</iNumCitiesMaintenancePercent> <iColonyMaintenancePercent>10</iColonyMaintenancePercent> <iCorporationMaintenancePercent>5</iCorporationMaintenancePercent> <iNumCitiesAnarchyPercent>3</iNumCitiesAnarchyPercent> <iAdvancedStartPointsMod>150</iAdvancedStartPointsMod> </WorldInfo>
 

Attachments

  • ENAD1N AD-1945-I.CivBeyondSwordSave
    6.3 MB · Views: 7
  • CivilizationIV.rar
    2.7 KB · Views: 8
Last edited:
I've been able to load this savegame with a 48-civ DLL and the XML you've posted. Not sure if there were supposed to be multiple human players; I've loaded it with just one human. I guess the idea is to speed up AI turns through the Simultaneous Turns MP option; don't know if that actually helps – at least I don't see how this would save time used for AI calculations. Windows Task Manager shows about 2.5 GB memory used by Civ4BeyondSword.exe after loading, then near 2.9 GB upon ending the turn. Seems to stay at that level. Turns take a couple of minutes each but don't crash for me. I've advanced by 4 turns. I guess these are 41 616 tiles (I don't dare switching on Debug mode to check :)), rather a lot of land, it seems (ca. 50%?), 48 civs, mostly large empires. I don't know if MAFs are to be expected with these settings. Just the regular graphics ... I would've assumed that this is still safe. But I don't know if I want to go hunt for possible wasteful memory use in the DLL just based on this hunch.

I also don't know why I'm not getting those failures. My PC is ten years old (and was already somewhat outdated when I built it); well, I'm sure we both have as much main memory as the game can use, which should be all that matters. In your CivilizationIV.ini I only notice the enabled RandLog as a bit wasteful (logging of all RNG calls), but that should at most affect speed a little bit, not memory use.
I also used the CivilizationIV.ini settings, which allowed in the XXL World mod to move much further without crashes, albeit with much longer downloads.
Which settings specifically do you think have had this effect – no/ fewer MAFs, longer turn times (if I understand that correctly)? I've never played maps that really push the limits, and I don't think I've ever experienced a MAF at all, with any mod; so I don't know how best to work around those.

Expanding the scoreboard causes animations to stutter a bit, but I guess it's not too bad under the circumstances. City screens take 5 seconds to load and close; this seems pretty annoying. I don't think it's just because of the camera movement – that works fairly smoothly outside of the city screen (though transitioning into Globe view takes 10 seconds). The city screen delay might be worth for me to look into, if I can reproduce a significant delay in a less gigantic game – I wouldn't want to try feeding this savegame into a profiler.
 
Seems to stay at that level.
In my case, the consumption is about 3.5GB.
(I don't dare switching on Debug mode to check :))
I could try to do it myself, but I don't know what to do at all)
(ca. 50%?)
It's hard to say)
Turns take a couple of minutes each but don't crash for me.
In my case, the move is loaded for about 53 seconds
I also don't know why I'm not getting those failures. My PC is ten years old (and was already somewhat outdated when I built it); well, I'm sure we both have as much main memory as the game can use, which should be all that matters. In your CivilizationIV.ini I only notice the enabled RandLog as a bit wasteful (logging of all RNG calls), but that should at most affect speed a little bit, not memory use.
Looks like I uploaded the wrong one ini:hammer2:
Which settings specifically do you think have had this effect – no/ fewer MAFs, longer turn times (if I understand that correctly)? I've never played maps that really push the limits, and I don't think I've ever experienced a MAF at all, with any mod; so I don't know how best to work around those.
Perhaps these
; Don't skip frames if falling behind BinkNoSkip = 0 ; Copy entire image each frame, not just dirty pixels BinkCopyAll = 0 ; Enable Trilinear Filtering for the Minimap Minimap Trilinear Filter = 0
Expanding the scoreboard causes animations to stutter a bit, but I guess it's not too bad under the circumstances. City screens take 5 seconds to load and close; this seems pretty annoying. I don't think it's just because of the camera movement – that works fairly smoothly outside of the city screen (though transitioning into Globe view takes 10 seconds). The city screen delay might be worth for me to look into, if I can reproduce a significant delay in a less gigantic game – I wouldn't want to try feeding this savegame into a profiler.
I just turned off the animation, as I was advised here. My city screens load a little slower than usual, but nothing critical, apparently the difference in PC is still palpable.(ryzen 5600x 16gb RAM)
 
In my case, the consumption is about 3.5GB.
Why this difference ... Hardware can't be responsible, I think. Screen resolution (I only have 1920x1200) – also doubtful.
Looks like I uploaded the wrong one ini:hammer2:
Perhaps these [...]
I don't have much of a clue about those. I would've thought that Bink settings only affect wonder movies. What else could it be– not using extra artwork, I assume, e.g. DeepWell's graphics pack. "Animations Frozen" and "No Particle Effects" on my end. No Sound - but surely that can't matter. If you want to zip up your BUG settings (My Games\Beyond the Sword\AdvCiv\Settings), I could give it a try with those, to see if that makes a difference.
I could try to do it myself, but I don't know what to do at all)
When holding down Shift, hovering over the rightmost tile, just where the map wraps around, should show the highest x coordinate, i.e. the map width minus 1. Same for the height near the top of the map. Ctrl+Z for Debug mode. But I assume that, if WorldInfo says 102x102, it's going to be that times 2x2. Unless different dimensions are set by the map script, that is.
In my case, the move is loaded for about 53 seconds [...] My city screens load a little slower than usual, but nothing critical, apparently the difference in PC is still palpable.(ryzen 5600x 16gb RAM)
I see, you're two to three times faster. OK, then I won't bother with the city screen for now.
 
I do not think that the settings BUG at least some effect on it, I rolled them back to their original settings, crashes were still, on the speed of loading the move also had no effect. It seems Debug mode does not work in games started in a network game. In single player games it works. I had maximum graphics settings, now applied MemSaver = 1 (Allows some memory savings *** ALT-TAB WILL NO LONGER FUNCTION) and got this error. Then changed graphics settings to low, MAF crashes disappeared, at least for now. So apparently it was all about the graphics settings.
 

Attachments

  • 2023-05-16_160844.png
    2023-05-16_160844.png
    16.1 KB · Views: 36
I've never tried the MemSaver setting. I use High Quality for pretty much all the graphics, except that I've disabled animations, particle effects and anti-aliasing (in the hope of reducing power consumption a little by reducing the workload of the GPU), I don't know what effect, if any, the Render Quality setting has. The others concern terrain and movies. I wouldn't expect terrain graphics to consume a lot of memory. Has your memory use decreased with the lower quality settings? (You wrote 3.5 GB earlier.)
It seems Debug mode does not work in games started in a network game. In single player games it works.
Just for future reference, the mod does allow Debug mode in multiplayer through ENABLE_DEBUG_TOOLS_MULTIPLAYER in GlobalDefines_devel.xml. I've kept it disabled by default (as in BtS) as an extra precaution against inadvertent cheating in multiplayer. ENABLE_AUTOPLAY_MULTIPLAYER above could also be helpful.
 
Has your memory use decreased with the lower quality settings?
Yes, it has decreased, using these settings (screenshot), was 3218 megabytes after two turns.
 

Attachments

  • 2023-05-16_234328.png
    2023-05-16_234328.png
    521.8 KB · Views: 32
  • 2023-05-16_234253.png
    2023-05-16_234253.png
    18.4 KB · Views: 33
Regrettable if you'll indeed have to use lower quality graphics, especially of terrain textures. Well, better than no solution, and I have don't have other suggestions to try.
 
Regrettable if you'll indeed have to use lower quality graphics, especially of terrain textures. Well, better than no solution, and I have don't have other suggestions to try.
if it's not too much trouble, can you check with yourself again? I have already started MAF errors on the most minimal settings.
 

Attachments

  • ENAD1N AD-1969-I.CivBeyondSwordSave
    6.9 MB · Views: 8
I've tried it with v1.08.2 this time instead of my local version, but I don't think this is making a difference. I'm at 2.6 GB after loading the savegame. Then, if I pan all over the map (by dragging the mouse across the minimap), it goes up to 3.2 GB, and no more than 3.25 GB after ending the turn twice. So this still works for me with the settings previously described, i.e. high texture quality. I've also done a quick comparison of the memory consumed by K-Mod vs. AdvCiv if I just launch the Earth AD 1000 scenario. For K-Mod, I saw 487 MB in use, for AdvCiv 489 MB. Also, memory consumption only shoots up at the very end of loading your savegame and then even more when moving the camera, which suggests to me that the handling of graphics in the EXE is using up most of the memory and that it's not something that the mod is causing or that could easily be prevented by a mod.
 
Thanks. :) Took me a while to find some motivation for putting together the release. I think I can really only make very modest changes going forward, preferable not requiring documentation.
 
Thanks. :) Took me a while to find some motivation for putting together the release. I think I can really only make very modest changes going forward, preferable not requiring documentation.
Heya - grats on the new 1.09 release! Otsukaresama!

I've recently moved to Paris for a new job, so had to take some time out from playing and posting, but I just downloaded it and will give it a spin today.

Thank you for all your efforts. AdvCiv is the best version of the game, you're right up there with Soren and Sid.
 
Thank you for all you do @f1rpo :) I finished a very exciting game with version 1.08 and I had a lot of fun (it had interesting vassal dynamics, I got invaded by two civilizations who launched a challenging aquatic invasions on two fronts, and I won the game with a nail-biter finish with a rival civilization's spaceship arriving on the same turn as me but with me winning only due to turn order).

I'm not sure if it's relevant still in version 1.09, but I found a small bug in 1.08. My save files do still load and show the same behavior in 1.09, but I'm not sure if the bug arises in a fresh 1.09 game yet. I was looking at the Economic advisor and I was trying to figure out why Commerce :commerce: from Buildings was more than 8 from the Palace. I found out that the bonus from Bureaucracy goes into there, but I couldn't figure out why it would sometimes be some high number like 59 even when only basic Civics were being used. I never figured out what's going on there, but I did find a small, seemingly unrelated bug: late in the game, I had the situation where I was receiving 3 extra :science: and 2 extra :gold: seemingly out of nowhere. I went into World Builder and erased my whole civilization except for an isolated island in the ocean to confirm that I was getting that extra stuff for free out of nowhere. I understand that the game always gives players 1 extra "ghost" :science: to avoid divide-by-zero errors, but I don't know where the extra stuff is coming from. I've attached the save where I was tinkering with World Builder, and also a save from my playthrough (where it has lots of commerce from Buildings and where you can see the ghost :science:and :gold: if you flip into anarchy (subtracting the :gold: from resource trading, of course).

I'm guessing that it's some rounding issue with large numbers or many iterations. It's not a game-breaking bug by any stretch of the imagination, but hey, if you're an accountant, then maybe you'd like to poke around and see where the discrepancy comes from :)

P.S. I've also attached the save from the double aquatic invasion just because it was a very fun scenario and it was very satisfying to re-take my cities back from the invaders. This kind of thing never happens in the base game. AdvCiv makes Continents games, and the whole naval aspect of the game, much more fun in my opinion, thanks again f1rpo :)
 

Attachments

  • Bugged commerce.CivBeyondSwordSave
    264.2 KB · Views: 8
  • Excerpt from game.CivBeyondSwordSave
    277.8 KB · Views: 7
  • Double aquatic invasion.CivBeyondSwordSave
    256.7 KB · Views: 9
Last edited:
This has been helpful. The Financial Advisor attributes to "Buildings" all commerce that wasn't already tallied under "Worked Tiles" or "Trade". Indeed, the multiplier from Bureaucracy is not taken into account for worked tiles and trade, so all of it ends up in the buildings stat. Correcting that with correct rounding would be laborious, so I'll just relabel "Buildings" as "Buildings, Civics Factor" when the player is in Bureaucracy. ("Factor" sounds a little strange, but "Modifier" or just "Civics" would suggest that the boosts to terrain improvements, e.g. Universal Suffrage, are also included.) Well, in your savegames, you don't even run Bureaucracy. Turns out that cities in disorder were being excluded from the worked tiles and trade tallies but included in the commerce total and therefore included under buildings. I'm fixing that by excluding disorderly cities from the total. Seems that BUG introduced the whole commerce breakdown, so this issue was introduced at that point.

Then, the ghostly research and gold. Those civ-wide totals are cached and supposed to be increased or decreased whenever the amount of special commerce produced by any city changes. Apparently, this wasn't happening in some circumstances, but one can't tell from a savegame with evidently incorrect totals what went wrong and when. So I've added a consistency check that simply compares the cached total with the current sums over all cities, and development builds of the DLL execute this check periodically, usually several times per turn. Then I've run a new game on AI Auto Play and pretty soon found out that the problem occurs when a capital gets captured – as was yours in your game. I had changed some code there to choose a new capital before ultimately deleting the old capital because that made it easier to announce that the capital had changed. As a result, the trade yield of the old capital wasn't properly subtracted from the owner's commerce totals.

(And I've found and fixed another small issue that probably already exists in BtS: When a Creative player loses a city, the free culture rate isn't subtracted from the player's total culture rate. But that total has no impact on gameplay and AdvCiv even hides it by default.)

I saw in your replay (Shift+F1 in Debug mode) that Mehmed declared war on you by accepting China(?) as his vassal and later convinced Ragnar to join. I'm guessing that Ragnar had already been preparing for a dogpile war – his units showed up just a few turns after his declaration of war. Whereas Mehmed may have needed some time to prepare his forces. Maybe that's how both fleets arrived at your coast at about the same time. Seems that Shaka helped you a lot by successively attacking Ragnar and Mehmed on their home continent. Funny that you had such bad relations with Shaka all the same. Did he end up coming close to a Space victory?
 
This has been helpful. The Financial Advisor attributes to "Buildings" all commerce that wasn't already tallied under "Worked Tiles" or "Trade". Indeed, the multiplier from Bureaucracy is not taken into account for worked tiles and trade, so all of it ends up in the buildings stat. Correcting that with correct rounding would be laborious, so I'll just relabel "Buildings" as "Buildings, Civics Factor" when the player is in Bureaucracy. ("Factor" sounds a little strange, but "Modifier" or just "Civics" would suggest that the boosts to terrain improvements, e.g. Universal Suffrage, are also included.) Well, in your savegames, you don't even run Bureaucracy. Turns out that cities in disorder were being excluded from the worked tiles and trade tallies but included in the commerce total and therefore included under buildings. I'm fixing that by excluding disorderly cities from the total. Seems that BUG introduced the whole commerce breakdown, so this issue was introduced at that point.

Then, the ghostly research and gold. Those civ-wide totals are cached and supposed to be increased or decreased whenever the amount of special commerce produced by any city changes. Apparently, this wasn't happening in some circumstances, but one can't tell from a savegame with evidently incorrect totals what went wrong and when. So I've added a consistency check that simply compares the cached total with the current sums over all cities, and development builds of the DLL execute this check periodically, usually several times per turn. Then I've run a new game on AI Auto Play and pretty soon found out that the problem occurs when a capital gets captured – as was yours in your game. I had changed some code there to choose a new capital before ultimately deleting the old capital because that made it easier to announce that the capital had changed. As a result, the trade yield of the old capital wasn't properly subtracted from the owner's commerce totals.

(And I've found and fixed another small issue that probably already exists in BtS: When a Creative player loses a city, the free culture rate isn't subtracted from the player's total culture rate. But that total has no impact on gameplay and AdvCiv even hides it by default.)

I saw in your replay (Shift+F1 in Debug mode) that Mehmed declared war on you by accepting China(?) as his vassal and later convinced Ragnar to join. I'm guessing that Ragnar had already been preparing for a dogpile war – his units showed up just a few turns after his declaration of war. Whereas Mehmed may have needed some time to prepare his forces. Maybe that's how both fleets arrived at your coast at about the same time. Seems that Shaka helped you a lot by successively attacking Ragnar and Mehmed on their home continent. Funny that you had such bad relations with Shaka all the same. Did he end up coming close to a Space victory?
Thanks for looking into it, I'm glad I could help somehow :)

Here's a summary of the diplomatic events which resulted in me getting double aquatic invasions. Early in the game, Saladin to my east planted a city behind my line of settlement, in what I had planned to be my civilization's core. Eventually, Saladin's exclave was pretty swamped by my Culture. Saladin traded away that city (Najran) in exchange for my Rifling--a rare sight to see. Then, as I had been building up to invade China (and China was building up forces to invade me), Saladin voluntarily asked to be my vassal. I declared war on China and Saladin followed. During the war, Saladin stopped being my vassal, presumably because he built enough forces or conquered enough Chinese land. Then, with only one far-away Chinese city left to be conquered, I sued for peace with China. Then I back-stabbed Arabia and invaded, while Saladin was still attacking Mao Zedong. When Saladin had only a few cities left, he became a vassal of Mehmed, which caused Mehmed to automatically declare war on me. Then, Mehmed somehow bribed Ragnar into invading me, too.

As for the end-game, I realized that it would be useless to conquer Churchill, as it wouldn't be enough to win by Domination, and it'd just slow me down as someone else might go for space. But, it turned out that Churchill had the same idea. Despite having only 9 cities, Churchill somehow was very quick to research and build Spaceship parts. I thought I was doing well, but then Churchill sabotaged a Stasis Chamber and launched before I could. I tried invading England but my army was nuked into oblivion and so I lost the game. So, I said "two can play that game", shamelessly reloaded to an earlier bit, and put some effort into sabotaging Churchill's spaceship parts. In this way, I barely managed to launch with 1 engine, 3 thrusters, and 4 casings, which I believe was 16 turns to victory. Churchill launched his fully-prepared spaceship when I had 10 turns to go, which meant that I won only by turn order 10 turns later. As for Shaka, he was not engaged in the space race and was focused on conquering the whole eastern continent. You can also see that due to the late game, Global Warming was significant, which is an aspect of the modded game that I appreciate. You can see that as my land experienced desertification, I reached "peak food". Anyway, I thought that it was a fun and interesting game, thanks for making it possible :)
 

Attachments

  • Pacal won by turn order.CivBeyondSwordSave
    309.1 KB · Views: 10
As for Shaka, he was not engaged in the space race and was focused on conquering the whole eastern continent.
Yes, I see. In your earlier savegame, he seemed off to a good start conquering Mehmed in the middle of the 20th century. But then cities start changing hands back and forth and Mehmed is still not defeated at the end of the game in the early 21st century. Pity; Shaka being somewhat close to Domination and threatening the Anglomayan continent would've made things (even) more interesting in the end.
 
Just came back into this mod after a long time off - great to see it still being developed.

A couple of issues:
- in multiplayer, it seems everyone other than the host has a serious graphical issue where they can't see their terrain. anyone else encounter it?
- anyone else think the espionage mission to forment unhappiness is way too strong? When the AI succeeds its first attempt with one, it cripples you. I had modded it to cost about 50% more points and be about 33% less effective previously and had largely forgotten about it, but playing with 1.09 reminded me again how strong it is for the AI
 
May I ask why the values for iTechCostModifier in CIV4EraInfos.xml get changed between these AI mods and from the civ4 defaults?

XML:
<!-- advc.910: Was 4 in BBAI, 6 in K-Mod. -->
            <iTechCostModifier>5</iTechCostModifier>
            <!-- advc.groundbr: start -->
 
Top Bottom