From: <bi...@us...> - 2012-05-05 22:06:54
|
Revision: 4884 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=4884&view=rev Author: bigjoe5 Date: 2012-05-05 22:06:47 +0000 (Sat, 05 May 2012) Log Message: ----------- -Added constants in shared_macros.txt for BASIC_PRODUCTION and PRODUCTION_PER_POP, which have been inserted in hopefully all relavent places. It should now be possible to adjust all population based bonuses by adjusting PRODUCTION_PER_POP, and all resource bonuses in general by adjusting BASIC_PRODUCTION. -Added a small constant to the new growth rate formula to avoid asymptotically approaching target. Modified Paths: -------------- trunk/FreeOrion/default/buildings.txt trunk/FreeOrion/default/shared_macros.txt trunk/FreeOrion/default/specials.txt trunk/FreeOrion/default/species.txt trunk/FreeOrion/default/techs.txt trunk/FreeOrion/universe/PopCenter.cpp Modified: trunk/FreeOrion/default/buildings.txt =================================================================== --- trunk/FreeOrion/default/buildings.txt 2012-05-05 13:00:26 UTC (rev 4883) +++ trunk/FreeOrion/default/buildings.txt 2012-05-05 22:06:47 UTC (rev 4884) @@ -1,3 +1,4 @@ +include "shared_macros.txt" BuildingType name = "BLD_CULTURE_ARCHIVES" @@ -14,9 +15,9 @@ Contains Source ] effects = [ - SetTargetResearch Value + .5 - SetTargetMining Value + Target.Population * 0.5 - SetTargetIndustry Value + Target.Population * 1.0 + SetTargetResearch Value + Target.Population * [[PRODUCTION_PER_POP]] + SetTargetMining Value + Target.Population * [[PRODUCTION_PER_POP]] + SetTargetIndustry Value + Target.Population * 2 * [[PRODUCTION_PER_POP]] ] EffectsGroup @@ -42,9 +43,9 @@ TargetPopulation low = 1 ] effectsgroups = [ - EffectsGroup - scope = And [ - Planet + EffectsGroup + scope = And [ + Planet Contains Source ] effects = SetTargetPopulation Value + Sum Defense Planet @@ -52,7 +53,7 @@ EffectsGroup scope = EmpireMeter empire = LocalCandidate.Owner meter = "METER_DETECTION" low = 5 high = 99999 effects = SetStealth Value + 10 - + EffectsGroup scope = And [ Planet @@ -403,7 +404,7 @@ Not OwnerHasTech "PRO_INDUSTRY_CENTER_II" ] stackinggroup = "INDUSTRY_CENTER_STACK" - effects = SetTargetIndustry Value + Target.Population * 0.5 + effects = SetTargetIndustry Value + Target.Population * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -415,7 +416,7 @@ Not OwnerHasTech "PRO_INDUSTRY_CENTER_III" ] stackinggroup = "INDUSTRY_CENTER_STACK" - effects = SetTargetIndustry Value + Target.Population + effects = SetTargetIndustry Value + Target.Population * 2 * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -424,7 +425,7 @@ ] activation = OwnerHasTech "PRO_INDUSTRY_CENTER_III" stackinggroup = "INDUSTRY_CENTER_STACK" - effects = SetTargetIndustry Value + Target.Population * 1.5 + effects = SetTargetIndustry Value + Target.Population * 3 * [[PRODUCTION_PER_POP]] ] icon = "" @@ -514,7 +515,7 @@ Not Stationary ] stackinggroup = "BLD_COLLECTIVE_NET_INDUSTRY_EFFECT" - effects = SetTargetIndustry Value + Target.Population * 0.5 + effects = SetTargetIndustry Value + Target.Population * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -527,7 +528,7 @@ Not Stationary ] stackinggroup = "BLD_COLLECTIVE_NET_RESEARCH_EFFECT" - effects = SetTargetResearch Value * 1.5 + effects = SetTargetResearch Value * 3 * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -540,7 +541,7 @@ Not Stationary ] stackinggroup = "BLD_COLLECTIVE_NET_MINING_EFFECT" - effects = SetTargetMining Value + 2.0 + effects = SetTargetMining Value + 2.0 * [[BASIC_PRODUCTION]] ] icon = "" @@ -637,7 +638,7 @@ ] activation = Source stackinggroup = "BLD_HYPER_DAM_BONUS" - effects = SetTargetIndustry Value + Target.Population + effects = SetTargetIndustry Value + Target.Population * 2 * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -667,7 +668,7 @@ ] activation = Star type = [Blue White] stackinggroup = "BLD_SOL_ORB_GEN_EFFECT" - effects = SetTargetIndustry Value + Target.Population + effects = SetTargetIndustry Value + Target.Population * 2 * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -677,7 +678,7 @@ ] activation = Star type = [Yellow Orange] stackinggroup = "BLD_SOL_ORB_GEN_EFFECT" - effects = SetTargetIndustry Value + Target.Population * 0.5 + effects = SetTargetIndustry Value + Target.Population * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -687,7 +688,7 @@ ] activation = Star type = Red stackinggroup = "BLD_SOL_ORB_GEN_EFFECT" - effects = SetTargetIndustry Value + Target.Population * 0.25 + effects = SetTargetIndustry Value + Target.Population * 0.5 * [[PRODUCTION_PER_POP]] ] icon = "icons/building/miniature_sun.png" @@ -805,7 +806,7 @@ ] effects = [ SetPopulation Target.Population - 3 - SetTargetIndustry Value + Target.Population * 5 + SetTargetIndustry Value + Target.Population * 10 * [[PRODUCTION_PER_POP]] SetIndustry Target.TargetIndustry ] @@ -845,7 +846,7 @@ ] activation = Star type = BlackHole stackinggroup = "BLD_BLACK_HOLE_POW_GEN_PRIMARY_EFFECT" - effects = SetTargetIndustry Value + Target.Population * 2 + effects = SetTargetIndustry Value + Target.Population * 4 * [[PRODUCTION_PER_POP]] icon = "icons/building/blackhole.png" BuildingType @@ -959,7 +960,7 @@ PopulationCenter ] activation = Source - effects = SetTargetPopulation 0.1 + Target.TargetPopulation - Target.TargetPopulation + effects = SetTargetPopulation 0.1 EffectsGroup scope = ContainedBy Contains Source @@ -982,7 +983,7 @@ ] activation = Source stackinggroup = "BLD_ENCLAVE_VOID_STACK" - effects = SetTargetResearch Value + Target.Population * 0.5 + effects = SetTargetResearch Value + Target.Population * [[PRODUCTION_PER_POP]] icon = "" BuildingType @@ -1069,7 +1070,7 @@ Focus "FOCUS_INDUSTRY" ] activation = Focus "FOCUS_INDUSTRY" - effects = SetTargetIndustry Value + Target.Population * 0.25 + effects = SetTargetIndustry Value + Target.Population * 0.5 * [[PRODUCTION_PER_POP]] icon = "" BuildingType Modified: trunk/FreeOrion/default/shared_macros.txt =================================================================== --- trunk/FreeOrion/default/shared_macros.txt 2012-05-05 13:00:26 UTC (rev 4883) +++ trunk/FreeOrion/default/shared_macros.txt 2012-05-05 22:06:47 UTC (rev 4884) @@ -1,4 +1,12 @@ +/* R E S O U R C E P R O D U C T I O N */ +PRODUCTION_PER_POP +'''0.5 * [[BASIC_PRODUCTION]]''' + +BASIC_PRODUCTION +'''1.0''' + + /* S T E A L T H */ STEALTH_BOOST_LOW Modified: trunk/FreeOrion/default/specials.txt =================================================================== --- trunk/FreeOrion/default/specials.txt 2012-05-05 13:00:26 UTC (rev 4883) +++ trunk/FreeOrion/default/specials.txt 2012-05-05 22:06:47 UTC (rev 4884) @@ -15,7 +15,7 @@ scope = Source activation = Source effects = [ - SetTargetResearch Value + .3 + SetTargetResearch Value + .3 * [[BASIC_PRODUCTION]] SetTargetConstruction Value - 20 ] graphic = "icons/specials_huge/eccentric_orbit.png" @@ -36,7 +36,7 @@ activation = Source effects = [ SetTargetConstruction Value - 20 - SetTargetIndustry Value + Target.Population * 0.2 + SetTargetIndustry Value + Target.Population * 0.4 * [[PRODUCTION_PER_POP]] ] graphic = "icons/specials_huge/tidal_lock.png" @@ -275,7 +275,7 @@ ] activation = Focus "FOCUS_RESEARCH" stackinggroup = "COMPUTRONIUM_STACK" - effects = SetTargetResearch Value + Target.Population * 0.5 + effects = SetTargetResearch Value + Target.Population * [[PRODUCTION_PER_POP]] [[CHANCE_OF_GUARD_1]] @@ -743,7 +743,7 @@ ] ] effects = [ - SetEmpireMineralStockpile value = Value + 2.0 + SetEmpireMineralStockpile value = Value + 2.0 * [[BASIC_PRODUCTION]] GenerateSitRepMessage message = "EFFECT_DERELICT_MINERALS" parameters = [ @@ -1319,19 +1319,19 @@ ''' EffectsGroup scope = Source activation = Focus "FOCUS_MINING" - effects = SetTargetMining Value + 5.0 + effects = SetTargetMining Value + 5.0 * [[BASIC_PRODUCTION]] EffectsGroup scope = Source activation = Focus "FOCUS_HEAVY_MINING" - effects = SetTargetMining Value + Target.Population * 2 + effects = SetTargetMining Value + Target.Population * 4 * [[PRODUCTION_PER_POP]] ''' STANDARD_INDUSTRY_BOOST ''' EffectsGroup scope = Source activation = Focus "FOCUS_INDUSTRY" - effects = SetTargetIndustry Value + Target.Population * .5 + effects = SetTargetIndustry Value + Target.Population * [[PRODUCTION_PER_POP]] ''' Modified: trunk/FreeOrion/default/species.txt =================================================================== --- trunk/FreeOrion/default/species.txt 2012-05-05 13:00:26 UTC (rev 4883) +++ trunk/FreeOrion/default/species.txt 2012-05-05 22:06:47 UTC (rev 4884) @@ -1,3 +1,5 @@ +include "shared_macros.txt" + //#######################################################\\ //#### ####\\ //#### P L A Y A B L E S P E C I E S ####\\ @@ -2289,7 +2291,7 @@ Planet size = Tiny ] accountinglabel = "FOCUS_MINING_LABEL" - effects = SetTargetMining Value + 4.0 + Target.Population * 0.2 + effects = SetTargetMining Value + 4.0 * [[BASIC_PRODUCTION]] + Target.Population * 0.4 * [[PRODUCTION_PER_POP]] EffectsGroup scope = Source @@ -2298,7 +2300,7 @@ Planet size = Small ] accountinglabel = "FOCUS_MINING_LABEL" - effects = SetTargetMining Value + 3.0 + Target.Population * 0.2 + effects = SetTargetMining Value + 3.0 * [[BASIC_PRODUCTION]] + Target.Population * 0.4 * [[PRODUCTION_PER_POP]] EffectsGroup scope = Source @@ -2307,7 +2309,7 @@ Planet size = Medium ] accountinglabel = "FOCUS_MINING_LABEL" - effects = SetTargetMining Value + 2.0 + Target.Population * 0.2 + effects = SetTargetMining Value + 2.0 * [[BASIC_PRODUCTION]] + Target.Population * 0.4 * [[PRODUCTION_PER_POP]] EffectsGroup scope = Source @@ -2316,7 +2318,7 @@ Planet size = Large ] accountinglabel = "FOCUS_MINING_LABEL" - effects = SetTargetMining Value + 1.0 + Target.Population * 0.2 + effects = SetTargetMining Value + 1.0 * [[BASIC_PRODUCTION]] + Target.Population * 0.4 * [[PRODUCTION_PER_POP]] EffectsGroup scope = Source @@ -2325,7 +2327,7 @@ Planet size = [Huge GasGiant] ] accountinglabel = "FOCUS_MINING_LABEL" - effects = SetTargetMining Value + Target.Population * 0.2 + effects = SetTargetMining Value + Target.Population * 0.4 * [[PRODUCTION_PER_POP]] EffectsGroup scope = Source @@ -2334,13 +2336,13 @@ Planet type = Asteroids ] accountinglabel = "ASTEROID_MINING_LABEL" - effects = SetTargetMining Value + 3 + effects = SetTargetMining Value + 3 * [[BASIC_PRODUCTION]] EffectsGroup scope = Source activation = Focus "FOCUS_HEAVY_MINING" accountinglabel = "FOCUS_HEAVY_MINING_LABEL" - effects = SetTargetMining Value + Target.Population * 4 + effects = SetTargetMining Value + Target.Population * 8 * [[PRODUCTION_PER_POP]] EffectsGroup scope = Source @@ -2414,7 +2416,7 @@ scope = Source activation = Focus type = "FOCUS_INDUSTRY" accountinglabel = "FOCUS_INDUSTRY_LABEL" - effects = SetTargetIndustry Value + Target.Population * .5 + effects = SetTargetIndustry Value + Target.Population * [[PRODUCTION_PER_POP]] ''' GOOD_INDUSTRY @@ -2464,7 +2466,7 @@ scope = Source activation = Focus type = "FOCUS_RESEARCH" accountinglabel = "FOCUS_RESEARCH_LABEL" - effects = SetTargetResearch Value + Target.Population * .5 + effects = SetTargetResearch Value + Target.Population * [[PRODUCTION_PER_POP]] ''' GOOD_RESEARCH Modified: trunk/FreeOrion/default/techs.txt =================================================================== --- trunk/FreeOrion/default/techs.txt 2012-05-05 13:00:26 UTC (rev 4883) +++ trunk/FreeOrion/default/techs.txt 2012-05-05 22:06:47 UTC (rev 4884) @@ -359,7 +359,7 @@ OwnedBy TheEmpire Source.Owner PopulationCenter ] - effects = SetTargetResearch Value + .5 + effects = SetTargetResearch Value + .5 * [[BASIC_PRODUCTION]] graphic = "icons/tech/basic_autolabs.png" Tech @@ -446,7 +446,7 @@ OwnedBy TheEmpire Source.Owner Focus "FOCUS_RESEARCH" ] - effects = SetTargetResearch Value + Target.Population * 0.5 + effects = SetTargetResearch Value + Target.Population * [[PRODUCTION_PER_POP]] Tech name = "LRN_TIME_MECH" @@ -514,7 +514,7 @@ PopulationCenter Focus "FOCUS_RESEARCH" ] - effects = SetTargetResearch Value + Target.Population * 0.25 + effects = SetTargetResearch Value + Target.Population * 0.5 * [[PRODUCTION_PER_POP]] Tech name = "LRN_OBSERVATORY_I" @@ -571,7 +571,7 @@ Star type = BlackHole Focus "FOCUS_RESEARCH" ] - effects = SetTargetResearch Value + Target.Population * 1.0 + effects = SetTargetResearch Value + Target.Population * 2 * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -580,7 +580,7 @@ Star type = Neutron Focus "FOCUS_RESEARCH" ] - effects = SetTargetResearch Value + Target.Population * 0.75 + effects = SetTargetResearch Value + Target.Population * 1.5 * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -589,7 +589,7 @@ Star type = [Blue White] Focus "FOCUS_RESEARCH" ] - effects = SetTargetResearch Value + Target.Population * 0.5 + effects = SetTargetResearch Value + Target.Population * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -598,7 +598,7 @@ Star type = [Red Orange Yellow] Focus "FOCUS_RESEARCH" ] - effects = SetTargetResearch Value + Target.Population * 0.25 + effects = SetTargetResearch Value + Target.Population * 0.5 * [[PRODUCTION_PER_POP]] ] graphic = "icons/tech/stellar_tomography.png" @@ -912,7 +912,7 @@ PopulationCenter Focus "FOCUS_MINING" ] - effects = SetTargetMining Value + 1.0 + effects = SetTargetMining Value + 1.0 * [[BASIC_PRODUCTION]] EffectsGroup scope = And [ @@ -920,7 +920,7 @@ PopulationCenter Focus "FOCUS_INDUSTRY" ] - effects = SetTargetIndustry Value + Target.Population * 0.25 + effects = SetTargetIndustry Value + Target.Population * 0.5 * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -1071,7 +1071,7 @@ ProductionCenter Focus "FOCUS_INDUSTRY" ] - effects = SetTargetIndustry Value + Target.Population * 0.2 + effects = SetTargetIndustry Value + Target.Population * 0.4 * [[PRODUCTION_PER_POP]] EffectsGroup scope = And [ @@ -1079,7 +1079,7 @@ ProductionCenter Focus "FOCUS_MINING" ] - effects = SetTargetMining Value + 1.0 + effects = SetTargetMining Value + 1.0 * [[BASIC_PRODUCTION]] ] graphic = "icons/tech/robotic_production.png" @@ -1132,7 +1132,7 @@ PopulationCenter Focus "FOCUS_INDUSTRY" ] - effects = SetTargetIndustry Value + Target.Population * 0.5 + effects = SetTargetIndustry Value + Target.Population * [[PRODUCTION_PER_POP]] graphic = "icons/tech/fusion_generation.png" Tech @@ -1176,7 +1176,7 @@ PopulationCenter OwnedBy TheEmpire Source.Owner ] - effects = SetTargetIndustry Value + .5 + effects = SetTargetIndustry Value + .5 * [[BASIC_PRODUCTION]] graphic = "icons/tech/basic_autofactories.png" /* Find some other use for this concept: */ @@ -1290,7 +1290,7 @@ Focus "FOCUS_MINING" ] activation = OwnerHasTech "PRO_ASTEROID_MINE" - effects = SetTargetMining Value + 1.0 + effects = SetTargetMining Value + 1.0 * [[BASIC_PRODUCTION]] graphic = "icons/tech/asteroid_mining_ii.png" Tech @@ -1309,7 +1309,7 @@ Planet size = Tiny Focus "FOCUS_MINING" ] - effects = SetTargetMining Value + 2.0 + effects = SetTargetMining Value + 2.0 * [[BASIC_PRODUCTION]] EffectsGroup scope = And [ @@ -1318,7 +1318,7 @@ Planet size = Small Focus "FOCUS_MINING" ] - effects = SetTargetMining Value + 1.5 + effects = SetTargetMining Value + 1.5 * [[BASIC_PRODUCTION]] EffectsGroup scope = And [ @@ -1327,7 +1327,7 @@ Planet size = Medium Focus "FOCUS_MINING" ] - effects = SetTargetMining Value + 1.0 + effects = SetTargetMining Value + 1.0 * [[BASIC_PRODUCTION]] EffectsGroup scope = And [ @@ -1336,7 +1336,7 @@ Planet size = Large Focus "FOCUS_MINING" ] - effects = SetTargetMining Value + .5 + effects = SetTargetMining Value + .5 * [[BASIC_PRODUCTION]] ] graphic = "icons/tech/deep_core_mining.png" Modified: trunk/FreeOrion/universe/PopCenter.cpp =================================================================== --- trunk/FreeOrion/universe/PopCenter.cpp 2012-05-05 13:00:26 UTC (rev 4883) +++ trunk/FreeOrion/universe/PopCenter.cpp 2012-05-05 22:06:47 UTC (rev 4884) @@ -83,10 +83,14 @@ double cur_pop = GetMeter(METER_POPULATION)->Current(); double pop_change = 0.0; - if (target_pop > cur_pop) - pop_change = cur_pop * (target_pop - cur_pop) / 100; - else - pop_change = -(cur_pop - target_pop) / 10; + if (target_pop > cur_pop) { + pop_change = cur_pop * (target_pop - cur_pop) / 100 + 0.05; // Adding a constant avoids slow asymptotic growth towards target. + pop_change = std::min(pop_change, target_pop - cur_pop); + } + else { + pop_change = -(cur_pop - target_pop) / 10 - 0.05; + pop_change = std::max(pop_change, target_pop - cur_pop); + } return pop_change; } |