whoward69
DLL Minion
Holy Grail 1 - Unified Yields
Background
"Things" produce yields, which in turn are consumed or used to produce different things, for example
Definitions
Summary
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
New Primary Tables
New Secondary Yield Tables
===============================================
Original post follows
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
- 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.)
- 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.
- 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.)
- 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)
- 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
- Belief_CapitalYieldChanges
- Belief_CityYieldFromUnimprovedFeature
- Belief_CoastalCityYieldChanges
- Belief_GreatPersonExpendedYield
- Belief_GreatWorkYieldChanges
- Belief_PlotYieldChanges
- Belief_SpecialistYieldChanges
- Belief_TradeRouteYieldChange
- Belief_UnimprovedFeatureYieldChanges
- Belief_YieldFromBarbarianKills
- Belief_YieldFromKills
- Belief_YieldPerFollowingCity
- Belief_YieldPerOtherReligionFollower
- Belief_YieldPerXFollowers
- Building_PlotYieldChanges
- Feature_CoastalLandYields
- Feature_FreshWaterYields
- Feature_TechYieldChanges
- Improvement_YieldAdjacentSameType
- Plot_Yields
- Policy_CityYieldFromUnimprovedFeature
- Policy_FeatureYieldChanges
- Policy_GreatPersonExpendedYield
- Policy_PlotYieldChanges
- Policy_ResourceYieldChanges
- Policy_SpecialistYieldChanges
- Policy_TerrainYieldChanges
- Policy_TradeRouteYieldChange
- Policy_UnimprovedFeatureYieldChanges
- Policy_YieldChangesNaturalWonder
- Policy_YieldChangeTradeRoute
- Policy_YieldChangeWorldWonder
- Policy_YieldFromBarbarianKills
- Policy_YieldFromKills
- Terrain_CoastalLandYields
- Terrain_FreshWaterYields
- Terrain_TechYieldChanges
- Trait_BuildingClassYieldChanges
- Trait_CapitalYieldChanges
- Trait_CityYieldChanges
- Trait_CityYieldFromUnimprovedFeature
- Trait_CoastalCityYieldChanges
- Trait_FeatureYieldChanges
- Trait_GreatPersonExpendedYield
- Trait_GreatWorkYieldChanges
- Trait_PlotYieldChanges
- Trait_ResourceYieldChanges
- Trait_TerrainYieldChanges
- Trait_TradeRouteYieldChange
- Trait_YieldChangeTradeRoute
- Trait_YieldChangeWorldWonder
- Trait_YieldFromBarbarianKills
- Trait_YieldFromKills
- Unit_YieldFromBarbarianKills
- UnitPromotions_YieldFromBarbarianKills
- UnitPromotions_YieldFromKills
===============================================
Original post follows
Spoiler :
Standard yields
The scale of the problem
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]
- 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
- Tourism (YIELD_TOURISM)
- Golden Age Points (YIELD_GOLDEN_AGE_POINTS)
- Local Happiness
- Global Happiness
- Great People points - one per type (Engineer, Scientist, Merchant, Artist, Muscian, Writer, General, Admiral, Prophet)
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]