[GS] Limiting City Spawning

TheUnoriginal

Chieftain
Joined
Sep 1, 2018
Messages
10
Hi everyone.

I've been playing Civ 6 for a while and I always find myself getting frustrated- the AI creates far too many cities, in every possible nook and cranny.
Not only does it make it unreasonably difficult to win a domination victory, but at mid-game (or even before that) the game gets too slow to be playable. (Let me know if you think it's not because of the number of cities.)

Personally, I enjoy playing tall and looking for optimal positions to place my cities, and I like staying at around 6 cities. I also like playing on larger maps and taking the time to explore the map.

I thought about trying to force the game to do the same, so I came up with the following sql mod:
UPDATE GlobalParameters SET Value = 5 WHERE Name="CITY_MIN_RANGE";
UPDATE Units WHERE UnitType='UNIT_SETTLER' SET Cost=Cost*2;

This is my first mod, so feel free to correct it.
I also thought about making the settler cost exponential or limiting the number of settlers, but I have no idea how to do those...

Does anyone have any suggestions for improvements?

Thanks in advance!
 
Depending on how far you want to go with it, you can add a constraint to the Unit_BuildingPrereqs Table for Settler, and toggle that (fake) building in all cities if the maximum original cities are above/under a certain threshold via Lua. This would outright prevent cities from being made at your discretion.
 
You can also adjust the CostProgressionParam1 value to one much higher than the base-game uses for Settlers. The original base-game define for the Settler:
Code:
<Row UnitType="UNIT_SETTLER" Cost="80" BaseMoves="2"
BaseSightRange="3" ZoneOfControl="false" Domain="DOMAIN_LAND"
FormationClass="FORMATION_CLASS_CIVILIAN"
FoundCity="true" PopulationCost="1" PrereqPopulation="2"
AdvisorType="ADVISOR_GENERIC" Name="LOC_UNIT_SETTLER_NAME" Description="LOC_UNIT_SETTLER_DESCRIPTION"
CanCapture="False"
CostProgressionModel="COST_PROGRESSION_PREVIOUS_COPIES" CostProgressionParam1="30"
PurchaseYield="YIELD_GOLD" PseudoYieldType="PSEUDOYIELD_UNIT_SETTLER"/>
By increasing CostProgressionParam1 from "30" to a higher number, each additional settler built will cost much more than previous copies at a more-rapid per-copy cost-progresssion.

By altering the cost progression rather than the 'base' cost of the unit, the first settler constructed in a city is not such a heavy investment, whereras 3rd, 4th, etc., copies become a more costly proposition.

Gathering Storm also added an lua method to directly enable/disable construction or purchase of a unit for a particular player dynamically
Code:
Players[iPlayerID]:GetUnits():SetBuildDisabled(iUnitType, BooleanStatus)
 
Depending on how far you want to go with it, you can add a constraint to the Unit_BuildingPrereqs Table for Settler, and toggle that (fake) building in all cities if the maximum original cities are above/under a certain threshold via Lua. This would outright prevent cities from being made at your discretion.

I sort of get what you're trying to say, but it's too advanced for me to create by myself... I literally have only 2 lines of code under my belt except for simple coding in MATLAB.

You can also adjust the CostProgressionParam1 value to one much higher than the base-game uses for Settlers. The original base-game define for the Settler:
Code:
<Row UnitType="UNIT_SETTLER" Cost="80" BaseMoves="2"
BaseSightRange="3" ZoneOfControl="false" Domain="DOMAIN_LAND"
FormationClass="FORMATION_CLASS_CIVILIAN"
FoundCity="true" PopulationCost="1" PrereqPopulation="2"
AdvisorType="ADVISOR_GENERIC" Name="LOC_UNIT_SETTLER_NAME" Description="LOC_UNIT_SETTLER_DESCRIPTION"
CanCapture="False"
CostProgressionModel="COST_PROGRESSION_PREVIOUS_COPIES" CostProgressionParam1="30"
PurchaseYield="YIELD_GOLD" PseudoYieldType="PSEUDOYIELD_UNIT_SETTLER"/>
By increasing CostProgressionParam1 from "30" to a higher number, each additional settler built will cost much more than previous copies at a more-rapid per-copy cost-progresssion.

By altering the cost progression rather than the 'base' cost of the unit, the first settler constructed in a city is not such a heavy investment, whereras 3rd, 4th, etc., copies become a more costly proposition.

Gathering Storm also added an lua method to directly enable/disable construction or purchase of a unit for a particular player dynamically
Code:
Players[iPlayerID]:GetUnits():SetBuildDisabled(iUnitType, BooleanStatus)

Yes! The first thing you suggested is exactly what I'm looking for!
But please affirm what I'm thinking- by changing CostProgressionParam1 to a different number, I'm creating a different linear formula for settler costs. That is, instead of cost=80+30*(x-1) (where x is the number of settlers I made) I can change it to cost=80+40*(x-1), for example. I guess that means it's not possible to change the formula to an exponential one, right? As in cost=80*2^(x-1).
Can I change that parameter with an sql code or do I need to modify the game files?
Also, I was thinking of raising the population cost for each additional settler. Do you think it can be done?
 
You cannot change the formula "method", you can only change the "delta" values for how much more expensive in terms of production cogs (and therefore also gold) each additional settler will cost.

You can change the column argument value for CostProgressionParam1 in an SQL Update command just as you did for the "Cost" column argument. If you want each additional settler to cost 50 additional extra production, you can make an sql update as follows
Code:
UPDATE Units WHERE UnitType='UNIT_SETTLER' SET CostProgressionParam1 = 50;
You do not have to express column-data arguments as mathematical expressions in SQL, you are allowed to in SQL. In an XML file an "Update" cannot contain a mathematical expression -- in XML you must state direct numerical values.

You cannot with either SQL or XML make the population cost dynamic in any way for the Settler or any other unit. The population cost for settlers will always be whatever integer value is in the column after any and all mods make alterations to the database. Firaxis did not code anything into the game's controlling DLL source code for this as they did for the increasing production costs.
 
Last edited:
You cannot change the formula "method", you can only change the "delta" values for how much more expensive in terms of production cogs (and therefore also gold) each additional settler will cost.

You can change the column argument value for CostProgressionParam1 in an SQL Update command just as you did for the "Cost" column argument. If you want each additional settler to cost 50 additional extra production, you can make an sql update as follows
Code:
UPDATE Units WHERE UnitType='UNIT_SETTLER' SET CostProgressionParam1 = 50;
You do not have to express column-data arguments as mathematical expressions in SQL, you are allowed to in SQL. In an XML file an "Update" cannot contain a mathematical expression -- in XML you must state direct numerical values.

You cannot with either SQL or XML make the population cost dynamic in any way for the Settler or any other unit. The population cost for settlers will always be whatever integer value is in the column after any and all mods make alterations to the database. Firaxis did not code anything into the game's controlling DLL source code for this as they did for the increasing production costs.

Thank you so much for your help and detailed answers!
 
Back
Top Bottom