Debug Panel - Reveal All - CTD

sman1975

Emperor
Joined
Aug 27, 2016
Messages
1,370
Location
Dallas, TX
Hello,

I'm working on a quite extensive scenario (lots of units) on an oversized map (146x90). It's taxing the Civ5 game engine about as much as is possible, but generally speaking, the mod behaves well-enough in the early stages.

As the 84 turn scenario gets to Game Turn 32 or so, I've noticed if I use the "Debug Panel" (activated when you press the tilde key) then click on the "Reveal All" - where you can see all the tiles and units without Fog of War - the game thinks about it for a couple of seconds, then unceremoniously croaks without warning.

I can repeat this error using a saved game on a given turn. On that same saved game, I can also play along another 20 turns without problem - assuming I don't try to "Reveal All". Once I click on that on latter turns, ** BOOM**...

Does anyone have any ideas of the kinds of things that might cause this kind of crash?

Thanks.
 
Have you tried using IGE instead? (it also provides the same option).
I kind of suspect it may call the same methods though, but I'd say it's worth a shot anyways.
 
Does anyone have any ideas of the kinds of things that might cause this kind of crash?

Size of map, number of units, number of farm improvements, lack of (usable) graphics memory (doesn't matter how whizzy your GPU card is, Civ 5 is an old game and limited in what it can make use of), patch version of your graphics card - to name the more common ones.

Stop revealing the map in one go, try placing aircraft (that will reveal their recon range of tiles) to just expose the bit you're interested in, then delete the aircraft to hide the units and place another to see a bit more of the map
 
I was hoping it was a capacity problem, and not necessarily due to my poor LUA skills... :crazyeye:

Earlier on, I looked at the IGE code for their "Reveal All" routine. I tried to use that mod to 'reveal all' but it also crashed the game most of the time - I guess the game state was already compromised at that point, resource-wise.

I even tried to copy the 'reveal all' function from IGE into my mod and have it fire on game turn 0 for all human players. Although I'm pretty sure the code works as it should, the game hung (or is it hanged?) up in the load part, taking several minutes to reach the "Press any key to continue...." button. In IGE it takes a few seconds.

May have to look at that again to see if I can speed it up a bit. But I'm a bit torn when/how/if to intro the feature into the mod. It's a "WW2 in Europe" map, so generally speaking, most sides had a decent idea where the major enemy troop concentrations were - very few surprises at the Operational, and even fewer at the Strategic level. Exactly how to manage this feature is uncertain in my design, and as we can see - implementing any design could be problematic if the game simply cannot handle full or partial reveals manageably.

Thanks for this suggestions - it makes me feel better thinking it might be due to game limits and not necessarily my coding limits.... :)


P.s. I'm wrapping up this behemoth of a mod (semi-replacement game), but am having a couple of those "no way this code can crash the game... but does..." errors. Having invested, oh let's say 1000+ hours in total development, and IMVHO, it's beautiful! Looks like a real WW2 quality mod. Lots of UU's, custom map and events, and 17 playable civs. Plays quite well....

Well, until it crashes, perhaps due to these pesky resource problems. I'm looking for anyone with development experience to "polish off" the mod to bring it to a publishable state.

If anyone has any ideas, please post them in the mod's discussion thread:

https://forums.civfanatics.com/thre...t-war-scenarion-the-war-in-europe-ww2.641927/

Thanks!
 
Last edited:
OK - after much testing (and gnashing of teeth) - I narrowed my problem down on the mysterious CTD's with the 'Reveal All' debug option.

The mod occasionally would spawn an assortment of units (free infantry, artillery, and fighters/bombers). I used @LeeS' "unit spawn handler" to physically place these new units. It worked wonderfully - as one would expect.

However, the mod would consistently crash a turn or two later. Using the 'Reveal All' would also cause crashes, and loading a saved game was simply out of the question.

So - when I took the Fighters and Bombers out of the rotation, the crashes all stopped... The mod will spawn land/sea units just fine, but for some reason, when aircraft are added, it just can't handle it. I've used @LeeS' handler many times and it's a great piece of code. But for some reason, "somewhere" in my mod, I introduce some kind of unstable state that manifests itself as a crash when air units are spawned. BTW, the same crashes occurred when I used a simple 'InitUnit' method as a test. I also took care to ensure the spawn X/Ys were always a friendly city.

It's a reminder to me about how unprotected the LUA programming environment is, and how important it is to "code defensively..."
 
Not sure if anyone cares or not, but just in case someone is looking in the distant google future...

The cause of my CTDs when "revealing all" was traced back to a French air unit called the "Bloch MB.152 Fighter" from Danrell's French WW2 Units Pack.

https://forums.civfanatics.com/resources/civ5-wwii-unit-pack-02-france.17400/


For some reason, when I tested the model as the active player, it worked just fine - it behaved like a fighter is supposed to. I then assumed the air units worked properly, so the error must be elsewhere.

But, after much testing, I noticed that whenever the AI was using this particular unit, at some point it introduced the instability that crashed the game. I'm not sure if the fighter unit was attacking, intercepting, relocating, etc. BTW - 'quick move/attack for single player' settings were set to ON. During testing, I had a saved game that would crash reliably during the AI French player turn. When I deleted this unit, the game played on. When the unit stayed in the game, it crashed. So, I removed the unit, and played several other test games, all without incident.

I'm not saying the model is bad, but for some reason the unit definition files I've used for Danrell's fighter units dozens of times previously may not be quite right for this particular instance.

There also may still be other "capacity" issues using such a large map with so many units, but this took out a biggie...


EDIT: Which begs the question: what is it about a unit that could crash a game when the AI uses it, but not when the human player uses it? With animations "off" I don't think this is the issue. But, who knows...?

Also - perhaps the issue with the unit is a particular instance and not the basic unit definition itself? What can happen to an air unit that can somehow allow it to crash the game later on?
 
Last edited:
Update 27....

After removing the MB.152 from my test game, later on I experienced a similar crash. After a little sleuthing, I found that a second fighter unit from the same unit pack caused the same problem. It is the LN-401 Fighter. It was later in the Tech Tree, so appeared later in the game.

While the unit on the map didn't (always) directly cause a CTD (at least not yet in testing), when it is in the game, when I use the "Reveal All" from debug, the game will crash. Also, loading a saved game is quite difficult and almost always resulting in a CTD. When both of these units are NOT on the map, the Reveal All works, and there are no problems loading saved games.

Not sure what the issue is with these 2 fighter units, but I've tried several different unit definitions/art defines examples, all resulting in similar crashes. There must be something inside the models themselves that I just can't see or understand.

And remember: when I'm playing as France, and using these units, there are no problems at all. It's only when the AI uses them that the crashes start, early and often...

Anyways, FWIW....
 
Top Bottom