So as I am winding through the code I wanted to create a thread to discuss the progress of the mod comp and the features in the mod comp. Here are the current version information notes: Spoiler : -----v0.4BtS------ - Fixed a bug in the civilization founding city stockpiling code... I had wrongly assumed that city IDs started at 0. They do not. - Added first pass at the automated city resource bleed code. Each turn cities will bleed out a max of 10% of their stockpiled resources divided between any cities within a 10 tile radius. Cities that have the same number of a particular resource as the target city won't bleed the resource to them. - Added the city resource export screen. This screen is accessed by clicking on the appropriate resource in the main city screen. - Added export order infrastructure that will delay delivery of exported city stockpiled resources till the next turn. It might be good to add a delivery delay timer to the ExportOrder structure. This way modders could change the code so exported city stockpiled resources could take n number of turns to reach the target city where n is the number of tiles between the cities. - Modified the city resource bleed code so it uses the export order code. This will enable modders to change the python so the automated export orders can be cancelled. This is done by just removing the code that disables the cancel export order button. Spoiler : -----v0.3.5BtS------ - Added <bCarriesCityStockpile> and <iCityStockpilePercent> tags allowing modders to indicate if a unit should take some of the stockpile from a city and carry it. If the unit happens to be a settler unit then the units stockpile will be deposited into the city that the unit founds. - Added mouse over information for units so stockpiled resources are displayed correctly - Added the <FoundingCityBonusStockpiles> tag structure allowing modders to specify one or more bonus stockpiles to the founding city of a civilization. -----v0.3BtS------ - Added bonus decay rate code infrastructure to CvCity in preparation for decay rate modifier tags in the building and tech info structures. - Added bonus decay rate code infrastructure to CvPlayer in preparation for decay rate modifier tags in the building and tech info structures. Also updated code that founds cities so bonus decay modifier is updated to include the players values if available. - Added the <BonusDecayRateModifiers> tags structure to the building info structure that provides modders the ability to specify that a building changes the decay rate for one or more bonuses. The value is defined in terms of percentages. A negative percentage value will reduce the decay rate. A positive percentage will increase the decay rate. If one or more decay rate modifiers end up changing the decay rate to a negative number then the system will automatically change the decay rate to 0 since negative decay rates do not make sense. - Added the <BonusDecayRateModifiers> tags structure to the tech info structure that provides modders the ability to specify that a tech changes the decay rate for one or more bonuses. The value is defined in terms of percentages. A negative percentage value will reduce the decay rate. A positive percentage will increase the decay rate. If one or more decay rate modifiers end up changing the decay rate to a negative number then the system will automatically change the decay rate to 0 since negative decay rates do not make sense. - Added a forth pass read for the Civ4TechInfo.xml file to enable the <BonusDecayRateModifiers> tag. - Added the <RequiredStockpiledResources> tag structure for the unit info structure. This allows modders to require one or more stockpiled resources for units to be trained. - Added the <RequiredStockpiledResources> tag structure for the building info structure. This allows modders to require one or more stockpiled resources for builgings to be constructed. - Added the <RequiredStockpiledResources> tag structure for the project info structure. This allows modders to require one or more stockpiled resources for projects to be constructed. -----v0.2BtS------ - Added feature to count the number of appropriately improved plots. Updated the SDK code to award an extra resource stockpile for each tile that is appropriately improved. Appropriately improved is defined as an improvement that makes the bonus valid... fishing boats on fish, whaling boats on whales, etc. - Added the <BonusMaintenanceCosts> tag set to the building info struture that allows modders to specify a maintenance cost in stockpiled bonus amount. If there isn't enough stockpile of a particular type of resource available then the building will become effectively disabled - it will not provide its benefits until a stockpile of the required resource becomes available. - Added resource consumption code for buildings. When a building does not have the stockpiled resources to be active then they are made dorment until there are enough resources stockpiled to make them active again. - Updated the city screen UI so hovering over buildings shows required maintenance bonuses if needed. - After much internal debate the decay rate has been changed to a percentage instead of an absolute. This way a resource cannot decay into nothing. Instead resources will decay by the percentage provided. This will allow for more flexability in the future when building and technology decay rate modifiers are added. The decay rate is applied to resources after everything else has had a chance to eat away at the resource. For example if a city has a decay rate of 25% for fish and that city has a stockpile of 12 fish at the beginning of the turn, a building that requires 2 fish/turn then there would be 7.5 fish available after buildings consume their required maintenance and the decay rate is applied. One will notice after several turns the growth of the resource will slowly decay realistically modelling the aging and eventual spoiling of the resource meaning: STOCKPILE GROWTH IS NOT LINEAR! - Updated the building and bonus pedia screens through the SDK to make sure they reflect stockpiling information correctly. -----v0.1BtS------ - Setup City Resource Stockpiles infrastructure - Added the required infrastructure in the SDK to support having cities stockpile all resources - Added support methods in the SDK to check to see if resources are being worked by a city. - Updated the UI so hovering over resources in the city screen display the correct number of stockpiled resources and the number of resources per turn that get stockpiled. - Updated the bonus change and hasBonus methods to use the new bonus local to city code to make sure bonuses are only given to the city owning the tile. A configuration option to change this will be added so modders can deside if they want cities to be greedy or not. - Added the <bStockpileable> tag to the bonus info structure. If the tag is set then that bonus resource will stockpile in cities, be unavailable in other cities if configured to do so, etc. - Added the <fDecayRate> tag to the bonus info structure. If the tag is set then the resource will decay the point amount set per turn. If the stockpile runs out in the city then anything in the city using that resource will "turn off" until enough of that resource is stocked up again. - Added the <StockpilingPrereqBuilding> tag to the bonus info structure. If the tag is set then the resource will only stockpile when the city that has access to the resource has the building built. Updated the UI so the benefits don't show up if the prereq hasn't been built yet in the city. - Updated SDK code so when a city with a stockpile of resources but no actual resources available runs out of the stockpile the code removes the bonus effects. - Updated SDK code so when a city with a no stockpile of resources and no actual resources available has a stockpile added the bonus effects are then added as if the city had access to the resource. Design notes: Spoiler : 7b) Add resource consumption code. - Corporations should "turn off" if there aren't enough resources for corporations next turn 11) populate in CvCity.cpp: - processBonusStockpile - doBonusCnsumpotion 16) Add trade route effects to stockpile resources 23) Add ability in city screen to select and send resources from host city to target city 24) Add switch per city and per player to turn off bleed effect 25) Add a tag to buildings that increases the resource bleed amount n) Add configurable game options - All cities having access to resources stockpile the resources. n+1) Add python infrastructure to set configurable options n+2) Extract localizable strings Ideas: - Code to manually turn buildings on/off - Code to manually turn corporations on/off DONE) 1) Add data structure and infrastructure in CvCity.cpp to warehouse resource amount stockpiling information 2) Expose resource stockpiling infrastructure through SDK to python 3) Define a tag for Bonus info structure that indicates if the resource should stack in cities or not 4) Define tag(s) in units and building info structures that indicates if building the unit or building consumes resources (type and amount) - maybe key off of <BonusType> and <PrereqBonuses> tags... might want to completely change how these tags are implemented - done for buildings 5) Update main city screen to show number of resources stockpiled plus growth per turn: X (+Y) where X is the total amount and (+Y) is the growth per turn. 6) Add tags to building structure that define resource consumption per turn... 7a) Add resource consumption code. - Buildings should "turn off" if there aren't enough resources for buildings next turn 8) Update main city screen with mouse over info for resources showing total information: production amount, consumption amount ( who is consuming per turn ) - Partially done... need to include unit consumption. - Make sure to add resource bleed to other cities as part of consumption 9) Add tag to resources to specify required building to stockpile. 10) Add tag to resources to specify stockpile decay rate 12) Add slow bleed of resources to other cities if configured to do so. - Only bleed resources from one city to another city if the target city can stockpile the resource - Add configurable option to only allow x bleed distance from host city to target cities - Add resource bleed cache that is only applied at the beginning of the turn... 13) Add decay rate modifiers tag to buildings and add decay rate getting code to CvCity CvGameTextMgr should use the getDecayRate method from there instead of straight from the bonus info object 14) Add building required for stockpiling tag 15) Change building required for stockpiling tag to building class instead or look at code to check for building prereq with civ specific building 17) Add tag structure to add game start stockpiles per civilization 18) Update building and bonus pedia screens to reflect new tags 19) Add decay rate modifiers tag to techs 20) Add tags to indicate stockpiled resource requirement for building construction - Make sure to take awake stockpile amount when building construction starts - Make sure to give back the stockpile amount if building construction is cancelled. 21) Add tags to indicate stockpiled resource requirement for unit training - Make sure to take awake stockpile amount when unit training starts - Make sure to give back the stockpile amount if training the unit is cancelled. 22) Add tags to indicate stockpiled resource requirement for project creation - Make sure to take awake stockpile amount when project creation starts - Make sure to give back the stockpile amount if project creation is cancelled.