Is it possible to exchange fundamental yields and add new yields?

historix69

Emperor
Joined
Sep 30, 2008
Messages
1,412
Example 1 :
Food is used to feed population and is used for population growth.
Can you mod the game in a way that a population with enough food generates a new kind of "population growth points" which are used to trigger population growth or allows the player to buy population?
(This would be a precondition to allow real transportation of food in the game and would avoid the situation where a city trades away all its food for an increase in population.)

Example 2 :
Technological advance is based on science points generated by cities. A civ with 100 cities will advance around 10-100 times faster than a civ with only one city. By applying a logarithm to science points before calculating research, the snowball effect of wide empires on science progress could be softened.
e.g. : Research points per Turn = log (Science points per Turn)
This would require to change Tech Costs from science points to the new research points. How do you do this? Where are Tech Costs linked to Science so that one can change this?
Can you let players buy Tech for Gold?

Example 3 :
Gold is accumulated globally while other yields like food or production are treated locally (per city). Where can I mod that production or food are collected globally like Gold?

Example 4 :
Amenities ... can you mod the game to get amenities from working a tile (e.g. improved luxury) or working a building?
 
Ad 1. City generates food, consumes some and surplus is stored. Once there’s enough stored, a new citizen is born. When would you say happens „enough food” situation?
Ad 2. Yup, this situation is known from the start and there are many threads about it. You can’t change science points into logarithmic scale with current tools. You can’t change the cost of the tech while in game. You may try to slow down generation of points - see my mod Real Science Pace.
Can’t buy tech for gold, but this can be done easily using a Lua script.
Ad 3. Internal engine mechanism. Can’t change it without access to dll. You may try to add an additional layer with Lua but AI would be disconnected from it.
Ad 4. There are modifier effects that adjust Amenities from improvements and buildings. Haven’t seen Amenities from Specialists. Also haven’t seen a Requirement that would test if a tile is being worked. So, imo, answer is no to both your questions.
 
The food mechanic is there since Civ1.
The original idea is that a society with a lot of food has lower childhood mortality etc. However in Civ games the population does not consume the surplus food but only the 2 food per pop and the rest is stored and later transformed into a new citizen.
I would allow people to eat more food per turn which may provide a production and happyness bonus to the city. Population Growth Points per turn would be assigned based on food supply, health, water, etc and would create a new citizen when reaching a threshold (similar to current food point system). However the food stock would not be emptied. Instead people would store a reserve of food for a couple of turns and consume surplus per turn or even trade it with other cities.
Civ Call to Power had such mechanisms like food rations.
 
So... let’s say you eat 2kg of food per day, like a normal rate. And once you get rich and can afford for „surplus” food, you are going to eat 5kg?
I suppose the next logical step would be to introduce a negative production modifier due to obesity.
 
If the minimum to survive is 2 food per pop, a usage of 2.5 or 3 food per pop would be appreciated and make people happy and allow population growth.
If a city has size 10 and you allow 3 food per pop per turn that is 30 food per turn for the city. It was not meant to allow 5 food per pop.

So a population with minimum food will not grow = 0 Growth Points. A population with 2.5 Food per pop might get 1 Growth Point per turn, with 3 Food per pop 2 Growth Point per turn. Maybe 20 Growth Points needed for the next pop.

If you produce more food than you need, you can switch farmers to work in buildings or other tiles as in real life.
 
There is no support for „minimum food”, „food needed” or „food allowed by player” in the game. All food not consumed is considered „growth points” because that is exactly what you gather to create a new citizen. So, you may call this 2 food per pop as „minimum food” if you want.

You can assign citizens to work as Specialists instead of working tiles with farms, etc. when you feel you have enough food surplus.
 
All examples should be possible but not easy to do, you'll have to neutralize the old mechanisms then re-code them for your design in Lua, and make sure that you don't break the AI in the process.
 
Can you mod the game in a way that a population with enough food generates a new kind of "population growth points" which are used to trigger population growth or allows the player to buy population?
(This would be a precondition to allow real transportation of food in the game and would avoid the situation where a city trades away all its food for an increase in population.)


Easiest way to do this IMO is create a unit that reduces the Population in the city in which it is built (Settlers already do this) and increases Population in the city where you "expend" it, using mechanics basically similar to stepping on a goody hut that increases population. How difficult it would be is hard for me to say. Someone may even have done it already.



Technological advance is based on science points generated by cities. A civ with 100 cities will advance around 10-100 times faster than a civ with only one city. By applying a logarithm to science points before calculating research, the snowball effect of wide empires on science progress could be softened.
e.g. : Research points per Turn = log (Science points per Turn)
This would require to change Tech Costs from science points to the new research points. How do you do this? Where are Tech Costs linked to Science so that one can change this?


I don't know for sure that it would work the same way, but if you just wanted a stacking penalty as the player adds more and more cities you could create a "recursive" ATTACH_ Modifier where each city the player builds receives a Modifier that reduces their Science %. It wouldn't be truly logarithmic but you could definitely get some Civ 5 style penalties. You could also control how many cities have to exist before it starts, etc. You can kind of see the opposite of that in the code below, part of my "Hell Mode" code that gives the AI bonus Sci and Cult for each district they own. What you're trying to do would likely use different Modifiers, this is just an example of one way it can work.

Note that you wouldn't want to follow this example in its entirety, because it also includes code that allows player to shut off this extra feature (those are the references to tblQuoOptions in the code). This is just intended as a high level of example of adjusting science or culture output based on the activity of a player.

Code:
INSERT INTO Requirements
    (RequirementId,         RequirementType,     Likeliness,    Inverse,     Triggered)
VALUES    ('QUO_REQ_HELLMODE_AI_TECH_UNLOCK_TIER_2',         'REQUIREMENT_GAME_ERA_ATLEAST_EXPANSION',    0,0,0) ,
        ('QUO_REQ_HELLMODE_AI_TECH_UNLOCK_TIER_3',         'REQUIREMENT_GAME_ERA_ATLEAST_EXPANSION',    0,0,0) ;


INSERT INTO RequirementArguments
    (RequirementId,            Name,             Type,             Value,                 Extra,     SecondExtra)
VALUES     ('QUO_REQ_HELLMODE_AI_TECH_UNLOCK_TIER_2',    'EraType',        'ARGTYPE_IDENTITY',    'ERA_RENAISSANCE',    NULL,    NULL     ) ,
        ('QUO_REQ_HELLMODE_AI_TECH_UNLOCK_TIER_3',    'EraType',        'ARGTYPE_IDENTITY',    'ERA_ATOMIC',    NULL,    NULL     ) ;       


INSERT INTO RequirementSets
    (RequirementSetId,         RequirementSetType)
VALUES     ('QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_2',     'REQUIREMENTSET_TEST_ALL') ,
        ('QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_3',     'REQUIREMENTSET_TEST_ALL') ;


INSERT INTO RequirementSetRequirements
    (RequirementSetId,    RequirementId)
VALUES    ('QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_2',     'QUO_REQ_HELLMODE_AI_TECH_UNLOCK_TIER_2'),
        ('QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_3',     'QUO_REQ_HELLMODE_AI_TECH_UNLOCK_TIER_3')  ,
        ('QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_2',     'REQUIRES_PLAYER_IS_AI'),
        ('QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_3',     'REQUIRES_PLAYER_IS_AI') ;
        


INSERT INTO Modifiers
    (ModifierId, ModifierType, RunOnce, Permanent, OwnerRequirementSetId, SubjectRequirementSetId)
VALUES    ('QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT', 'MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_PER_DISTRICT', 0, 0, NULL, 'PLAYER_IS_AI') ,
        ('QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT', 'MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_PER_DISTRICT', 0, 0, NULL, 'PLAYER_IS_AI') ,
        ('QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT_2', 'MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_PER_DISTRICT', 0, 0, NULL, 'QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_2') ,
        ('QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT_2', 'MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_PER_DISTRICT', 0, 0, NULL, 'QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_2') ,
        ('QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT_3', 'MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_PER_DISTRICT', 0, 0, NULL, 'QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_3') ,
        ('QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT_3', 'MODIFIER_PLAYER_CITIES_ADJUST_CITY_YIELD_PER_DISTRICT', 0, 0, NULL, 'QUO_REQSET_HELLMODE_AI_TECH_UNLOCK_TIER_3') ;

INSERT INTO ModifierArguments
    (ModifierId,             Name,         Type,             Value,             Extra,     SecondExtra)
VALUES    ('QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT',     'Amount',     'ARGTYPE_IDENTITY',     '1',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT',     'YieldType',     'ARGTYPE_IDENTITY',     'YIELD_SCIENCE',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT',     'Amount',     'ARGTYPE_IDENTITY',     '1',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT',     'YieldType',     'ARGTYPE_IDENTITY',     'YIELD_CULTURE',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT_2',     'Amount',     'ARGTYPE_IDENTITY',     '1',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT_2',     'YieldType',     'ARGTYPE_IDENTITY',     'YIELD_SCIENCE',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT_2',     'Amount',     'ARGTYPE_IDENTITY',     '1',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT_2',     'YieldType',     'ARGTYPE_IDENTITY',     'YIELD_CULTURE',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT_3',     'Amount',     'ARGTYPE_IDENTITY',     '1',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT_3',     'YieldType',     'ARGTYPE_IDENTITY',     'YIELD_SCIENCE',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT_3',     'Amount',     'ARGTYPE_IDENTITY',     '1',            NULL,     NULL) ,
        ('QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT_3',     'YieldType',     'ARGTYPE_IDENTITY',     'YIELD_CULTURE',            NULL,     NULL) ;


INSERT INTO TraitModifiers
    (TraitType,             ModifierID)
SELECT 'TRAIT_LEADER_MAJOR_CIV',    'QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT'
FROM tblQuoOptions WHERE tblQuoOptions.OptionID='QUO_OPTION_HELL_MODE_TIER' AND tblQuoOptions.Value >= 2 ;

INSERT INTO TraitModifiers
    (TraitType,             ModifierID)
SELECT 'TRAIT_LEADER_MAJOR_CIV',    'QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT'
FROM tblQuoOptions WHERE tblQuoOptions.OptionID='QUO_OPTION_HELL_MODE_TIER' AND tblQuoOptions.Value >= 2 ;

INSERT INTO TraitModifiers
    (TraitType,             ModifierID)
SELECT 'TRAIT_LEADER_MAJOR_CIV',    'QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT_2'
FROM tblQuoOptions WHERE tblQuoOptions.OptionID='QUO_OPTION_HELL_MODE_TIER' AND tblQuoOptions.Value >= 2 ;

INSERT INTO TraitModifiers
    (TraitType,             ModifierID)
SELECT 'TRAIT_LEADER_MAJOR_CIV',    'QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT_2'
FROM tblQuoOptions WHERE tblQuoOptions.OptionID='QUO_OPTION_HELL_MODE_TIER' AND tblQuoOptions.Value >= 2 ;

INSERT INTO TraitModifiers
    (TraitType,             ModifierID)
SELECT 'TRAIT_LEADER_MAJOR_CIV',    'QUO_AI_HELLMODE_BONUS_TECH_PER_DISTRICT_3'
FROM tblQuoOptions WHERE tblQuoOptions.OptionID='QUO_OPTION_HELL_MODE_TIER' AND tblQuoOptions.Value >= 2 ;

INSERT INTO TraitModifiers
    (TraitType,             ModifierID)
SELECT 'TRAIT_LEADER_MAJOR_CIV',    'QUO_AI_HELLMODE_BONUS_CULTURE_PER_DISTRICT_3'
FROM tblQuoOptions WHERE tblQuoOptions.OptionID='QUO_OPTION_HELL_MODE_TIER' AND tblQuoOptions.Value >= 2 ;
 
Example 2 :
Technological advance is based on science points generated by cities. A civ with 100 cities will advance around 10-100 times faster than a civ with only one city. By applying a logarithm to science points before calculating research, the snowball effect of wide empires on science progress could be softened.
e.g. : Research points per Turn = log (Science points per Turn)
This one is easy with lua:
ChangeCurrentResearchProgress(-yourLogarithmicFormulaWithCities)
 
Back
Top Bottom