Luxuries and AssignStartingPlots.lua

Aegnor

Chieftain
Joined
Oct 8, 2003
Messages
16
Location
Near Paris...
Hello,

I've added several new resources in my mod, and especially 4 new luxuries.
I would like to balance the repartition of the luxuries on my maps. I would like that ALL luxuries will be placed on the map with a balance of them.
I've made several tests with World builder on Pangea map type and I have always this similar result :

Spoiler :

The world size is WORLDSIZE_HUGE
Map Script: Generating Map
Map Script: Generating Plot Types (Lua Pangaea) ...
Map Script: Setting Plot Types (MapGenerator.Lua)
Map Script: Setting Plot Types (MapGenerator.Lua)
Map Script: Setting coasts and oceans (MapGenerator.Lua)
Map Script: Expanding coasts (MapGenerator.Lua)
Map Script: Setting Terrain Types (MapGenerator.Lua)
Map Script: Map Generation - Adding Rivers
Map Script: Map Generation - Adding Lakes
Map Script: 12 lakes added
Map Script: Adding Features (Lua Pangaea) ...
Map Script: Creating start plot database.
Map Script: Dividing the map in to Regions.
Map Script: Map Generation - Dividing the map in to Regions
Map Script: -
Map Script: Civs: 0
Map Script: City States: 0
Map Script: Choosing start locations for civilizations.
Map Script: Map Generation - Choosing Start Locations for Civilizations
Map Script: Normalizing start locations and assigning them to Players.
Map Script: Placing Natural Wonders.
Map Script: -
Map Script: -
Map Script: --- Number of Candidate Plots on the map for Natural Wonders ---
Map Script: -
Map Script: - 114 candidates for FEATURE_CRATER
Map Script: - 7 candidates for FEATURE_FUJI
Map Script: - 111 candidates for FEATURE_MESA
Map Script: - 356 candidates for FEATURE_REEF
Map Script: - 4218 candidates for FEATURE_VOLCANO
Map Script: - 426 candidates for FEATURE_GIBRALTAR
Map Script: - 520 candidates for FEATURE_GEYSER
Map Script: - 1541 candidates for FEATURE_FOUNTAIN_YOUTH
Map Script: - 1184 candidates for FEATURE_POTOSI
Map Script: - 365 candidates for FEATURE_EL_DORADO
Map Script: - 108 candidates for FEATURE_SRI_PADA
Map Script: - 65 candidates for FEATURE_MT_SINAI
Map Script: - 1099 candidates for FEATURE_MT_KAILASH
Map Script: - 220 candidates for FEATURE_ULURU
Map Script: -
Map Script: --- End of candidates readout for Natural Wonders ---
Map Script: -
Map Script: -- Placed all Natural Wonders --
Map Script: -
Map Script: -
Map Script: Placing Resources and City States.
Map Script: Map Generation - Assigning Luxury Resource Distribution
Map Script: --- Luxury Assignment Table ---
Map Script: -
Map Script: - - Assigned to Regions - -
Map Script: -
Map Script: - - Assigned to City States - -
Map Script: Luxury type 17
Map Script: Luxury type 23
Map Script: Luxury type 19
Map Script: -
Map Script: - - Assigned to Random - -
Map Script: Luxury type 13
Map Script: Luxury type 31
Map Script: Luxury type 26
Map Script: Luxury type 16
Map Script: Luxury type 24
Map Script: Luxury type 40
Map Script: Luxury type 37
Map Script: Luxury type 34
Map Script: Luxury type 30
Map Script: Luxury type 32
Map Script: Luxury type 20
Map Script: Luxury type 14
Map Script: Luxury type 21
Map Script: Luxury type 27
Map Script: Luxury type 25
Map Script: Luxury type 15
Map Script: Luxury type 22
Map Script: -
Map Script: - - Luxuries handled via Special Case - -
Map Script: Luxury type 18
Map Script: -
Map Script: - - Disabled - -
Map Script: - - - - - - - - - - - - - - - -
Map Script: Map Generation - Placing City States
Map Script: Map Generation - Choosing sites for City States
Map Script: All city states assigned.
Map Script: Map Generation - Placing Luxuries
Map Script: * *
Map Script: * iNumTypesRandom = 20
Map Script: * *
Map Script: Failed to place 2 units of Marble.
Map Script: Map Generation - Placing Strategics
Map Script: Map Generation - Placing Bonuses
Map Script: Map Generation - Placing NEW Bonuses
Map Script: Map Generation - Placing NEW Luxuries
Map Script: Map Generation - Normalize City State Locations
Map Script: -
Map Script: --- Table of Results, New Start Finder ---
Map Script: -
Map Script: --- End of Start Finder Results Table ---
Map Script: -
Map Script: -
Map Script: --- Table of Final Results, City State Placements ---
Map Script: -
Map Script: -
Map Script: - - - - -
Map Script: -
Map Script: --- Table of Final Results, Resource Distribution ---
Map Script: -
Map Script: - LUXURY Resources -
Map Script: - Whale...: 10
Map Script: - Pearls..: 10
Map Script: - Gold....: 0
Map Script: - Silver..: 10
Map Script: - Gems....: 0
Map Script: - Marble..: 0
Map Script: - Ivory...: 0
Map Script: - Fur.....: 3
Map Script: - Dye.....: 0
Map Script: - Spices..: 0
Map Script: - Silk....: 0
Map Script: - Sugar...: 10
Map Script: - Cotton..: 0
Map Script: - Wine....: 10
Map Script: - Incense.: 0
Map Script: - Expansion LUXURY Resources -
Map Script: - Copper..: 10
Map Script: - Salt....: 10
Map Script: - Citrus..: 10
Map Script: - Crab....: 10

Map Script: -
Map Script: + TOTAL.Lux: 130
Map Script: -
Map Script: - STRATEGIC Resources -
Map Script: - Iron....: 192
Map Script: - Horse...: 130
Map Script: - Coal....: 138
Map Script: - Oil.....: 204
Map Script: - Aluminum: 151
Map Script: - Uranium.: 102
Map Script: -
Map Script: - BONUS Resources -
Map Script: - Cow.....: 27
Map Script: - Wheat...: 19
Map Script: - Sheep...: 31
Map Script: - Deer....: 39
Map Script: - Banana..: 17
Map Script: - Fish....: 129
Map Script: - Stone...: 28
Map Script: - NEW BONUS Resources -
Map Script: - Oak.....: 39
Map Script: - Corn....: 27
Map Script: - Pig.....: 46
Map Script: - Rubber..: 13
Map Script: - NEW LUXURY Resources -
Map Script: - Cacao...: 11
Map Script: - Coffee..: 30
Map Script: - Tobacco.: 19
Map Script: - Tea.....: 27
Map Script: -
Map Script: -----------------------------------------------------
Map Script: -------------------------------
Map Script: Map Generation - Adding Goodies
Map Script: -------------------------------
Map Script: Determining continents for art purposes (MapGenerator.Lua)


As you can see in orange, not all the luxuries are generated. You have always some luxuries that not appeared. How I can change the AssignStartingPlots.lua to change this ? Or maybe, is this option in xml files, and not in AssignStartingPlots.lua ?

Second, in red, you can see that my additionnal luxuries have more plots than the others luxuries. I don't understand why, because they have the same parameters in resources.xml than the others luxuries. :confused:
 
Im 99% sure it is in AssignstartingPlots.lua, where and what to change I am not so sure on. I would test on a different mapscript, since Regions(where 50% of luxuries are sorted) is skipped with Pangea(One region).
Second, in red, you can see that my additionnal luxuries have more plots than the others luxuries. I don't understand why, because they have the same parameters in resources.xml than the others luxuries.

Set in AssignStartingPlots.lua, most of the XML is ignored when it comes to random mapscripts.
Code:
	local resources_to_place = {
	{self.deer_ID, 1, 100, 3, 4} };
	self:ProcessResourceList(25 * bonus_multiplier, 3, self.forest_flat_that_are_not_tundra, resources_to_place)
{self.deer_ID, 1, 100, 3, 4} }; :- The number in bold is what you change for Quantities, set it to 4 and the resource wll spawn with a quantity of 4. The last 2 numbers deal with the radius, first number is the minimum and the second the maximum.

25 * bonus_multiplier:- This bit decides the amount that get placed on the whole map, reduce the number in bold for more, increase it for less. Now when doing this you have to find a balance, some will spawn low some high depends what Bolean/Boleans you are using for the new resources. self.hills_open_list is a Bolean, plain grass or plains will always yield high numbers where forest, jungle, hill are medium, combinations are low.
 
Thanks for your answer, Horem.

Im 99% sure it is in AssignstartingPlots.lua, where and what to change I am not so sure on. I would test on a different mapscript, since Regions(where 50% of luxuries are sorted) is skipped with Pangea(One region).
I'm also pretty sure, but where ?


Set in AssignStartingPlots.lua, most of the XML is ignored when it comes to random mapscripts.
Code:
	local resources_to_place = {
	{self.deer_ID, 1, 100, 3, 4} };
	self:ProcessResourceList(25 * bonus_multiplier, 3, self.forest_flat_that_are_not_tundra, resources_to_place)
{self.deer_ID, 1, 100, 3, 4} }; :- The number in bold is what you change for Quantities, set it to 4 and the resource wll spawn with a quantity of 4. The last 2 numbers deal with the radius, first number is the minimum and the second the maximum.

25 * bonus_multiplier:- This bit decides the amount that get placed on the whole map, reduce the number in bold for more, increase it for less. Now when doing this you have to find a balance, some will spawn low some high depends what Bolean/Boleans you are using for the new resources. self.hills_open_list is a Bolean, plain grass or plains will always yield high numbers where forest, jungle, hill are medium, combinations are low.

I founded the solution. In my first try I used your solution, but in this case, the luxury resource is treated like a bonus resource. That's why I have a lot of luxuries resources.
Do not proceed like that for luxuries.
You have to change AssignStartingPlots:GetIndicesForLuxuryType in order to define where your luxuries would appear.
At the end of the function, I have added :
Spoiler :
elseif resource_ID == self.cacao_ID then
primary, secondary = 8, 6;
elseif resource_ID == self.tea_ID then
primary, secondary = 6, 4;
elseif resource_ID == self.coffee_ID then
primary, secondary = 6, 4;
elseif resource_ID == self.tobacco_ID then
primary, secondary = 12, 11;

I've also changed AssignStartingPlots:__InitLuxuryWeights in order to add some "weight" to my luxuries.
Now, this is the result :
Spoiler :

Map Script: - LUXURY Resources -
Map Script: - Whale...: 10
Map Script: - Pearls..: 10
Map Script: - Gold....: 10
Map Script: - Silver..: 10
Map Script: - Gems....: 0
Map Script: - Marble..: 0
Map Script: - Ivory...: 10
Map Script: - Fur.....: 9
Map Script: - Dye.....: 0
Map Script: - Spices..: 0
Map Script: - Silk....: 0
Map Script: - Sugar...: 0
Map Script: - Cotton..: 10
Map Script: - Wine....: 0
Map Script: - Incense.: 10
Map Script: - Expansion LUXURY Resources -
Map Script: - Copper..: 6
Map Script: - Salt....: 10
Map Script: - Citrus..: 0
Map Script: - Crab....: 10
Map Script: -
Map Script: + TOTAL.Lux: 143
Map Script: -
Map Script: - STRATEGIC Resources -
Map Script: - Iron....: 204
Map Script: - Horse...: 126
Map Script: - Coal....: 123
Map Script: - Oil.....: 266
Map Script: - Aluminum: 194
Map Script: - Uranium.: 76
Map Script: -
Map Script: - BONUS Resources -
Map Script: - Cow.....: 21
Map Script: - Wheat...: 27
Map Script: - Sheep...: 42
Map Script: - Deer....: 34
Map Script: - Banana..: 13
Map Script: - Fish....: 157
Map Script: - Stone...: 35
Map Script: - NEW BONUS Resources -
Map Script: - Oak.....: 33
Map Script: - Corn....: 21
Map Script: - Rubber..: 10
Map Script: - Pig.....: 21
Map Script: - NEW LUXURY Resources -
Map Script: - Cacao...: 6
Map Script: - Coffee..: 0
Map Script: - Tobacco.: 0
Map Script: - Tea.....: 10

My luxuries are treated like others luxuries.

Now, I will search how to place all the luxuries resources in the map.
 
:crazyeye:
Maybe I dont want Luxuries grouped by region. Maybe I want them spread around the whole map so each Civ has a chance of getting them.
Ooops, sorry, I'am aware that I've been too much directive in my phrase..:undecide:
You're absolutly right, you should proceed like that if it is your purpose to spread Luxuries in the world like Bonus or Strategical resources.
 
Back
Top Bottom