[MapScript] Erebus Continent

Guys, I need help with this bit of python...


Code:
x = plot.getX()
y = plot.getY()

# cycle through the surrounding plots
for xx in range(x - 3, x + 3):
	for yy in range(y - 3, y + 3):
		if yy == y or xx == x:
			continue
		nPlot = gameMap.plot(xx,yy)
		featureType = nPlot.getFeatureType()
		terrainType = nPlot.getTerrainType()
		cityRing = float(max(abs(x-xx),abs(y-yy)))
		cityRingMod = 0
		if nPlot.isRiver():
			cityRingMod = -1

		# With FfH we need to make sure we don't break the unique
		# features, which are really improvements.
		if nPlot.getImprovementType() == ImprovementTypes.NO_IMPROVEMENT and nPlot.getBonusType(TeamTypes.NO_TEAM) == BonusTypes.NO_BONUS:
			if terrainType == tundra: 
				if tv < 2:
					if PRand.random() > 0.1 * (cityRing + cityRingMod):
						nPlot.setTerrainType(grass,True,True)
					elif PRand.random() > 0.1 * (cityRing + cityRingMod):
						nPlot.setTerrainType(snow,True,True)
			if nPlot.getPlotType() == PlotTypes.PLOT_HILLS:
				if PRand.random() > 0.3 * (cityRing + cityRingMod):
					nPlot.setPlotType(PlotTypes.PLOT_LAND,True,True)
					if nPlot.isRiver() and terrainType == desert:
					       nPlot.setFeatureType(mc.itFeatureFloodPlains,0)	
			elif nPlot.isPeak():
				if PRand.random() > 0.15 * (cityRing + cityRingMod) or cityRing == 1:
					nPlot.setPlotType(PlotTypes.PLOT_HILLS,True,True)

			if featureType == mc.itFeatureJungle and jv < 2:
				if PRand.random() > 0.15 * (cityRing + cityRingMod):
					nPlot.setFeatureType(mc.itFeatureForest,0)
			elif featureType == mc.itFeatureForest and tv > 1:
				if PRand.random() > 0.25 * (cityRing + cityRingMod):
					nPlot.setFeatureType(mc.itNoFeature,0)

			if PRand.random() > 0.2 * (cityRing + cityRingMod):
				nPlot.setTerrainType(grass,True,True)
			elif terrainType == snow and tv < 2:
				if PRand.random() > 0.1 * (cityRing + cityRingMod):
					nPlot.setTerrainType(tundra,True,True)
return






ok so what this code does is clear bad terrain around starting positions in a square shape.

However, it leaves a big + shape unchanged directly above, below, left and right of the starting tile. it looks horrible O.o

How could I change the code to also include those tiles? the starting tile should be considered cityRing == 0 , adjacent ones cityRing == 1 etc.

also it would be awesome if the range for this clearing could be tied to map size: 3 for duel/tiny, 4 for small/standard, 5 for large/huge .


Many, many thanks in advance to anyone that can help :)
 
Wouldn't including those tiles look just as horrible? i.e., the "big + shape" will simply be even bigger.
 
nope, the worst that could happen is you'd get a big square shape, not a cross.

right now if you strenghten the weight for removal it looks very bad as you get two straight lines of bad terrain going out of the city tile, one running N-S and one running W-E .
 
You could change the 3's in rows 5 & 6 to a variable, iradius, with it's value based on map size.

Not sure what you're saying about the + shape. Do you have pictures to show what it's doing/what you'd prefer it to do?
 
You could change the 3's in rows 5 & 6 to a variable, iradius, with it's value based on map size.

that's exactly what I had in mind, unfortunately it's way beyond my python skills :lol:

about the + shape, I've been told removing

Code:
if yy == y or xx == x:
             continue


will fix it, so that issue should be already solved :)
 
[to_xp]Gekko;11167591 said:
unfortunately it's way beyond my python skills :lol:

I haven't previously done any python editing using worldinfo or maps but something like this might work:

Spoiler :
Code:
iradius = 3

if gc.getWorldInfo(map.getWorldSize()).getType() = gc.getInfoTypeForString('WORLDSIZE_DUEL') or gc.getWorldInfo(map.getWorldSize()).getType() = gc.getInfoTypeForString('WORLDSIZE_TINY'):
	iradius = 2
elif gc.getWorldInfo(map.getWorldSize()).getType() = gc.getInfoTypeForString('WORLDSIZE_LARGE') or gc.getWorldInfo(map.getWorldSize()).getType() = gc.getInfoTypeForString('WORLDSIZE_HUGE'):
	iradius = 4
 
Great... let us know if it works

PS I still don't get the problem... it seems you don't like it being a + shape but are OK with a square (even if the square has the same abrupt transitions). I'd think the solution would be to have a blending of the transition with some level of randomness.
 
I'll try to make it more clear :)

this mapscript includes some code that clears ( with some randomness involved ) bad terrain in a square around the starting plots.

however, tiles directly above, below, west and right of the starting plot are not affected. thus, you get a + sign of bad terrain centered in your city plot.

Doviello example:

you get a city in a spot that's mostly grasslands. would you not notice the cross of tundra centered in your city? :D
 
Perhaps someone with more knowledge of the script could answer a few questions I have:

I'd like to play a map with all 31 civilisations in the game (RifE, with the Hamstalfar disabled) present on the map, in appropriate starts. If possible, I'd also like the Age of Ice challenge to be activated. However, some brief experimentation seems to indicate that the script isn't considering neighbours, so eg the Bannor are miles away from the Cult of Embers, with the Chislev on the other side of the continent. Is there some method I'm missing?

There also seem to be some options available in the play now menus which are missing from the custom game menus, although it may be my imagination. Am I correct?

Also, will the Age of Ice challenge break the map generation in any way?

Finally, looking in worldbuilder, 31 civs are understandably cramped on even a huge map. Is there any way to increase the size of the map being generated?
 
Oh, also if you simply want to make civs start further (or closer) you want this code (line 5658):
Code:
		# Varying distance preferences based on world size and cohesion
		worldsizes = {
			WorldSizeTypes.WORLDSIZE_DUEL:      [7,6,5],
			WorldSizeTypes.WORLDSIZE_TINY:      [7,6,5],
			WorldSizeTypes.WORLDSIZE_SMALL:     [8,7,6],
			WorldSizeTypes.WORLDSIZE_STANDARD:  [8,7,6],
			WorldSizeTypes.WORLDSIZE_LARGE:     [9,8,7],
			WorldSizeTypes.WORLDSIZE_HUGE:      [9,8,7]
			}
#FlavourMod: Added by Jean Elcard 02/26/2009
		if hasattr(WorldSizeTypes, "WORLDSIZE_GIANT"):
			worldsizes[WorldSizeTypes.WORLDSIZE_GIANT] = [10,9,8]
The three numbers again represent the cohesion setting (high, medium, low) you can increase them to start civs further apart. The code is 'smart' in the sense that it will forcibly reduce those values if needed as each civ is placed based on the remaining number of unassigned starting plots. So if you put absurdly high number in there the first civ placed will have nobody anywhere near it but subsequent civs will have neighbors that are closer. You'll want to be careful about using numbers that are too high because civs will be forced to just pick an open spot regardless of its value if there isn't enough room.

This 'grain' is modified by civ preferences as well. The clan, for example, has a high neighbor preference (2) so playing on a standard size high cohesion map would cause them to block starting plots within 6 tiles of their start rather than 8. Sidar, on the other hand, want to be isolated (-2) so they will block starts within 10 tiles of their starting plot. This does not meant these two civs would start 16 tiles apart, it means no civ placed after them will start less than 6 tiles from the clan or 10 tiles form the sidar. If the clan is placed first the sidar may start 6 tiles from the clan but the next civ couldn't start within 10 tiles of the Sidar. Civs are placed in a random order sorted by their neighbor value with those with non-zero values being placed first.

I tried changing SMALL [8,7,6] to [11,9,8]. I started a game with high cohesion with Beeri Bawl. Arendel started 6 tiles next to me, and Cassiel and Mahala also started really close. Land is not a problem, since large amounts of empty land are there elsewhere. Here's the map:


Four of us started out ridiculously close (like a 12 civ duel map). I've had this problem on the standard size too. I feel this map script is the best one for FFH, but this crowding problem makes it annoying.

EDIT: I'm playing on Magister Modmod. Does that make any difference?
 
if you raise it too much and it can't respect your rules it will override them. in that specific pic you're trying to fit too many civs on a small map for example ;)

these are the values I use:

Spoiler :
WorldSizeTypes.WORLDSIZE_DUEL: [9,8,7],
WorldSizeTypes.WORLDSIZE_TINY: [9,8,7],
WorldSizeTypes.WORLDSIZE_SMALL: [11,10,9],
WorldSizeTypes.WORLDSIZE_STANDARD: [11,10,9],
WorldSizeTypes.WORLDSIZE_LARGE: [13,12,11],
WorldSizeTypes.WORLDSIZE_HUGE: [13,12,11]


the more civs you use, the smaller these values have to be or they'll be ignored. ditto for lowering cohesion or sealevel. using smart climate and/or great plains helps as there will be more good land available.
 
[to_xp]Gekko;12946969 said:
if you raise it too much and it can't respect your rules it will override them. in that specific pic you're trying to fit too many civs on a small map for example ;)

these are the values I use:

Spoiler :
WorldSizeTypes.WORLDSIZE_DUEL: [9,8,7],
WorldSizeTypes.WORLDSIZE_TINY: [9,8,7],
WorldSizeTypes.WORLDSIZE_SMALL: [11,10,9],
WorldSizeTypes.WORLDSIZE_STANDARD: [11,10,9],
WorldSizeTypes.WORLDSIZE_LARGE: [13,12,11],
WorldSizeTypes.WORLDSIZE_HUGE: [13,12,11]


the more civs you use, the smaller these values have to be or they'll be ignored. ditto for lowering cohesion or sealevel. using smart climate and/or great plains helps as there will be more good land available.

Thanks. I usually use 9 civs for a small/10 civs for a standard map, which might explain the problem. I'll try some more games and see how it goes.
 
I switched computers and am trying to get this map script, however the link in the OP doesn't work. Can anyone suggest how to fix this problem or an alternative download site?
 
Edit: I was able to download it in Safari. Not sure why IE was being a pain in the rear about it.
 
Hi, can someone help me and tell where in the map file I can set the following settings?
Mountain
Fewer

Desert Chance
Low

Taiga Chance
Low

Plains Chance
High

Jungle Chance
Low

Forest Density
Increased

World Map
All (x & y)

Unit Placement
Same Tile

River and Lakes
Increased

Advanced Terrain
ON

Smart Climate
OFF

Ancient City Ruins
ON

I tried to read the map-file, but it looks a little to complex for me. I would prefer not to set again and again the same settings. :)

Another Quesiton is, is this map working good together with the mod Ashes of Erebus?
 
Hi, can someone help me and tell where in the map file I can set the following settings?
Mountain
Fewer

Desert Chance
Low

Taiga Chance
Low

Plains Chance
High

Jungle Chance
Low

Forest Density
Increased

World Map
All (x & y)

Unit Placement
Same Tile

River and Lakes
Increased

Advanced Terrain
ON

Smart Climate
OFF

Ancient City Ruins
ON

I tried to read the map-file, but it looks a little to complex for me. I would prefer not to set again and again the same settings. :)

I think you'd have to go to lines 4115-4140.
I.e
Spoiler :
Code:
if optionID == 0: #Cohesion
		return 1#"Medium"
	elif optionID == 1: #Mountains
		return 0#"Standard (Default)"
	elif optionID == 2: #Desert
		return 1#"Low"
	elif optionID == 3: #Tundra
		return 2#"Reduced"
	elif optionID == 4: #Plains
		return 2#"Very High"
	elif optionID == 5: #Jungle
		return 1#"Low"
	elif optionID == 6: #Forest Density
		return 2#"Increased"
	elif optionID == 7: #Wrap
		return 1#"East-West (x)"
	elif optionID == 8: #Player Starts
		return 0#"Full Flavor (Default)"
	elif optionID == 9: #Rivers & lakes
		return 2#"Increased"
	elif optionID == 10: #Advanced Terrain
		return 1#"On (place Ancient Forests)"
	elif optionID == 11: #Smart Climate
		return 1#"On (minimal effects)"
	elif optionID == 12: #Ancient Ruins
		return 1#"On (Place ancient city ruin clusters)"

And the legend for the return valuesis given in lines 3975-4092.
 
Top Bottom