How to retrieve the Biome ("Map Terrain") setting selected during map generation?

Barathor

Emperor
Joined
May 7, 2011
Messages
1,202
Anybody know or have a pretty good guess on how to obtain the biome (Lush, Fungal, or Arid) selected by users during map generation?

I've been searching through the code for any examples or clues and have only come across a few things. They seem to be referred to as "planets" instead of what they're usually called, "biomes".

XML: There's a table called "Planets" with info for each. (So GameInfo.Planets() is used to access row information)

Lua: AdvancedSetup.lua line 509 is part of the "Map Terrain" option.

Using the PreGame type, it utilizes these methods:

PreGame.SetPlanet( id )
PreGame.GetPlanet()

Since we can't view the source code, I just tested out some random functions with print commands to see if I get any results and none of these worked so far:

Game.GetPlanet()
Map.GetPlanet()
PreGame.GetPlanet()
Game.GetPlanetType()
Map.GetPlanetType()

I was hoping to simply get an integer value returned of the selected biome's ID.


- - - - - - - - - -

Or, is there a way to find out which option was chosen by the user for these first five non-custom settings?

Similar to how Map.GetCustomOption(#) is used to obtain the number of the option chosen for custom setting #.
 
Also, I tried messing around with Map.DefaultContinentStamper() to see if that's still used to stamp the terrain art on.

I called the function earlier right after generating a fractal and designating land/water plots. (I would need the info early in order to make adjustments to hills/mountains, terrain, and features.)

I used this to print out the value of each land plot so I can see the results and if it's accurate with the chosen map terrain.
Code:
local gridWidth, gridHeight = Map.GetGridSize();
local planet
for x = 0, gridWidth - 1 do
	for y = 0, gridHeight - 1 do
		local plot = Map.GetPlot(x, y)
		if not plot:IsWater() then
			planet = plot:GetContinentArtType()
			print("BIOME TEST:", planet)
		end
	end
end

It didn't work, I was getting multiple values between 1 and 4, just like the default Civ 5 behaviour and its art styles.

I was then curious to see if this function is even needed in Beyond Earth and if it's just running needlessly because BE just stamps the terrain with one art style and also doesn't need to make all the area and distance calculations that this function makes to assign multiple art styles.

So, I disabled it by overriding where it's called, DetermineContinents(), with an empty copy and the game still generated the map normally.

- - - - - - - - - -

I'm guessing my only chance here is to somehow get the number of the option chosen by the user under the Map Terrain setting.

Though, there's a random option there as well, so unless I know what the randomly generated number is assigned to, I'm just going to get a 1 since that's the first option. :(
 
Maybe I'm missing something obvious here, but PreGame.GetPlanet() seems to work just fine for me.

Code:
local planet = PreGame.GetPlanet();	
print(planet)
...returns 0, 1 or 2 for Lush/Fungus/Desert as found in the Planets-Table (defined in PlanetSpec.xml), even if Random Terrain is chosen in the menu.

/edit: Ah never mind - doesn't seem to work during map generation. Should have checked that first. ;)
 
Back
Top Bottom