phungus420
Deity
- Joined
- Mar 1, 2003
- Messages
- 6,296
OK, thanks for the expenation. If that's the case, then how do I convert Desert, Arctic, and Tundra in the BFC?
OK, thanks for the expenation. If that's the case, then how do I convert Desert, Arctic, and Tundra in the BFC?
if bonusInfo.getBonusClassType() == BonusClassTypes.BONUSCLASS_WONDER:
continue
~
My request for a version that doesn't use wonderclass resources for sweetening still stands, and I still have no idea why I'm getting floodplains on hills.
I thought maybe I can at least remove stone/marble sweetening myself because I simply don't want to keep the edited xml file around, I failed though.
Adding this code between lines 4499 and 4500 simply causes the error "StartingPlotfinder failed" at appear every single, and since that doesn't happen with the xml change, so clearly this doesn't work the way I want.Code:if bonusInfo.getBonusClassType() == BonusClassTypes.BONUSCLASS_WONDER: continue
The error:
Traceback (most recent call last):
File "PerfectWorld205c2", line 5730, in assignStartingPlots
File "PerfectWorld205c2", line 4240, in SetStartingPlots
AttributeError: type object 'CvPythonExtensions.BonusClassTypes' has no attribute 'BONUSCLASS_WONDER'
ERR: Python function assignStartingPlots failed, module PerfectWorld205c2
if plot.getPlotType() == PlotTypes.PLOT_HILLS and gameMap.plot(x,y).[B]getArea[/B] == plot.[B]getArea()[/B]:
hillsFound += 1
#Ensure minimum number of hills
hillsNeeded = mc.MinHillsInFC - hillsFound
print "hills found = %d, hills needed = %d" % (hillsFound,hillsNeeded)
if hillsNeeded > 0:
for plot in plotList:
if hillsNeeded <= 0:
break
[B] featureInfo = gc.getFeatureInfo(plot.getFeatureType())
requiresFlatlands = False
if featureInfo != None:
requiresFlatlands = featureInfo.isRequiresFlatlands()[/B]
if plot.getPlotType() != PlotTypes.PLOT_HILLS and \
plot.getArea() == gameMap.plot(x,y).getArea() [B]and \
plot.getBonusType(TeamTypes.NO_TEAM) == BonusTypes.NO_BONUS and \
not requiresFlatlands[/B]:
plot.setPlotType(PlotTypes.PLOT_HILLS,True,True)
hillsNeeded -= 1
print "adding hill"
if hillsNeeded > 0:
print "failed to add minimum hills[B], trying again[/B]"
for plot in plotList:
if plot.getPlotType() != PlotTypes.PLOT_HILLS and \
plot.getArea() == gameMap.plot(x,y).getArea() [B]and \
plot.getBonusType(TeamTypes.NO_TEAM) == BonusTypes.NO_BONUS:
plot.setFeatureType(FeatureTypes.NO_FEATURE,-1)[/B]
plot.setPlotType(PlotTypes.PLOT_HILLS,True,True)
hillsNeeded -= 1
print "adding hill, removing feature"
if hillsNeeded > 0:
print "failed to add minimum hills!!!!!!!!!!"
#This variable adjusts the amount of bonuses on the map. Values above 1.0 will add bonus
#bonuses. People often want lots of bonuses, and for those people, this variable is definately
#a bonus.
self.BonusBonus = 1.0
[B] #Disallows Stone and Marble to be used to sweeting starting positions.
self.noBonusWonderClass = True[/B]
#How many squares are added to a lake for each unit of drainage flowing
#into it.
self.LakeSizePerDrainage = 14.0
for b in range(gc.getNumBonusInfos()):
bonusEnum = shuffledBonuses[b]
bonusInfo = gc.getBonusInfo(bonusEnum)
if bonusInfo.isNormalize() == False:
continue
[B] if bonusInfo.getBonusClassType() == gc.getInfoTypeForString("BONUSCLASS_WONDER") and mc.noBonusWonderClass:
continue[/B]
if bonusInfo.getYieldChange(yields[n]) < 1:
continue
That's why it's an option. Just turn it off by default if you still don't like it.I'm still skeptical about not using the wonder resources for sweetening. I think it can be a needed boost on an otherwise bad start. Clustering wonder resources is not a problem in my mind.
That's an evil that comes with randomness. One solution would be to do it in 2 phases, like the hills adding: in the first round, only flatlands or hills with bonus are valid targets to remove bad features.Another issue that I've seen is that my bad feature remover will sometimes only remove jungle on the hills, and leave all the flats convered in jungle, resulting in a no growth until iron working situation.
That's why it's an option. Just turn it off by default if you still don't like it.
That's an evil that comes with randomness. One solution would be to do it in 2 phases, like the hills adding: in the first round, only flatlands or hills with bonus are valid targets to remove bad features.
The only other issue I know of is that minhills will always fail if there are not enough land tiles. (I already had a start like that once.) But unless you want to add a minLandTiles variable plus the function to take care of that (count land tiles, if not enough add land: only water next to land is valid, gets turned to flatland, terrain type determined by neighbouring land tile(s)), I think that one will remain.
Glad I'm not alone there, I blame Python and it's goofey syntax that they designed to be as close to the opposite of C as they possibly couldI would post the code, except I never get this sort of thing right the first time. I'm 90% certain that this code will crash the map.
#Ensure minimum number of hills
hillsNeeded = mc.MinHillsInFC - hillsFound
print "hills found = %d, hills needed = %d" % (hillsFound,hillsNeeded)
if hillsNeeded > 0:
for plot in plotList:
if hillsNeeded <= 0:
break
featureInfo = gc.getFeatureInfo(plot.getFeatureType())
requiresFlatlands = (featureInfo != None and featureInfo.isRequiresFlatlands())
bonusInfo = gc.getBonusInfo(plot.getBonusType(TeamTypes.NO_TEAM))
if plot.getPlotType() != PlotTypes.PLOT_HILLS and \
plot.getArea() == gameMap.plot(x,y).getArea() and \
bonusInfo == None and \
not requiresFlatlands:
plot.setPlotType(PlotTypes.PLOT_HILLS,True,True)
hillsNeeded -= 1
print "adding hill"
if hillsNeeded > 0:
print "failed to add minimum hills, trying again"
for plot in plotList:
if plot.getPlotType() != PlotTypes.PLOT_HILLS and \
plot.getArea() == gameMap.plot(x,y).getArea() and \
(bonusInfo == None or not bonusInfo.isRequiresFlatlands()):
plot.setPlotType(PlotTypes.PLOT_HILLS,True,True)
hillsNeeded -= 1
if requiresFlatlands:
plot.setFeatureType(FeatureTypes.NO_FEATURE,-1)
print "adding hill, removing feature"
else:
print "adding hill to bonus tile"
if hillsNeeded > 0:
print "failed to add minimum hills!!!!!!!!!!"
#ensure maximum number of bad features
badFeaturesToRemove = badFeaturesFound - mc.MaxBadFeaturesInFC
print "badFeaturesFound = %d, badFeaturesToRemove = %d" % (badFeaturesFound,badFeaturesToRemove)
if badFeaturesToRemove > 0:
#remove half from flatlands, the rest from hills
badFeaturesToRemoveFromFlatlands = badFeaturesToRemove/2 + badFeaturesToRemove%2
badFeaturesToRemove -= badFeaturesToRemoveFromFlatlands
for plot in plotList:
if badFeaturesToRemoveFromFlatlands <= 0 and badFeaturesToRemove <= 0:
break
featureInfo = gc.getFeatureInfo(plot.getFeatureType())
if featureInfo != None:
totalYield = 0
for yi in range(YieldTypes.NUM_YIELD_TYPES):
totalYield += featureInfo.getYieldChange(YieldTypes(yi))
if totalYield <= 0:#bad feature
if plot.getPlotType() == PlotTypes.PLOT_LAND and badFeaturesToRemoveFromFlatlands > 0:
print "removing bad feature from flatlands"
badFeaturesToRemoveFromFlatlands -= 1
if plot.getPlotType() == PlotTypes.PLOT_HILLS and badFeaturesToRemove > 0:
print "removing bad feature from hills"
badFeaturesToRemove -= 1
plot.setFeatureType(FeatureTypes.NO_FEATURE,-1)
#if there are not enough hills or flatlands, there will be leftovers
badFeaturesToRemove += badFeaturesToRemoveFromFlatlands
for plot in plotList:
if badFeaturesToRemove <= 0:
break
featureInfo = gc.getFeatureInfo(plot.getFeatureType())
if featureInfo != None:
totalYield = 0
for yi in range(YieldTypes.NUM_YIELD_TYPES):
totalYield += featureInfo.getYieldChange(YieldTypes(yi))
if totalYield <= 0:#bad feature
print "removing bad feature"
badFeaturesToRemove -= 1
plot.setFeatureType(FeatureTypes.NO_FEATURE,-1)
You didn't move it to after the minhills part, so your code will happily remove bad features from flatlands that could get turned into hills a few lines later.
Also I think your code can't handle having not enough land tiles to remove bad features from, it removes half from hills, as much as it can from flatlands, but if badFeaturesFound is still > 1 after that it won't try again.
Is there any way to add more islands to the game, like there were in PerfectWorld? I liked those maps better.
Yes it's an improvement, no doubt. Don't mind my perfectionalism, I just can't help it.Also, you're right that if you have a bunch of jungle hills and one jungle flat, you won't remove all the desired jungle.
I think this will work better than it did though, and those scenarios should be very rare. This thread will remind me to work on it again for next update.