Resources quantity

Lord Yanaek

Emperor
Joined
Aug 15, 2003
Messages
1,662
Anybody figured how the quantity of strategic resources is calculated? In the database i found a Resource_QuantityTypes table with the following entries.
ResourceType|Quantity
RESOURCE_FIRAXITE|2
RESOURCE_FIRAXITE|3
RESOURCE_FLOAT_STONE|2
RESOURCE_FLOAT_STONE|3
RESOURCE_PETROLEUM|2
RESOURCE_PETROLEUM|4
RESOURCE_TITANIUM|2
RESOURCE_TITANIUM|4
RESOURCE_XENOMASS|2
RESOURCE_XENOMASS|3
But the actual resource quantities vary much more than this. I thought it might be multiplied by something in worlds table to account for bigger or smaller worlds but i didn't found anything. Nothing in defines either.

They didn't hard-code THIS did they :ar15:

EDIT : got it (sort of). It's controlled by SpawnStrategicResourcePlotBonus.lua
Code:
		-- Choose an amount
		local amount = 1;
		local quantityDeck = {};
		for resourceQuantityInfo in GameInfo.Resource_QuantityTypes("ResourceType = \"" .. resourceInfo.Type .. "\"") do
			table.insert(quantityDeck, resourceQuantityInfo.Quantity);
		end
		if (#quantityDeck > 0) then
			roll = Game.Rand(#quantityDeck, "Choosing how much of the resource to spawn from plot bonus") + 1;
			amount = quantityDeck[roll];
		end
Now, if anyone can explain the weird math used by this code to have anything from 2 to 10 floatstone with a database value of 2 or 3 :confused:
 
They didn't hard-code THIS did they

Of course they did (as BE is derived from CivV and resource placement was hard-coded for that as well)

Code:
function AssignStartingPlots:GetMajorStrategicResourceQuantityValues()
  -- This function determines quantity per tile for each strategic resource's major deposit size.
  -- Note: Large deposits of Xenomass are already on the board, having been placed in the hearts of Wild Areas in FeatureGenerator.
  local firaxite_base, geothermal_base, petroleum_base, titanium_base, floatstone_base, xenomass_base = 7, 5, 5, 5, 6, 7;
  local firaxite_range, geothermal_range, petroleum_range, titanium_range, floatstone_range, xenomass_range = 4, 2, 3, 3, 5, 4;
  -- Check the resource setting.
  if self.resource_setting == 1 then -- Sparse
    firaxite_base, geothermal_base, petroleum_base, titanium_base, floatstone_base, xenomass_base = 5, 3, 4, 4, 5, 5;
    firaxite_range, geothermal_range, petroleum_range, titanium_range, floatstone_range, xenomass_range = 3, 2, 3, 3, 3, 3;
  elseif self.resource_setting == 3 then -- Abundant
    firaxite_base, geothermal_base, petroleum_base, titanium_base, floatstone_base, xenomass_base = 9, 5, 6, 6, 8, 9;
    firaxite_range, geothermal_range, petroleum_range, titanium_range, floatstone_range, xenomass_range = 5, 3, 4, 4, 6, 5;
  end
  self.firaxite_base, self.geothermal_base, self.petroleum_base = firaxite_base, geothermal_base, petroleum_base;
  self.titanium_base, self.floatstone_base, self.xenomass_base = titanium_base, floatstone_base, xenomass_base;
  self.firaxite_range, self.geothermal_range, self.petroleum_range = firaxite_range, geothermal_range, petroleum_range;
  self.titanium_range, self.floatstone_range, self.xenomass_range = titanium_range, floatstone_range, xenomass_range;
end
 
Thanks.
Soooo, it was not in SpawnStrategicResourcePlotBonus.lua
But what are the database values used for then? AssignStartingPlots was the first script i checked but it does not read that table at all :confused:

I guess it's used when a satellite spawns resources. But why put this in the database and not the initial resources creation :spank:

Well, at least it's semi-hard coded as it's a in Lua
 
Back
Top Bottom