Quick Modding Questions Thread

Hi. Someone was kind enough to create a storm kind of a feature for me. However, while I successfully created a new feature out of it (code below), the game starts just fine, and the feature shows up properly, the game crashes (or, more accurately, fails to respond anymore).

The question for today is: why, and what do I need to do to make it stop?
The codes are below

Artdefines_feature:
Spoiler :
<FeatureArtInfo>
<Type>ART_DEF_FEATURE_STORM</Type>
<bAnimated>0</bAnimated>
<bRiverArt>0</bRiverArt>
<TileArtType>TILE_ART_TYPE_NONE</TileArtType>
<LightType>LIGHT_TYPE_SUN</LightType>
<fScale>0.01</fScale>
<fInterfaceScale>0.01</fInterfaceScale>
<Button>,Art/Interface/Buttons/TerrainFeatures/Fallout.dds,Art/Interface/Buttons/BaseTerrain_TerrainFeatures_Atlas.dds,1,3</Button>
<FeatureVariety>
<FeatureArtPieces>
<FeatureArtPiece>
<ModelFile>Art/Terrain/Features/rain.nif</ModelFile>
<Connections></Connections>
</FeatureArtPiece>
</FeatureArtPieces>
<FeatureDummyNodes/>
<bGenerateRotations>0</bGenerateRotations>
<VarietyButton>Art/Interface/Buttons/TerrainFeatures/Fallout.dds</VarietyButton>
</FeatureVariety>
</FeatureArtInfo>
</FeatureArtInfos>

and featureinfos:
Spoiler :

<FeatureInfo>
<Type>FEATURE_STORM</Type>
<Description>Storm</Description>
<Civilopedia>Storm</Civilopedia>
<ArtDefineTag>ART_DEF_FEATURE_STORM</ArtDefineTag>
<YieldChanges/>
<RiverYieldChange/>
<HillsYieldChange/>
<iMovement>2</iMovement>
<iSeeThrough>0</iSeeThrough>
<iHealthPercent>0</iHealthPercent>
<iDefense>0</iDefense>
<iAppearance>2000</iAppearance>
<iDisappearance>1000</iDisappearance>
<iGrowth>1000</iGrowth>
<iTurnDamage>5</iTurnDamage>
<iWarmingDefense>0</iWarmingDefense>
<bNoCoast>0</bNoCoast>
<bNoRiver>0</bNoRiver>
<bNoAdjacent>0</bNoAdjacent>
<bRequiresFlatlands>0</bRequiresFlatlands>
<bRequiresRiver>0</bRequiresRiver>
<bAddsFreshWater>0</bAddsFreshWater>
<bImpassable>0</bImpassable>
<bNoCity>0</bNoCity>
<bNoImprovement>0</bNoImprovement>
<bVisibleAlways>0</bVisibleAlways>
<bNukeImmune>0</bNukeImmune>
<OnUnitChangeTo/>
<TerrainBooleans>
<TerrainBoolean>
<TerrainType>TERRAIN_OCEAN</TerrainType>
<bTerrain>1</bTerrain>
</TerrainBoolean>
<TerrainBoolean>
<TerrainType>TERRAIN_SNOW</TerrainType>
<bTerrain>1</bTerrain>
</TerrainBoolean>
</TerrainBooleans>
<FootstepSounds>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_HUMAN</FootstepAudioType>
<FootstepAudioScript>AS3D_UN_FOOT_UNIT_SNOW</FootstepAudioScript>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_HUMAN_LOW</FootstepAudioType>
<FootstepAudioScript>AS3D_UN_FOOT_UNIT_LOW_SNOW</FootstepAudioScript>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_ANIMAL</FootstepAudioType>
<FootstepAudioScript>AS3D_UN_ANIMAL_FOOT_LARGE_SNOW</FootstepAudioScript>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_ANIMAL_LOW</FootstepAudioType>
<FootstepAudioScript>AS3D_UN_ANIMAL_FOOT_LARGE_LOW_SNOW</FootstepAudioScript>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_HORSE</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_WHEELS</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_WHEELS</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_WHEELS_2</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_WHEELS_2</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_TANK</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_TANK</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_MOD_ARMOUR</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_MOD_ARMOUR</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_ARTILLERY</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_ARTILLERY</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_WHEELS_3</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_WHEELS_3</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
</FootstepSounds>
<EffectType>NONE</EffectType>
<iEffectProbability>0</iEffectProbability>
<iAdvancedStartRemoveCost>0</iAdvancedStartRemoveCost>
</FeatureInfo>


The miniscule size of the feature was a troubleshoot, was trying to see that the game does not crash because of parts of the feature hanging outside map. And yes, it is animated, but I doubt not checking the 1 for animated is the reason. And yes, the ',' at the start of the "button" is directly copied from fall-out entry, so propably not that one either.
Is it the graphics file, or am I missing something code-wise?
 

Attachments

I added this feature to base BTS and it doesn't hang the game for me.

One observation I have is that you have a custom dll as there is an <iWarmingDefense>0</iWarmingDefense> tag in the Feature infos that is not in base BTS. I would suspect that it is changes you have made in the dll that are the problem rather than the feature itself.

You also need to be more specific on when the game hangs. Is it as soon as you start the game, a few turns in or at random times throughout the game? If you load a save immediately prior will it always hang on the same turn consistently? If you load a save that was taken say 10 turns earlier and you make different moves does it still hang at the same place?
 
I added this feature to base BTS and it doesn't hang the game for me.

One observation I have is that you have a custom dll as there is an <iWarmingDefense>0</iWarmingDefense> tag in the Feature infos that is not in base BTS. I would suspect that it is changes you have made in the dll that are the problem rather than the feature itself. You also need to be more specific on when the game hangs.

I must admit, I have not yet tried long games with this feature. The game crashes always when attempting to use Worldbuilder, and thus I never got past that stage to test whether or the game has trouble following turns (as I always followed these steps to see if the feature works:
1: Start game, check;
2: Can you see feature? check;
3: Open worldbuilder, UNCHECK, freeze;
4: Play some turns. Never got here, step 3 freezes).
And yes, I used k-mod (the ai is wonderful). I actually never thought that the mod might be at fault, as apart from warmingdefence the mod is mostly ai. Thanks for the advice. If the mod is at fault, there will be little I can do.
 
@Blitzconfusion
The most common cause of crashes in the WB is missing art files so could you double check that the rain.nif & dds files are in the path defined in the FeatureArtInfo
Code:
<ModelFile>Art/Terrain/Features/rain.nif</ModelFile>

It shouldn't make any difference, unless you have added multiple features, but I would recommend that instead of putting the files directly into the Features folder you put your artwork files into their own subfolder such as
Code:
[Mod]/Assets/Art/Terrain/Features/Storm
This is a general rule that applies to all new graphics that involve multiple artwork files. If the graphics files for each feature are in their own folder you know that they are isolated and not picking up files from other features by mistake. You would then update the FeatureArtInfo tag to be
Code:
<ModelFile>Art/Terrain/Features/Storm/rain.nif</ModelFile>
 
Just as a curiosity, have you tried removing the new feature and loading world builder, just to make double sure it is that feature that crashes WB.

Found the reason, on bigger map sizes there is simply too many rain drop particles for my computer to handle. Sorry for wasting your time, hardware limits did not cross my mind, as I never had trouble with that since getting rid of Vista.
 
Does anyone know where I can find the art assets for the Civilization flag that is displayed in the lower right side of the UI? It's a shortcut to your capital city and I found the emblems/charges for nations that are superimposed on the flag but no art for the actual flag design itself. II have the DRM free Civilization with Warlords and BtS.
 
Lets suppose that I wanted to alter Slavery so that all players with a Labor civic other than Tribalism or Slavery give civs with Slavery one unhappy face each (and make Slavery itself give +1 happy face).
Now which files would be relevant for this (I suppose xml won't be enough), how are they relevant, and what would you suggest for the code?
I'd rather use just xml and python.

PS. Would the unhappiness be based on all players (or rather, their Labor of choise), or only players known for the civ in question? I'd rather it was the latter.
 
Lets suppose that I wanted to alter Slavery so that all players with a Labor civic other than Tribalism or Slavery give civs with Slavery one unhappy face each (and make Slavery itself give +1 happy face).
Now which files would be relevant for this (I suppose xml won't be enough), how are they relevant, and what would you suggest for the code?
I'd rather use just xml and python.

PS. Would the unhappiness be based on all players (or rather, their Labor of choise), or only players known for the civ in question? I'd rather it was the latter.

If you want to do this via Python then you would need to add code to the event handler, but would need to be careful that you don't apply the penalty to a civ multiple times if it knows of several civs in slavery. Unhappiness is tracked by city and not by civ so you would also need code to be run whenever a city was built of captured. I presume you would also not want vassals to be impacted by this.

In order to keep a copy of who has been impacted you would probably need to keep script data about the player. Platy has some examples of this in his mods. I am an SDK modder rather than Python so there may be better ways of tracking this than script data.

If you are writing the code you can decide whether to apply this to all players or only those who have contact with a civ running slavery.

Changing XML means SDK coding, but you can determine what civics a civ is running already so it probably wouldn't be necessary.
 
Does anyone know where I can find the art assets for the Civilization flag that is displayed in the lower right side of the UI? It's a shortcut to your capital city and I found the emblems/charges for nations that are superimposed on the flag but no art for the actual flag design itself. II have the DRM free Civilization with Warlords and BtS.

In CIV4ArtDefines_Misc.xml there are definitions of the MiscArtInfo type for some ART_UNITGROUP_FLAG_* which might be used for both the flags by the units on the map and the civ flag in the UI. The civ's flag would get inserted by the code that displays it, which is done via a widget referenced in the CvMainInterface.py file.
 
You talk about flags, i have one question for that.
In BTS, you have 3 type of flags, ANCIENT, MEDIEVAL, MODERN, think on design.
ART_UNITGROUP_FLAG_ANCIENT, ART_UNITGROUP_FLAG_MEDIEVAL, ART_UNITGROUP_FLAG_MODERN.
I want to add new group, future flag from Final Frontier, i have 10 eras in mod, and from 8th era i want to use Final Frontier flag design, what i would to do ? (SDK, PYTHON, which files to change)
 
I am trying to mod the turns, years/turn, and technology research rates in order to make the passage of time more realistic. Only thing is, I need to track technology research as the game progresses, which is quite a chore.

Is there some kind of log file (like an error log or similar) which keeps track of in-game events (including AI tech progress) ? I'm almost positive there is something like that somewhere, but I don't know just how to look for it.
 
You talk about flags, i have one question for that.
In BTS, you have 3 type of flags, ANCIENT, MEDIEVAL, MODERN, think on design.
ART_UNITGROUP_FLAG_ANCIENT, ART_UNITGROUP_FLAG_MEDIEVAL, ART_UNITGROUP_FLAG_MODERN.
I want to add new group, future flag from Final Frontier, i have 10 eras in mod, and from 8th era i want to use Final Frontier flag design, what i would to do ? (SDK, PYTHON, which files to change)

It would probably require DLL tweaks to get a 4th flag type, if it is possible. But it looks like that flag era selection is in the .exe rather than the DLL. I don't see anything in the DLL that picks the flag type to use. The various flag data related things are exported from the DLL so the .exe can use them.

The places I have found that implements the idea of the 3 broad "art eras" is for the unit art styles, which also use 3 eras, and a function in CvPlot to see if the player is in the late era "checkLateEra". (In CvInfos.cpp, the CvUnitInfo::getArtInfo function determines which art style to use for the units by era, if the current era is more than half the defined eras it sues the late, more than 1/4 up to 1/2 uses the middle, and under 1/4 gets the early. I expect the flags match this.)

In CvPlayer::setCurrentEra there is a reference to "gDLL->getEntityIFace()->updateGraphicEra" which is, I think, a call to a function in the .exe. It is used for updating units, but may adjust the flags too. This is around a comment that says "update flag eras" after which it does nothing but set the Flag_DIRTY_BIT to true.
 
Is there some kind of log file (like an error log or similar) which keeps track of in-game events (including AI tech progress) ? I'm almost positive there is something like that somewhere, but I don't know just how to look for it.
You can enable logging of research by setting self.__LOG_TECH = 1 in Assets/Python/CvEventManager.py. Then consult PythonDbg.log in MyGames/BTS/Logs. (I think you also need to have logging enabled globally in CivilizationIV.ini.)

I've just tested this for 50 turns. An excerpt:
Spoiler :
PY:Animal Husbandry was finished by Team 5
PY:Aksum has grown
PY:The Wheel was finished by Team 2
PY:Persepolis has grown
PY:Mysticism was selected by Player 5
PY:Polytheism was selected by Player 5
PY:OnPreSave
PY:Masonry was finished by Team 4
PY:The Wheel was selected by Player 4
It's missing turn numbers. Maybe somebody else knows how to get these without writing additional Python code.
 
Hi. A relatively quick locating question.
History: I edited all cathedrals to have double production from spiritual trait. I noticed that the game (inelegantly) lists them separately at the trait, unlike the different temples, which are referred to categorically as "Temple". The temples themselves do not even show spiritual in buildinginfos.
Question: where is this kind of info stored, as I couldn't find it? Especially, what should I modify in order to have the spiritual trait to refer thus: "Double production speed of Cathedral"; as in Cathedral type buildings, like the trait already refers Temple.
 
Back
Top Bottom