DLL - Unified Yields

whoward69

DLL Minion
Joined
May 30, 2011
Messages
8,699
Location
Near Portsmouth, UK
Holy Grail 1 - Unified Yields

Background
"Things" produce yields, which in turn are consumed or used to produce different things, for example
  • Wheat produces food which is consumed by cities or used to produce a new citizen (growth)
  • Libraries produce science (knowledge) which produce new technologies

Definitions
  • Primary Table - a database table describing a game entity, eg Civilizations, Buildings, Policies, Features, Techs.
  • Secondary Table - a database table holding a relationship between two (or more) primary tables. The names of these tables typically start with a game entity followed by an underscore, eg Trait_ImprovementYieldChanges, Building_RiverPlotYieldChanges
  • Secondary Yield Table - a secondary table where one of the primary tables is the Yields table. These tables will always have a <Column name="YieldType" type="text" reference="Yields(Type)"/> line in their definition.
  • Standard Yields - Culture, Faith, Food, Gold, Production and Science
  • Local Yields - Yields that accrue to a city and not directly to the player. Namely Food and Production (ie the ones that don't have a turn-on-turn running total in the Top Panel.)

Summary
  1. Additional primary table - In the standard game there is no way to assign yields based on plot type, this has been addressed by adding the Plots table and associated secondary yield tables, eg Belief_PlotYieldChanges. This enabled modders to create (for example) beliefs that enhance mountains (PLOT_MOUNTAIN) directly, without having to resort to fake features. (A GreatPersons table has also been created, for memory efficiency reasons.)
  2. Secondary yield table consistency - In the standard game not all yields can be used in all secondary yield tables, eg you can't convert hammers into faith via an entry for YIELD_FAITH in the Process_ProductionYields table. This is no longer the case. Every standard yield works in (almost) every secondary yield table. The very few exceptions relate to local yields in a non-city environment, eg the "FromKills" tables.
  3. Cross primary table consistency - In the standard game not all conditions for applying yields behave consistently, eg while there are secondary yield tables for river tiles with specific features, improvements or terrains (Feature_RiverYieldChanges, Improvement_RiverSideYields and Terrain_RiverYieldChanges) there is only a secondary yield table for improvements on fresh water tiles, that is, while there is a Improvement_FreshWaterYields secondary table, the Feature_FreshWaterYields and Terrain_FreshWaterYields tables do not exist. All of the missing secondary yield tables within the Features/Improvements/Terrains group and most of them within the Beliefs/Policies/Traits group have been added. (See post #2 for the missing ones.)
  4. Yield specific columns into secondary yield tables - In the standard game there are yields added via specific columns on primary tables, eg Beliefs.GoldPerFollowingCity and Traits.FaithFromUnimprovedForest. Some of the more desirable of these have been converted into secondary yield tables (eg Beliefs.GoldPerFollowingCity becomes Belief_YieldPerFollowingCity and Traits.FaithFromUnimprovedForest becomes Belief_CityYieldFromUnimprovedFeature) and where appropriate these have been extended to the group (so there are also Policy_CityYieldFromUnimprovedFeature and Trait_CityYieldFromUnimprovedFeature tables)
  5. Additional yields - Two completely new yields have been added - Tourism and Golden Age Points - which work completely in all secondary yield tables. (Tourism is treated as a local yield as it doesn't accrue turn-on-turn.)

Details
The primary tables of interest are Beliefs, Buildings, Features, Improvements, Plots, Policies, Processes, Resources, Routes, Terrains, Units and UnitPromotions - see posts #2 and #3 for the current state and available secondary yield tables.

New Yields
  • YIELD_TOURISM
  • YIELD_GOLDEN_AGE_POINTS

New Primary Tables
  • Plots
  • GreatPersons

New Secondary Yield Tables
  1. Belief_CapitalYieldChanges
  2. Belief_CityYieldFromUnimprovedFeature
  3. Belief_CoastalCityYieldChanges
  4. Belief_GreatPersonExpendedYield
  5. Belief_GreatWorkYieldChanges
  6. Belief_PlotYieldChanges
  7. Belief_SpecialistYieldChanges
  8. Belief_TradeRouteYieldChange
  9. Belief_UnimprovedFeatureYieldChanges
  10. Belief_YieldFromBarbarianKills
  11. Belief_YieldFromKills
  12. Belief_YieldPerFollowingCity
  13. Belief_YieldPerOtherReligionFollower
  14. Belief_YieldPerXFollowers
  15. Building_PlotYieldChanges
  16. Feature_CoastalLandYields
  17. Feature_FreshWaterYields
  18. Feature_TechYieldChanges
  19. Improvement_YieldAdjacentSameType
  20. Plot_Yields
  21. Policy_CityYieldFromUnimprovedFeature
  22. Policy_FeatureYieldChanges
  23. Policy_GreatPersonExpendedYield
  24. Policy_PlotYieldChanges
  25. Policy_ResourceYieldChanges
  26. Policy_SpecialistYieldChanges
  27. Policy_TerrainYieldChanges
  28. Policy_TradeRouteYieldChange
  29. Policy_UnimprovedFeatureYieldChanges
  30. Policy_YieldChangesNaturalWonder
  31. Policy_YieldChangeTradeRoute
  32. Policy_YieldChangeWorldWonder
  33. Policy_YieldFromBarbarianKills
  34. Policy_YieldFromKills
  35. Terrain_CoastalLandYields
  36. Terrain_FreshWaterYields
  37. Terrain_TechYieldChanges
  38. Trait_BuildingClassYieldChanges
  39. Trait_CapitalYieldChanges
  40. Trait_CityYieldChanges
  41. Trait_CityYieldFromUnimprovedFeature
  42. Trait_CoastalCityYieldChanges
  43. Trait_FeatureYieldChanges
  44. Trait_GreatPersonExpendedYield
  45. Trait_GreatWorkYieldChanges
  46. Trait_PlotYieldChanges
  47. Trait_ResourceYieldChanges
  48. Trait_TerrainYieldChanges
  49. Trait_TradeRouteYieldChange
  50. Trait_YieldChangeTradeRoute
  51. Trait_YieldChangeWorldWonder
  52. Trait_YieldFromBarbarianKills
  53. Trait_YieldFromKills
  54. Unit_YieldFromBarbarianKills
  55. UnitPromotions_YieldFromBarbarianKills
  56. UnitPromotions_YieldFromKills


===============================================
Original post follows
Spoiler :
Standard yields
  • Food (YIELD_FOOD)
  • Production (YIELD_PRODUCTION)
  • Gold (YIELD_GOLD)
  • Science (YIELD_SCIENCE)
  • Culture (YIELD_CULTURE) - implementation is flawed (JONS crap)
  • Faith (YIELD_FAITH) - implementation is flawed
Added yields
  • Tourism (YIELD_TOURISM)
  • Golden Age Points (YIELD_GOLDEN_AGE_POINTS)
Should probably be yields
  • Local Happiness
  • Global Happiness
  • Great People points - one per type (Engineer, Scientist, Merchant, Artist, Muscian, Writer, General, Admiral, Prophet)
Note: Adding a new GP/Specialist requires DLL modding, so hard-coding the current 9 GP types is no big deal

The scale of the problem
  • Excluding specialists and gp points there are a total of 265 database entries (either columns in primary tables or secondary tables) that generate yields.
  • There are an unknown number of Lua API methods that retrieve yields directly (eg GetJONSCultureXyx()) and not by yield type (eg YIELD_CULTURE) on a generic function.

How to eat an elephant
Bottom line, no one person or group is going to be able to unify yields in one hit. So we need to divide and conquer.

There are two types of problem. Adding the missing yield types (tourism, local and global happiness, golden age points, etc) and making sure all the current secondary tables work for all the current yield types (culture, faith, food, gold, production and science) - the second is significantly easier than the former (as most of the code should be available, it's "just" a case of making sure everything is hooked up at the correct places in the code.)

Secondary Tables
However, even the second type of problem is HUGE. Taking just the yields from Beliefs, there are 15 secondary tables to check with each of the 6 possible yield types, for a total of 90 combinations. Only 23 of those are used by base beliefs, leaving 67 combinations to check (some of which may be not applicable) - either by experimentation or by code analysis. A brief scan of the code quickly reveals 14 that should work, more in-depth analysis would be needed for the remaining 53 combinations. Which is still a huge task. And that's just for Beliefs!

The secondary tables are given in posts #2 and #3

[Edit: The first task is to understand the true scale of the secondary table problem, and that's where you can help. What we need are tables for each of the main features and their secondary tables, showing the holes in our knowledge - which we now have]
 
WORK IN PROGRESS

Where
  • # (prefix) indicates that the table is new (ie not part of the Firaxis base game) - see DB/API/UnifiedYields.xml
  • xml indicates that it occurs in the standard XML files (not those of a mod) so can be assumed to work
  • test indicates that this yield in this table has been tested in a mod and proved to work
  • code indicates that it has been determined to work by analysing the code, but ideally needs testing
  • (blank) or impl indicates now implemented in the DLL, needs testing
  • - indicates that the combination is known to be buggy, under review
  • n/a indicates that this combination is not applicable

Beliefs vs Policies Vs Traits - the gaps

Beliefs Policies Traits
Policy_BuildingClassYieldModifiers
Policy_CapitalYieldModifiers
Policy_CapitalYieldPerPopChanges
Trait_ExtraYieldThresholds
Policy_SpecialistExtraYields
Belief_YieldChangeAnySpecialist
Trait_YieldChanges
Trait_YieldChangesIncomingTradeRoute
Trait_YieldChangesPerTradePartner
Trait_YieldChangesStrategicResources
Belief_YieldModifierNaturalWonder
Policy_YieldModifiers Trait_YieldModifiers
 
COMPLETED

Where
  • # (prefix) indicates that the table is new (ie not part of the Firaxis base game) - see DB/API/UnifiedYields.xml
  • xml indicates that it occurs in the standard XML files (not those of a mod) so can be assumed to work
  • test indicates that this yield in this table has been tested in a mod and proved to work
  • n/a indicates that this combination is not applicable


Yields from Beliefs

Culture Faith Food Gold Production Science Tourism Golden Age
Belief_BuildingClassYieldChanges xml xml xml xml xml xml test test
#Belief_CapitalYieldChanges test test test test test test test test
Belief_CityYieldChanges test test test test xml test test test
#Belief_CityYieldFromUnimprovedFeature test test test test test test test test
#Belief_CoastalCityYieldChanges test test test test test test test test
#Belief_GreatPersonExpendedYield test test test test test test test test
#Belief_GreatWorkYieldChanges test test test test test test test test
Belief_HolyCityYieldChanges test test test test test test test test
Belief_FeatureYieldChanges* xml test test test test test test test
Belief_ImprovementYieldChanges xml xml xml test xml test test test
Belief_MaxYieldModifierPerFollower**** test test test test xml test test test
#Belief_PlotYieldChanges++ test test test test test test test test
Belief_ResourceYieldChanges xml xml xml test test test test test
#Belief_SpecialistYieldChanges test test test test test test test test
Belief_TerrainYieldChanges test xml test test test test test test
#Belief_TradeRouteYieldChange test test test test test test test test
#Belief_UnimprovedFeatureYieldChanges test test test test test test test test
Belief_YieldChangeAnySpecialist***** test test test test xml test test test
Belief_YieldChangePerForeignCity test xml n/a test n/a test test test
Belief_YieldChangePerXForeignFollowers xml test n/a test n/a test test test
Belief_YieldChangeTradeRoute*** test test test test test xml test test
Belief_YieldChangeNaturalWonder test xml test test test test test test
Belief_YieldChangeWorldWonder test xml test test test test test test
#Belief_YieldFromBarbarianKills test test n/a test n/a test n/a test
#Belief_YieldFromKills** test test n/a test n/a test n/a test
Belief_YieldModifierNaturalWonder test test test test test test test test
#Belief_YieldPerFollowingCity test test n/a test n/a test test test
#Belief_YieldPerOtherReligionFollower test test n/a test n/a test test test
#Belief_YieldPerXFollowers test test n/a test n/a test test test
*Don't work for fake features (rivers and lakes)
***City connections, not trade routes
****Only useful for yields calculated in hundreths
*****Excludes unemployed citizens


Yields from Buildings

Culture Faith Food Gold Production Science Tourism Golden Age
Building_AreaYieldModifiers test test test test test test test test
Building_BuildingClassYieldChanges xml test test xml test test test test
Building_FeatureYieldChanges* test test xml xml xml xml test test
Building_GlobalYieldModifiers test test xml test test test test test
Building_LakePlotYieldChanges test test xml test test test test test
#Building_PlotYieldChanges test test test test test test test test
Building_ResourceYieldChanges xml xml xml xml xml test test test
Building_ResourceYieldModifiers test test test test test test test test
Building_RiverPlotYieldChanges test test test test xml test test test
Building_SeaPlotYieldChanges test test xml test test test test test
Building_SeaResourceYieldChanges test test test xml xml test test test
Building_SpecialistYieldChanges test test test test xml xml test test
Building_TechEnhancedYieldChanges xml test test test test test test test
Building_TerrainYieldChanges test test xml test xml test test test
Building_YieldChanges xml xml xml xml xml xml test test
Building_YieldChangesPerPop test test test test test xml test test
Building_YieldChangesPerReligion** test xml test test test test test test
Building_YieldModifiers test test xml xml xml xml test test
*Don't work for fake features (rivers and lakes)
**Badly named, should be Building_YieldModifierPerReligion


Yields from Features

Culture Faith Food Gold Production Science Tourism Golden Age
#Feature_CoastalLandYields* test test test test test test test test
#Feature_FreshWaterYields* test test test test test test test test
Feature_HillsYieldChanges test test test test test test test test
Feature_RiverYieldChanges* test test test test test test test test
#Feature_TechYieldChanges test test test test test test test test
Feature_YieldChanges* xml xml xml xml xml xml test test
*Don't work for fake features (rivers and lakes)


Yields from Improvements

Culture Faith Food Gold Production Science Tourism Golden Age
Improvement_AdjacentCityYields test test test test test test test test
Improvement_AdjacentMountainYieldChanges test test xml test test test test test
Improvement_CoastalLandYields test test test test test test test test
Improvement_FreshWaterYields test test test test test test test test
Improvement_HillsYields test test test test test test test test
Improvement_PrereqNatureYields* test test test test test test test test
Improvement_ResourceType_Yields test test xml xml xml test test test
Improvement_RiverSideYields test test test test test test test test
Improvement_RouteYieldChanges test test test test test test test test
Improvement_TechFreshWaterYieldChanges test test xml test test test test test
Improvement_TechNoFreshWaterYieldChanges test test xml test test test test test
Improvement_TechYieldChanges xml test xml xml xml xml test test
#Improvement_YieldAdjacentSameType test test test test test test test test
Improvement_YieldPerEra** xml test test test test test test test
Improvement_Yields xml xml xml xml xml xml test test
*Restricts improvements to tiles with at least this amount of yield from nature (plot, terrain, features and resources) but not things like routes
** Requires an "archaeological record" on the plot


Yields from Plots

Culture Faith Food Gold Production Science Tourism Golden Age
#Plot_Yields test test test test test test test test


Yields from Policies

Culture Faith Food Gold Production Science Tourism Golden Age
Policy_BuildingClassYieldChanges test xml test xml xml xml test test
Policy_BuildingClassYieldModifiers test test test xml test test test test
Policy_CapitalYieldChanges test test test xml test xml test test
Policy_CapitalYieldModifiers test test xml test test test test test
Policy_CapitalYieldPerPopChanges test test test xml test test test test
Policy_CityYieldChanges xml test xml xml xml xml test test
#Policy_CityYieldFromUnimprovedFeature test test test test test test test test
Policy_CoastalCityYieldChanges test test test test xml test test test
#Policy_FeatureYieldChanges* test test test test test test test test
#Policy_GreatPersonExpendedYield test test test test test test test test
Policy_GreatWorkYieldChanges xml test test test test test test test
Policy_ImprovementYieldChanges test xml test xml xml xml test test
#Policy_PlotYieldChanges test test test test test test test test
#Policy_ResourceYieldChanges test test test test test test test test
Policy_SpecialistExtraYields test test test test test xml test test
#Policy_SpecialistYieldChanges test test test test test test test test
#Policy_TerrainYieldChanges test test test test test test test test
#Policy_TradeRouteYieldChange test test test test test test test test
#Policy_UnimprovedFeatureYieldChanges test test test test test test test test
#Policy_YieldChangeTradeRoute*** test test test test test test test test
#Policy_YieldChangesNaturalWonder test test test test test test test test
#Policy_YieldChangeWorldWonder test test test test test test test test
#Policy_YieldFromBarbarianKills test test n/a test n/a test n/a test
#Policy_YieldFromKills** test test n/a test n/a test n/a test
Policy_YieldModifiers test test test test test test test test
*Don't work for fake features (rivers and lakes)
**Only yields accumulated turn-on-turn by the player are possible
***City connections, not trade routes


Yields from Processes

Culture Faith Food Gold Production Science Tourism Golden Age
Process_ProductionYields test test test xml test* xml test test
*Stockpiling - the production is moved to the overflow bucket


Yields from Resources

Culture Faith Food Gold Production Science Tourism Golden Age
Resource_YieldChanges test test xml xml xml test test test


Yields from Routes

Culture Faith Food Gold Production Science Tourism Golden Age
Route_Yields test test test test test test test test


Yields from Terrains

Culture Faith Food Gold Production Science Tourism Golden Age
#Terrain_CoastalLandYields test test test test test test test test
#Terrain_FreshWaterYields test test test test test test test test
Terrain_HillsYieldChanges test test xml test xml test test test
Terrain_RiverYieldChanges test test test test test test test test
#Terrain_TechYieldChanges test test test test test test test test
Terrain_Yields test test xml test xml test test test


Yields from Traits

Culture Faith Food Gold Production Science Tourism Golden Age
#Trait_BuildingClassYieldChanges test test test test test test test test
#Trait_CapitalYieldChanges test test test test test test test test
#Trait_CityYieldChanges test test test test test test test test
#Trait_CityYieldFromUnimprovedFeature test test test test test test test test
#Trait_CoastalCityYieldChanges test test test test test test test test
Trait_ExtraYieldThresholds***** test test test test test test test test
#Trait_FeatureYieldChanges* test test test test test test test test
#Trait_GreatPersonExpendedYield test test test test test test test test
#Trait_GreatWorkYieldChanges test test test test test test test test
Trait_ImprovementYieldChanges xml test test test xml xml test test
#Trait_PlotYieldChanges test test test test test test test test
#Trait_ResourceYieldChanges test test test test test test test test
Trait_SpecialistYieldChanges test test test test test xml test test
#Trait_TerrainYieldChanges test test test test test test test test
#Trait_TradeRouteYieldChange test test test test test test test test
Trait_UnimprovedFeatureYieldChanges xml test test test test test test test
Trait_YieldChanges test test test test test test test test
Trait_YieldChangesIncomingTradeRoute**** test test test xml test test test test
Trait_YieldChangesNaturalWonder test test test test test test test test
Trait_YieldChangesPerTradePartner xml test n/a xml n/a test test test
Trait_YieldChangesStrategicResources test test test test xml test test test
#Trait_YieldChangeTradeRoute*** test test test test test test test test
#Trait_YieldChangeWorldWonder test test test test test test test test
#Trait_YieldFromBarbarianKills test test n/a test n/a test n/a test
#Trait_YieldFromKills** test test n/a test n/a test n/a test
Trait_YieldModifiers test test test test test test test test
*Don't work for fake features (rivers and lakes)
**Only yields accumulated turn-on-turn by the player are possible
***City connections, not trade routes
****Unique in that the trait owner doesn't receive the bonus!
***** +1 yield if yield from tile is greater than or equal to the threshold

Yields from Units

Culture Faith Food Gold Production Science Tourism Golden Age
Unit_YieldFromKills* test xml n/a test n/a test n/a test
#Unit_YieldFromBarbarianKills* test test n/a test n/a test n/a test
*Only yields accumulated turn-on-turn by the player are possible

Yields from UnitPromotionss

Culture Faith Food Gold Production Science Tourism Golden Age
#UnitPromotions_YieldFromKills* test test n/a test n/a test n/a test
#UnitPromotions_YieldFromBarbarianKills* test test n/a test n/a test n/a test
*Only yields accumulated turn-on-turn by the player are possible


Features vs Improvements Vs Terrains

Features Improvements Terrains
#Feature_CoastalLandYields* Improvement_CoastalLandYields #Terrain_CoastalLandYields
#Feature_FreshWaterYields* Improvement_FreshWaterYields #Terrain_FreshWaterYields
Feature_HillsYieldChanges* Improvement_HillsYields Terrain_HillsYieldChanges
Feature_RiverYieldChanges* Improvement_RiverSideYields Terrain_RiverYieldChanges
#Feature_TechYieldChanges Improvement_TechYieldChanges #Terrain_TechYieldChanges
Feature_YieldChanges* Improvement_Yields Terrain_Yields


Beliefs vs Policies Vs Traits

Beliefs Policies Traits
Belief_BuildingClassYieldChanges Policy_BuildingClassYieldChanges #Trait_BuildingClassYieldChanges
#Belief_CapitalYieldChanges Policy_CapitalYieldChanges #Trait_CapitalYieldChanges
Belief_CityYieldChanges Policy_CityYieldChanges #Trait_CityYieldChanges
#Belief_CoastalCityYieldChanges Policy_CoastalCityYieldChanges #Trait_CoastalCityYieldChanges
Belief_FeatureYieldChanges #Policy_FeatureYieldChanges #Trait_FeatureYieldChanges
#Belief_GreatWorkYieldChanges Policy_GreatWorkYieldChanges #Trait_GreatWorkYieldChanges
Belief_ImprovementYieldChanges Policy_ImprovementYieldChanges Trait_ImprovementYieldChanges
Belief_PlotYieldChanges #Policy_PlotYieldChanges #Trait_PlotYieldChanges
Belief_ResourceYieldChanges #Policy_ResourceYieldChanges #Trait_ResourceYieldChanges
#Belief_SpecialistYieldChanges #Policy_SpecialistYieldChanges Trait_SpecialistYieldChanges
Belief_TerrainYieldChanges #Policy_TerrainYieldChanges #Trait_TerrainYieldChanges
#Belief_UnimprovedFeatureYieldChanges #Policy_UnimprovedFeatureYieldChanges Trait_UnimprovedFeatureYieldChanges
Belief_YieldChangeTradeRoute #Policy_YieldChangeTradeRoute #Trait_YieldChangeTradeRoute
Belief_YieldChangeNaturalWonder #Policy_YieldChangesNaturalWonder Trait_YieldChangesNaturalWonder
Belief_YieldChangeWorldWonder #Policy_YieldChangesWorldWonder #Trait_YieldChangesWorldWonder
#Belief_YieldFromKills #Policy_YieldFromKills #Trait_YieldFromKills


++ Needed to test
Code:
<CustomModOptions>
  <Update>
    <Where Name="API_PLOT_YIELDS"/>
    <Set Value="1"/>
  </Update>
  <Update>
    <Where Name="RELIGION_PLOT_YIELDS"/>
    <Set Value="1"/>
  </Update>
</CustomModOptions>
 
So who wants to help fill in the holes? We need tables for Buildings, Features, Improvements, Policies, Process, Resources, Routes, Terrains, Traits and Units

The quickest way to fill in the "xml" entries is to hook up to the Civ5CoreDatabase (NOT the Civ5DebugDatabase as that includes mods) and execute "SELECT DISTINCT YieldType FROM {tablename} ORDER BY YieldType;"
 
FYI, I've built yields for Great generals, admirals and golden age points into the CP dll. they are not unified or integrated everywhere, but they exist.
G

Yeah, I'd seen those. Think they're somewhere around the rump, and we've (I've) only just started on the trunk ;)

Think the order will be
  • unify secondary tables
  • integrate tourism into secondary tables
  • integrate golden age into secondary tables
  • unify primary columns (will involve moving values in and out of secondary tables)
  • integrate local and global happiness
  • integrate GP points (all 9)
If I get as far as integrating golden ages I'll be amazed :eek:
 
I'm currently going through the Policy tables, and will report back with what I find (though I can't understand enough about it by looking into the DLL, so it's mostly established what works through testing and what is there already in XML)
 
Next up, yields from Features, Resources and terrains.

Feel free to contribute! If you've written a fully working mod that produces a yield from a secondary table not covered by the base game files, please feel free to post details. All I need is table/yield pairs, eg

Code:
Terrain_HillsYieldChanges - YIELD_SCIENCE

If I have to check all 400+ of these through the code base, this'll never get finished!
 
I'm currently going through the Policy tables, and will report back with what I find (though I can't understand enough about it by looking into the DLL, so it's mostly established what works through testing and what is there already in XML)

I can dig through the code, but it takes ages. What I'm after is exactly what you're doing - those entries in the standard XML or known to work from existing mods (or tested as working)
 
Next up, yields from Features, Resources and terrains.

Feel free to contribute! If you've written a fully working mod that produces a yield from a secondary table not covered by the base game files, please feel free to post details. All I need is table/yield pairs, eg

Code:
Terrain_HillsYieldChanges - YIELD_SCIENCE

If I have to check all 400+ of these through the code base, this'll never get finished!

The CP already has a plotyieldchanges table for buildings and policies, if that helps. :) (I'm sure you already knew this.)
G
 
Here is what I've come up with for Policies:

Yields from Policies

Culture Faith Food Gold Production Science
Policy_BuildingClassCultureChanges xml n/a n/a n/a n/a n/a
Policy_BuildingClassProductionModifiers n/a n/a n/a n/a xml n/a
Policy_BuildingClassYieldChanges * xml test xml xml xml
Policy_BuildingClassYieldModifiers test xml test test
Policy_CapitalYieldChanges test test test xml test xml
Policy_CapitalYieldModifiers xml test test test
Policy_CapitalYieldPerPopChanges test test test xml test test
Policy_CityYieldChanges xml text xml xml xml xml
Policy_CoastalCityYieldChanges test test test test xml test
Policy_GreatWorkYieldChanges xml
Policy_ImprovementCultureChanges xml n/a n/a n/a n/a n/a
Policy_ImprovementYieldChanges test xml test xml xml xml
Policy_SpecialistExtraYields * * test test test xml
Policy_UnitCombatProductionModifiers n/a n/a n/a n/a xml n/a
Policy_YieldModifiers test test test test


*Displays as modified on the hover tooltip, but does not actually apply the yield to the city or global output.

I'll test the Traits next.
 
Wow! That put a dent in Policies - I'll fill in the blanks after I've done Features, Resources and Terrains
 
Yields from Traits

Culture Faith Food Gold Production Science
Trait_ExtraYieldThresholds test test test test test test
Trait_ImprovementYieldChanges xml test test test xml xml
Trait_SpecialistYieldChanges * * test test test xml
Trait_UnimprovedFeatureYieldChanges xml test test test test test
Trait_YieldChanges test test test test test test
Trait_YieldChangesIncomingTradeRoute xml xml
Trait_YieldChangesNaturalWonder test test test test test test
Trait_YieldChangesPerTradePartner xml xml
Trait_YieldChangesStrategicResources test test test test xml test
Trait_YieldModifiers test test test test


*Displays as modified on the hover tooltip, but does not actually apply the yield to the city or global output.

Though YieldChanges and ExtraYieldThresholds do have XML entries, they do so in traits that are unused (TRAIT_FINANCIAL (which yields Food for some reason in ExtraYieldThresholds)), so I thought it more pertinent to test and then register them as tests.

Next: Buildings
 
If you find any tables that don't have YieldType columns (eg Policy_BuildingClassCultureChanges), just ignore them. I built the list originally by search for yieldtype and then adding things like "gold", "production", "purchase" to the search so there may be some false positives
 
Yields from Buildings

Culture Faith Food Gold Production Science
Building_AreaYieldModifiers test test test test
Building_BuildingClassYieldChanges xml test test xml test test
Building_FeatureYieldChanges test test xml xml xml xml
Building_GlobalYieldModifiers xml test test test
Building_LakePlotYieldChanges test test xml test test test
Building_ResourceYieldChanges xml xml xml xml xml test
Building_ResourceYieldModifiers test test test test
Building_RiverPlotYieldChanges test test test test xml test
Building_SeaPlotYieldChanges test test xml test test test
Building_SeaResourceYieldChanges test test test xml xml test
Building_SpecialistYieldChanges * * test test xml xml
Building_TechEnhancedYieldChanges xml test test test test test
Building_TerrainYieldChanges test test xml test xml test
Building_YieldChanges xml xml xml xml xml xml
Building_YieldChangesPerPop test test test xml
Building_YieldChangesPerReligion test xml test test test test
Building_YieldModifiers xml xml xml xml


*Displays as modified on the hover tooltip, but does not actually apply the yield to the city or global output.
 
Yields from Routes

Culture Faith Food Gold Production Science
Resource_YieldChanges test test test test test

Yields from Units

Culture Faith Food Gold Production Science
Unit_YieldFromKills test xml n/a test n/a test

I wasn't certain whether local yields should be considered N/A for this table, so I left them blank; they don't work regardless (really surprised Culture didn't work, too).

I'll just do Improvements, and I believe that covers everything you hadn't mentioned you were doing, Whoward.
 
That's great :D

I've just got the Beliefs changes to compile, so I'm calling it a night.

many thanks for all of those

W
 
Yields from Improvements

Culture Faith Food Gold Production Science
Improvement_AdjacentCityYields test test test test test
Improvement_AdjacentMountainYieldChanges test xml test test test
Improvement_CoastalLandYields test test test test test
Improvement_FreshWaterYields*
Improvement_HillsYields test test test test test
Improvement_PrereqNatureYields**
Improvement_ResourceType_Yields test xml xml xml test
Improvement_RouteYieldChanges test test test test test
Improvement_TechFreshWaterYieldChanges test xml test test test
Improvement_TechNoFreshWaterYieldChanges test xml test test test
Improvement_TechYieldChanges xml*** test xml xml xml xml
Improvement_YieldPerEra xml****
Improvement_Yields xml xml xml xml xml xml

*Literally does nothing, according to my tests (assuming it's supposed to increase improvement yields when the improvement is next to fresh water; tested near Lakes, Oases and Rivers).
**Not sure what this is supposed to do, but it didn't seem to do anything.
***I couldn't verify this with testing; not sure what's up with that. Chateaus and Brazil Woodcamps yield Culture, but not any of the test improvements (Forts, Farms)
****Couldn't replicate this, but IIRC, this is hardcoded in some way (to Landmarks, to being built over Archaeological Digs, I'm not sure)

Yields from Processes

Culture Faith Food Gold Production Science
Process_ProductionYields xml n/a xml
 
I did a lot of this before, at least making all current yields equal. Sadly, time constraints meant nothing was ever released. It's a couple patches behind now but it might still be useful to you. See our github repository.

These specific changes are under Shared Assets and in the DLL. Search for Revamped yields.

In general the old XML tables work just fine. The DLL is set up to convert them to the new system. This makes it backwards compatible. An exception to this rule is Building_ResourceCultureChanges. There already exist a Building_ResourceYieldChanges table, which does almost the same thing. IIRC the difference being CultureChanges add the yield to the building itself, while YieldChanges add the yield to the plot. We deemed it unnecessary to have two so similar tables and removed CultureChanges (moving monastery to use YieldChanges instead. Note: this is a bit of a nerf to the building).

These changes also include making great works able to produce any kind of yield, though this has not been properly tested and the lua for displaying great works has not been altered to accommodate the change.

It's been a long time since I worked on this code so I do not remember if absolutely everything was included but I think it was. The CultureBuildingYieldChange tag (not used in the game) was removed. I do not remember exactly why. The FaithFromImprovements tag was also removed but only because it was changed to a more advanced system.


As for all the other changes that are there, well none of us that were making those things are modding anymore so... feel free to use any of it. If you have any questions about any of it you can PM me or Jheral.
 
Top Bottom