PDA

View Full Version : Modding Yields to Civ IV levels seems to be impossible - bugs ?



bryanb2010
12-28-2010, 07:06 PM
I have been trying to mod the tile yields to the Civ IV levels and have found it to be impossible because of what seem to be bugs in how tile yields are calculated.

For Reference here is a simplified list of Civ IV yields

Terrain.................Food Prod Gold
Grass.....................2
Plains.....................1.......1
Tundra...................1
Desert

Yield Modifications:

Hills......................-1.....+1
River......................................+1
Forest...........................+1


I have tried several different combinations and methods. Here is one that should work.

First mod the FEATURE_FOREST to have its yield be additive:
<Features>
<Update>
<Set YieldNotAdditive="false"/>
<Where Type="FEATURE_FOREST"/>
</Update>
</Features>

Next mod the FEATURE_FOREST YieldChanges to be
<Feature_YieldChanges>
<Update>
<Set Yield="0"/>
<Where FeatureType="FEATURE_FOREST" YieldType="YIELD_FOOD"/>
</Update>
<Update>
<Set Yield="1"/>
<Where FeatureType="FEATURE_FOREST" YieldType="YIELD_PRODUCTION"/>
</Update>
</Feature_YieldChanges>

Now Hills are for some odd reason implemented as a terrain ? and yet work as a totally different component, but we try and modify the HillsYieldChanges

<Terrain_HillsYieldChanges>
<Delete />
<Row>
<TerrainType>TERRAIN_GRASS</TerrainType>
<YieldType>YIELD_FOOD</YieldType>
<Yield>-1</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_GRASS</TerrainType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_PLAINS</TerrainType>
<YieldType>YIELD_FOOD</YieldType>
<Yield>-1</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_PLAINS</TerrainType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_DESERT</TerrainType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_TUNDRA</TerrainType>
<YieldType>YIELD_FOOD</YieldType>
<Yield>-1</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_TUNDRA</TerrainType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
</Terrain_HillsYieldChanges>


The combination of those changes should result in a Civ IV terrain yields, unfortunately it appears that the yield changes for hills and forests do not stack. It appears that this is a bug. In addition the fact the there is a TERRAIN_HILLS seems complicated, there is no hills terrain as far as i can tell, it is simply a grass, plains, desert or tundra, with a hills overlay. Also why are jungles on the plains and not grasslands ?

Procylon
12-29-2010, 04:03 AM
I agree, the terrain system could be more open and intuitive.

Also Devs, please let us mine mountains. Please!

bryanb2010
12-29-2010, 07:56 AM
So wouldn't it make more sense for hills to be an overlay on top of terrain like features ? We can't use features of course because you can have a hill on a grassland with a forest. Here is a sample XML for a hills overlay.

Now how do we modify the world creation scripts to use new data like this ?

<GameData>
<!-- Table definition -->
<Table name="Hills">
<Column name="ID" type="integer" primarykey="true" autoincrement="true"/>
<Column name="Type" type="text" notnull="true" unique="true"/>
<Column name="Description" type="text"/>
<Column name="Civilopedia" type="text"/>
<Column name="ArtDefineTag" type="text"/>
<Column name="Water" type="boolean" default="false"/>
<Column name="SeeFrom" type="integer" default="1"/>
<Column name="SeeThrough" type="integer" default="1"/>
<Column name="InfluenceCost" type="integer" default="0"/>
<Column name="Button" type="text"/>
<Column name="WorldSoundscapeAudioScript" type="text"/>
<Column name="GraphicalOnly" type="boolean" default="false"/>
<Column name="PortraitIndex" type="integer" default="-1"/>
<Column name="IconAtlas" type="text" default="NULL" reference="IconTextureAtlases(Atlas)"/>
<Column name="YieldNotAdditive" type="boolean" default="false"/>
</Table>
<Table name="HillsYieldChanges">
<Column name="HillType" type="text" reference="Hills(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer" default="0"/>
</Table>
<Table name="Hills_TerrainBooleans">
<Column name="HillType" type="text" reference="Hills(Type)"/>
<Column name="TerrainType" type="text" reference="Terrain(Type)"/>
</Table>
<!-- Table data -->
<Terrains>
<Row>
<ID>0</ID>
<Type>HILL_LOWHILLS</Type>
<Description>TXT_KEY_TERRAIN_HILL</Description>
<Civilopedia>TXT_KEY_CIV5_SPECIALTERRAIN_HILLS_TEXT</Civilopedia>
<ArtDefineTag>ART_DEF_TERRAIN_HILL</ArtDefineTag>
<Water>true</Water>
<SeeFrom>0</SeeFrom>
<SeeThrough>0</SeeThrough>
<InfluenceCost>0</InfluenceCost>
<Button>Art/Interface\Buttons\WorldBuilder\Terrain_Hill.dds</Button>
<GraphicalOnly>true</GraphicalOnly>
<WorldSoundscapeAudioScript>ASSS_AMBIENCE_GRASSLANDS</WorldSoundscapeAudioScript>
<EffectTypeTag>DIRT</EffectTypeTag>
<PortraitIndex>5</PortraitIndex>
<IconAtlas>TERRAIN_ATLAS</IconAtlas>
<YieldNotAdditive>false</YieldNotAdditive>
</Row>
</Terrains>
<Hills_TerrainBooleans>
<Row>
<HillType>HILL_LOWHILLS</HillType>
<TerrainType>TERRAIN_GRASS</TerrainType>
</Row>
<Row>
<HillType>HILL_LOWHILLS</HillType>
<TerrainType>TERRAIN_PLAINS</TerrainType>
</Row>
<Row>
<HillType>HILL_LOWHILLS</HillType>
<TerrainType>TERRAIN_TUNDRA</TerrainType>
</Row>
<Row>
<HillType>HILL_LOWHILLS</HillType>
<TerrainType>TERRAIN_DESERT</TerrainType>
</Row>
</Hills_TerrainBooleans>
<HillsYieldChanges>
<Row>
<HillType>HILL_LOWHILLS</HillType>
<YieldType>YIELD_FOOD</YieldType>
<Yield>-1</Yield>
</Row>
<Row>
<HillType>HILL_LOWHILLS</HillType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
</HillsYieldChanges>
</GameData>

SamBC
12-29-2010, 08:46 AM
You'd need to mod much more than the map generators. It would affect graphics, map structures, all game mechanics, really.

MegaBearsFan
12-29-2010, 02:35 PM
From what you posted in your original post:



<Features>
<Update>
<Set YieldNotAdditive="false"/>
<Where Type="FEATURE_FOREST"/>
</Update>
</Features>

<Feature_YieldChanges>
<Update>
<Set Yield="0"/>
<Where FeatureType="FEATURE_FOREST" YieldType="YIELD_FOOD"/>
</Update>
<Update>
<Set Yield="1"/>
<Where FeatureType="FEATURE_FOREST" YieldType="YIELD_PRODUCTION"/>
</Update>
</Feature_YieldChanges>


Perhaps the <Set Yield="0"/> line is the culprit. This appears to be modifing the base terrain yield in SQL using the SET instruction, which OVERWRITES the current value to zero.

I don't know if this will work, but perhaps when using the YieldIsNotAdditive="false" setting, you should try deleting the script for <Feature_YieldChanges> that apply to forests and instead use script similar to the Hills:



<Terrain_ForestYieldChanges>
<Delete />
<Row>
<TerrainType>TERRAIN_GRASS</TerrainType>
<YieldType>YIELD_FOOD</YieldType>
<Yield></Yield>
</Row>
<TerrainType>TERRAIN_GRASS</TerrainType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_PLAINS</TerrainType>
<YieldType>YIELD_FOOD</YieldType>
<Yield>0</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_PLAINS</TerrainType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_TUNDRA</TerrainType>
<YieldType>YIELD_FOOD</YieldType>
<Yield>0</Yield>
</Row>
<Row>
<TerrainType>TERRAIN_TUNDRA</TerrainType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
</Terrain_ForestYieldChanges>


Remembering to delete the reference to desert, since forests can't grow on desert (unless you modded them to grow on deserts)...

If it recognizes <Terrain_ForestYieldChanges>, then maybe it will work. If not, then maybe it actually is a bug, and there is nothing you can do. I wish I could be more helpful.

MegaBearsFan
12-29-2010, 02:46 PM
Alternatively, there might be a different field (other than Yield) that you need to change when using the YieldNotAdditive="false" setting. Something along the lines of AdditiveYield, YieldToAdd, or YieldChange or something like that. i.e.:



<Feature_YieldChanges>
<Update>
<Set AdditiveYield="0"/>
<Where FeatureType="FEATURE_FOREST" YieldType="YIELD_FOOD"/>
</Update>
<Update>
<Set AdditiveYield="1"/>
<Where FeatureType="FEATURE_FOREST" YieldType="YIELD_PRODUCTION"/>
</Update>
</Feature_YieldChanges>


If it does work like that, then it seems to be inefficient database design by the developers. But then again, after the first two patches, my confidence in the developers' competence isn't exactly at an all-time-high anymore. In order to know for sure if such a field exists and what it would be called, I would need to see the actual game's database and look at the Feature_YieldChanges table. Which I can't. Unless someone knows of any documentation anywhere that outlines all the tables and fields in the game database? If so, post the link, and I can check to see if I see anything that might do what you want to do.

bryanb2010
12-29-2010, 06:56 PM
When you set not additive yield to false (thanks for the double negative firaxis developers ), wherever a forest occurs, its yield is added to the base terrain. So with what I defined above (in my case +0 food, +1 prod), on a grassland you would end up with 2F, 1P. This in fact works.

If you set the Terrain_HillsYieldChanges, this also works, it will be additive yield changes for when a hill occurs on a base terrain. In my case I set -1F and +1P so a grassland hill is 1F, 1P.

Unfortunately when using the two together, and the results need to stack, that does not work. For example. when a forest occurs on a grassland hill the result is not correct. It should result in 2F +0F -1F = 1F, 0P +1P +1P = 2P.

Thanks for the response MegaBearsFan, but I don't see any additional columns mentioned in the table definition in the xml, so that is unlikely to be the issue. Just comes down to sloppy coding.