That actually sounds about perfect. I was always under the impression that city distance played a multiplying role to other effects, I'm surprised that's not in there already. It seems to be, if I simply increase the city distance penalty, it acts like it multiplies the penalties of other effects already. One thing though, when you rewrite it, please make it so we can see the values of all the causes (as of now some are stealth). I've tried to go through and write in parts so that stealth clauses show, but they usually don't work, not sure why. I also recomend you just remove the need to turn on debugging to see the values, this is a preference of course, but in my oppinion a lack of transparency is rarely a good thing.
Also I haven't changed my alterations to the city distance code since WolfRev v 1.1.1, so no improvements. I'm still a little confused as to why it sometimes takes into account buildings (I have it so the penalty is further reduced by harbors, etc.), and sometimes does not. Since I'm not a coder though, and this is the only true coding I've ever done, I Wouldn't be surprised if I messed something up somewhere. But overall it works really well, I reccomend you give it a try.
This is the code if you're interested (obviously there is a little more, have to define the techs and such, but this is the core of it)
Code:
# Distance to capital City Distance modified by communication techs and structures
cityDistModifier = ( plotDistance( pCity.getX(), pCity.getY(), capital.getX(), capital.getY()) )*0.4
if( not pCity.isConnectedTo(capital) ) :
cityDistModifier = (cityDistModifier + 1)*4
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLAirport)) > 0 ) :
if( gc.getTeam(pPlayer.getTeam()).isHasTech(self.iJetTech) ) :
cityDistModifier = (cityDistModifier - 6)*0.4
else:
cityDistModifier = (cityDistModifier - 5)*0.6
elif( gc.getTeam(pPlayer.getTeam()).isHasTech(self.iRadioTech) ) :
cityDistModifier = (cityDistModifier - 4)*0.7
elif( gc.getTeam(pPlayer.getTeam()).isHasTech(self.iRailRoadTech) ) :
if( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLHarbor)) > 0 ) :
cityDistModifier = (cityDistModifier - 4)*0.7
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLCothon)) > 0 ) :
cityDistModifier = (cityDistModifier - 4)*0.7
else:
cityDistModifier = (cityDistModifier - 3)*1.2
elif( gc.getTeam(pPlayer.getTeam()).isHasTech(self.iAstronomyTech) ) :
if( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLHarbor)) > 0 ) :
cityDistModifier = (cityDistModifier - 3)*1.2
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLCothon)) > 0 ) :
cityDistModifier = (cityDistModifier - 3)*1.2
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLDLighthouse)) > 0 ) :
cityDistModifier = (cityDistModifier - 2)*1.7
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLTradePost)) > 0 ) :
cityDistModifier = (cityDistModifier - 2)*1.7
else:
cityDistModifier = (cityDistModifier - 2)*2.2
elif( gc.getTeam(pPlayer.getTeam()).isHasTech(self.iEngineeringTech) and gc.getTeam(pPlayer.getTeam()).isHasTech(self.iHorsebackTech) ) :
if( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLHarbor)) > 0 ) :
cityDistModifier = (cityDistModifier - 2)*2.2
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLCothon)) > 0 ) :
cityDistModifier = (cityDistModifier - 2)*2.2
else:
cityDistModifier = (cityDistModifier - 1)*2.5
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLHarbor)) > 0 ) :
cityDistModifier = (cityDistModifier - 1)*2.5
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLCothon)) > 0 ) :
cityDistModifier = (cityDistModifier - 1)*2.5
elif( gc.getTeam(pPlayer.getTeam()).isHasTech(self.iWheelTech) ) :
if( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLDLighthouse)) > 0 ) :
cityDistModifier = (cityDistModifier - 1)*3
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLTradePost)) > 0 ) :
cityDistModifier = (cityDistModifier - 1)*3
else:
cityDistModifier = cityDistModifier*3
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLDLighthouse)) > 0 ) :
cityDistModifier = cityDistModifier*3
elif( pCity.getNumRealBuilding(gc.getInfoTypeForString(RevDefs.sXMLTradePost)) > 0 ) :
cityDistModifier = cityDistModifier*3
else:
cityDistModifier = cityDistModifier*3.6
#cityDistModifier = adjusted for map size and normalized
cityDistModifier = cityDistModifier - 1
cityDistModifier = cityDistModifier/((( CyMap().getGridWidth()**2 + CyMap().getGridHeight()**2 )**0.5)*0.013)
distMod = 1.0 + RevUtils.getCivicsDistanceMod( iPlayer )
distMod *= self.distToCapModifier
if( pCity.isGovernmentCenter() ) :
distMod *= 0.5
elif( pCity.getMaintenanceModifier() > 0 ) :
# Decrease effect if city has courthouse
distMod *= 0.75
locationRevIdx = 0
This part is particularly important, as it scales the distance penalty to the map size
Code:
cityDistModifier = cityDistModifier/((( CyMap().getGridWidth()**2 + CyMap().getGridHeight()**2 )**0.5)*0.013)
If you do use something like this, you'll probably want to simplify it. I probably went a little overboard with all the clauses, but I was just pretty stoked I was actually writing code at the time.