Drying out Pangaea Script Help

Lib.Spi't

Overlord of the Wasteland
Joined
Feb 12, 2009
Messages
3,708
Location
UK
So I am trying to figure out a way to reduce the amount of sea (or increase the amount of land) of the pangaea mapscript to make a kind of random USA Continent.

Here is what I have so far in my musings.

I think the ocean is 'controlled' in the parts before the terrain generator.

import CvMapGeneratorUtil
from CvMapGeneratorUtil import MultilayeredFractal
from CvMapGeneratorUtil import HintedWorld

You can't decrease the amount of ocean (I think maps start out as just ocean) so you actually increase the amount of land you want.
What I haven't figured out is where you do that within those files, or whether you do it in the pangea file.
I think it must be in the pangaea file... I think the others are like 'world logic' like a desert doesn't go next to grassland... (or whatever logic it uses)

There are what seem like 3 kinds of 'world' layouts pangaea uses.

class PangaeaHintedWorld:
generateSorensHintedPangaea
generateAndysHintedPangaea
PangaeaMultilayeredFractal

I don't know if these are all part of one script, or are used independently depending on map choices you make or some such..

I have found some 'sort of' mentions to land mass or size in these.
In Soren
Spoiler :
Code:
NiTextOut("Setting Plot Types (Python Pangaea) ...")
		global hinted_world
		hinted_world = HintedWorld(8,4)

		mapRand = CyGlobalContext().getGame().getMapRand()

		for y in range(hinted_world.h):
			for x in range(hinted_world.w):
				if x in (0, hinted_world.w-1) or y in (0, hinted_world.h-1):
					hinted_world.setValue(x,y,0)
				else:
					hinted_world.setValue(x,y,200 + mapRand.get(55, "Plot Types - Pangaea PYTHON"))

In Andy
Spoiler :
Code:
def generateAndysHintedPangaea(self):
		NiTextOut("Setting Plot Types (Python Pangaea Hinted) ...")
		global hinted_world
		hinted_world = HintedWorld(16,8)

		mapRand = CyGlobalContext().getGame().getMapRand()

		numBlocks = hinted_world.w * hinted_world.h
		numBlocksLand = int(numBlocks*0.33)
		cont = hinted_world.addContinent(numBlocksLand,mapRand.get(5, "Generate Plot Types PYTHON")+4,mapRand.get(3, "Generate Plot Types PYTHON")+2)
		if not cont:
			# Couldn't create continent! Reverting to Soren's Hinted Pangaea
			return self.generateSorensHintedPangaea()
		else:		
			for x in range(hinted_world.w):
				for y in (0, hinted_world.h - 1):
					hinted_world.setValue(x,y, 1) # force ocean at poles
			hinted_world.buildAllContinents()
			return hinted_world.generatePlotTypes(shift_plot_types=True)

In Fractal
Spoiler :
Code:
# The following regions are specific to Pangaea.py
		mainWestLon = 0.2
		mainEastLon = 0.8
		mainSouthLat = 0.2
		mainNorthLat = 0.8
		subcontinentDimension = 0.4
		bSouthwardShift = False

Then This.....

		# Generate the main land mass, first pass (to vary shape).
		mainWestX = int(self.iW * mainWestLon)
		mainEastX = int(self.iW * mainEastLon)
		mainNorthY = int(self.iH * mainNorthLat)
		mainSouthY = int(self.iH * mainSouthLat)
		mainWidth = mainEastX - mainWestX + 1
		mainHeight = mainNorthY - mainSouthY + 1
		
		mainWater = 55+sea

		self.generatePlotsInRegion(mainWater,
		                           mainWidth, mainHeight,
		                           mainWestX, mainSouthY,
		                           2, grain,
		                           self.iHorzFlags, self.iTerrainFlags,
		                           -1, -1,
		                           True, 15,
		                           2, False,
		                           False
		                           )

		# Second pass (to ensure cohesion).
		second_layerHeight = mainHeight/2
		second_layerWestX = mainWestX + mainWidth/10
		second_layerEastX = mainEastX - mainWidth/10
		second_layerWidth = second_layerEastX - second_layerWestX + 1
		second_layerNorthY = mainNorthY - mainHeight/4
		second_layerSouthY = mainSouthY + mainHeight/4

		second_layerWater = 60+sea
                
		self.generatePlotsInRegion(second_layerWater,
		                           second_layerWidth, second_layerHeight,
		                           second_layerWestX, second_layerSouthY,
		                           1, grain,
		                           self.iHorzFlags, self.iTerrainFlags,
		                           -1, -1,
		                           True, 15,
		                           2, False,
		                           False
		                           )

I just can't figure out what I should what I should fiddle with... also in the fractal bit I am not sure what 'sea' refers too. Where the value of 'sea' is quantified. As it is say 55+sea.
 
I killed pangaea by changing 3 numbers....

mainWestLon = 0.6 (was 0.2)

mainWater = 15 (was 55+sea)

second_layerWater = 20 (was 60+sea)

Another fun fact was that eveyone started on the same tile! :D

On the plus side there is a lot less water on the east side of the map.... just a lot more water everywhere else...
 

Attachments

  • Not Pangaea.jpg
    Not Pangaea.jpg
    15.9 KB · Views: 67
Well I stuck pangaea back together but it is all looking a bit lopsided!

mainWidth = mainEastX - mainWestX + 2 (was mainEastX - mainWestX + 1)

changing the other two to just 'sea' no +

What I can't figure out is what is shoving it south in both cases...
 

Attachments

  • Not Pangaea 1.jpg
    Not Pangaea 1.jpg
    16.5 KB · Views: 119
second_layerWestX = mainWestX - mainWidth/10
second_layerEastX = mainEastX + mainWidth/10

Was:
second_layerWestX = mainWestX + mainWidth/10
second_layerEastX = mainEastX - mainWidth/10

If anyone spots the logic in all this... do let me know because my head is spinning!?! :crazyeye:

What is interesting is that there is less water both north and south.. before it was just south that had less... Unfortunately I haven't ouched anything that refers to the north or south I don't think..
 

Attachments

  • Not Pangaea 3.jpg
    Not Pangaea 3.jpg
    16.9 KB · Views: 92
Try this one if you dare! :D

What I did (highly experimental!) is: ignore the different randoms & options chosen in def generatePlotTypes by forcing generateAndysHintedPangaea.

Reason: it's easier to deal with just 1 script!

Then, in generateAndysHintedPangaea, I replaced this:
Code:
		# numBlocksLand = int(numBlocks*0.33) # isenchine
		numBlocksLand = int(numBlocks*1)

From my tests, it looks like you get one massive continent (without sub-parts), with minimum water. I'm not sure if that's what you really want though.

What looks odd here is the wrap X meaning that the west coast can see the east coast (and viceversa!).
 

Attachments

  • Pangaea.rar
    5.2 KB · Views: 33
Yeah, I was going to deal with the wrapping at a later date, or get it so that the east and west coast water add up to 4 or 5 so that you can't 'see' the otherside of the continent! :D

Ok, let's see what madness you have wrought upon the earth!

EDIT:
Well.... that just looks pretty damn epic doesn't it!

You pretty much nailed that.... Well done and many thanks! (out of curiosity how much time did you spend working that out?)

Do you think you could try the same magic with this mapscript as well.

It is based on pangaea, but is different.

I don't know if it has the same methods in it for generating the land mass, but maybe you would know where to stick it if it doesn't?
 

Attachments

  • Fury_Road.7z
    5.7 KB · Views: 44
First, I spent quite some time to try to understand how the file is structured. When I saw that there are actually three different scripts and that they are chosen with some randomness, I looked at all and this one seemed easier as it was too tempting to change that single line! :D

Of course, if you want a bit more water, you can try with 0.9 or something.

Now frankly speaking, the results look pretty much the same and I couldn't help to think: why not just a map/scenario then, with random starting locations and random resources?

Let's be clear that the player's choice is simply ignored here (solid, pressed, natural, random).

For the other script, I can have a look at it tomorrow afternoon. Otherwise, I'm pretty busy at the moment.
 
Try this version (I did not test it).

My changes are all in def generatePangaea and are a blunt copy of the previous Pangaea extra version...

If this works, you can get rid of the Pangaea one.

As for the scenario/map, there's nothing too complicate there. Once you have generated a map you really like, save it in World Builder and you have got one. I can then guide you through the steps of finalising it or you can guide me to have it finalised as you wish. ;)
 

Attachments

  • Fury_Road.rar
    6.1 KB · Views: 47
That is great!

I think that will be brilliant for quite a long time. It removes a lot of the issues that were a problem like one civ getting trapped in a 'corner' of land and such.

Eventually I would like to work some 'left to right' changes into the script, to develop the 'playstyle' of the mod, but this is great.

there are some general 'rules' to the land that people can exploit, but it still actually looks pretty random, and the spread of things like vaults and resources, still makes exploring and scouting city sites important.

Once again you have delivered Mr Isenchine and Fathomed the Unfathomable!

Cheers!
 
Top Bottom