View Full Version : Small bug fixes
AnotherPacifist Aug 03, 2008, 04:53 PM Before Rhye comes back from Japan, here's a couple fixes for the most annoying "bugs":
1. Wheat, sheep and cow will no longer appear on mountains (changed RFCUtils.py)
2. No more native conquerors (somehow Rhye thought to make the natives old world--changed Consts.py)
3. Ethiopia, Mali, Maya now have their old number of settlers to allow possible UHV. (changed RiseandFall.py)
Obviously, I'm no expert, so use at your discretion. (I can't upload .py files, so I rarred them).
If somebody can generate code for RFCUtils.py to randomly add either a stone or marble to the 3000BC civs that usually have it in RFC, that would be great.
Edit: I'm deleting my files in favor of onedreamer's correct fixes: see below.
Spielosoph Aug 03, 2008, 06:05 PM Thanks!
About the resource placement, how does it work exactly? Does it just remove resources from mountains, or does it place them somewhere near?
AnotherPacifist Aug 03, 2008, 06:18 PM No, apparently the code checks if you're a medieval European civ, and then checks around your spawn site and if it's a grassland or plains without a bonus, it puts a cow there (or wheat for Netherlands). All I did was to add the criterion not to put anything on mountains. There's still a conflict though: once it puts the cow there, the Dutch or Portuguese can't get wheat on that tile.
I think the other problem about occupying core areas is that Rhye seems not to have changed the constants in const.py regarding core areas (in fact they shouldn't be constants anymore since core areas should be random), and hence if you spawn in the "right" areas (e.g. I spawned south of China as Mongolia) you get your criterion fulfilled automatically.
onedreamer Aug 04, 2008, 02:51 AM thanks AP. Downloading now to try it out.
Śmarth Aug 04, 2008, 06:20 AM Edit: I should really learn to test code before I post it...
Barak Aug 04, 2008, 08:07 AM This may sound like a dumb question, but how do I add this code? Do I replace the original?
Barak Aug 04, 2008, 10:05 AM @Umarth
I replaced the python files with your files, and loaded up a game. Egypt and Babylon have no stone or marble anywhere near them. In fact Babylon starts in the middle of a desert.
Śmarth Aug 04, 2008, 10:09 AM Yeah... I appear to have broken something. I played a game with it and nobody else spawned, I wonder how that happened.
onedreamer Aug 04, 2008, 01:01 PM Umarth what are your changes about ? You didn't post a word or a readme >_<
Are they supposed to randomly add stone/marble to early civs as asked by AP ?
Barak Aug 04, 2008, 03:48 PM Does the new code work?
Śmarth Aug 04, 2008, 03:49 PM Umarth what are your changes about ? You didn't post a word or a readme >_<
Are they supposed to randomly add stone/marble to early civs as asked by AP ?
Yes, but they don't work. Sorry, I forgot to take out the file when I edited my post.
Corm Aug 05, 2008, 10:01 AM AP that fix for the Maya worked and I completed the first 2 UHV's thanks to the extra settler (by 1 turn for the Temple!). Still took me a ton of restarts till I managed it but now im well on my way to surviving conquistadores thanks to my Longbows. Thanks for your efforts dude.
onedreamer Aug 05, 2008, 10:06 AM Umarth, are you sure that the function to improve starting location is called for the 3000 BC civs ? I suspect it isn't.
Śmarth Aug 05, 2008, 01:08 PM Possibly not. That wouldn't explain why it stopped everyone else from spawning though.
AnotherPacifist Aug 05, 2008, 01:19 PM Good to hear Corm. I debated whether to reverse the Khmer handicap, but I think one more city is just going to make average city size smaller. What is needed is a massive overhaul of resource/civ placement a la the original world map.
onedreamer Aug 05, 2008, 02:05 PM Possibly not. That wouldn't explain why it stopped everyone else from spawning though.
well, since the function is called when new civs spawns, it seems connected. Looking at Rhye's code, it seems there could be a problem of brackets (from AP's code onwards), but I don't know Python so I'm just speculating. If the function doesn't return a correct value that could stop a new civ from spawning.
AnotherPacifist Aug 05, 2008, 02:27 PM I think I misplaced a parenthesis in the England/Japan part (I corrected it in the 450 AD and 900 AD euro civs part but didn't do it for the sheep):
"and" apparently trumps "or" in logic.
if (iCiv == con.iEngland or iCiv == con.iJapan):
if (( CyMap().plot( startX, startY ).area().getID() != self.getEurasiaInfo(4) and CyMap().getSeaLevel() <= 1) or (CyMap().plot( startX, startY ).area().getNumTiles() <= 120 and CyMap().getSeaLevel() == 2)): #on island
for x in range(startX-2, startX+3):
for y in range(startY-2, startY+3):
pCurrent = CyMap().plot( x%CyMap().getGridWidth(), y%CyMap().getGridHeight() )
if (pCurrent.getTerrainType() != con.iTerrainPeak) and (pCurrent.getTerrainType() == con.iGrass or pCurrent.getTerrainType() == con.iPlains):
if (pCurrent.getBonusType(-1) == -1 and pCurrent.getFeatureType() == -1):
pCurrent.setBonusType(con.iSheep)
break
break
The 450 AD code could easily be modified to provide the 3000 BC civs with stone or marble if somebody knows how to choose randomly a tile to place it in. (my python coding experience so far has been to do very simple things that one can deduce from the code itself.)
onedreamer Aug 06, 2008, 02:53 AM AP, I had already "fixed" that problem (it's the one I was speaking about, and since Umarth probably copy-pasted from the last line, he carried it over to his new lines) and tested along with Umarth's code, but it seems it wasn't really a problem, or THE problem, since the "Rise" of new civs still doesn't work.
From my understanding -of a complete ignorant in Python-, the code you posted is already one to add a resource randomly in the fat cross of a city... the problem is that this is only the function that does it, but then the one that calls it should probably be adjusted to do it also for the 3000 BC civs. That one is in the Rhyes and Fall file, but I don't understand anything of it ^^
GreySaber Aug 08, 2008, 07:33 AM All of the plot improvements are part of the "improveStartingLocation" function which is already run. I did manage to add Stone to the starting civs, and for the sake of balance, marble to the classical civs (Greece, Rome, Persia, Carthage) since otherwise they're really the only ones to not get anything, and it helps with at least Greece. The problem I ran into is that the current code adds the stone to ALL Desert and Plains tiles within the city radius that doesn't already have a bonus type on it. As with most of us, I only do what I can deduce from the current code, and trying to make it loop once and randomly choose a single plot eludes me. But adding things in is possible.
I currently have it set so that only Babylon and Egypt get the stone, as China tends (on my attempts, anyway) to be all on Grasslands so won't get it anyway, and India doesn't really need it as badly. And only Greece and Rome get the Marble. Which doesn't overpower Rome so much as they tend to spawn similar to China with mostly grasslands anyway
I make no promise that this works, but for anyone who wants it....
if (iCiv in con.lCivGroups[2] and con.tBirth[iCiv] < con.i2250BC): #Setting tBirth to = i3000BC hangs game
for x in range(startX-1, startX+2):
for y in range(startY-1, startY+2):
pCurrent = CyMap().plot( x%CyMap().getGridWidth(), y%CyMap().getGridHeight() )
if ((pCurrent.getTerrainType() != con.iTerrainPeak) and (pCurrent.getTerrainType() == con.iDesert or pCurrent.getTerrainType() == con.iPlains)):
if (pCurrent.getBonusType(-1) == -1):
pCurrent.setBonusType(con.iStone)
break
break
if (iCiv in con.lCivGroups[0] and con.tBirth[iCiv] < con.i650BC): #Setting tBirth to = i3000BC hangs game
for x in range(startX-1, startX+2):
for y in range(startY-1, startY+2):
pCurrent = CyMap().plot( x%CyMap().getGridWidth(), y%CyMap().getGridHeight() )
if ((pCurrent.getTerrainType() != con.iTerrainPeak) and (pCurrent.getTerrainType() == con.iDesert or pCurrent.getTerrainType() == con.iPlains)):
if (pCurrent.getBonusType(-1) == -1):
pCurrent.setBonusType(con.iMarble)
break
break
I have this inserted after the forest/tundra edits, prior to the cow spawning. (RFCUtils.py inserted at line 1753)
It works for me, but I have some other minor tweaks in Python, so it might not work perfectly. If anyone knows how to randomly choose a plot from the range extracted by the x and y start range, feel free to share. =)
AnotherPacifist Aug 08, 2008, 05:30 PM How about changing gold/gems or elephant to stone for Egypt and Babylon, and gold/gems/elephant to marble for Greece and Rome, just around the spawn sites. In that way you just get one marble, and not all marble on desert tiles.
onedreamer Aug 09, 2008, 02:15 AM well not really, since gold and elephants are very likely to come in groups of 2-3.
The difference in GreySaber's code is that instead of using Civ Names he used spawn dates. So the Rise and Fall functions are called by dates I guess. The problem of adding many resources is the use of a "for" cycle. Can it be done in another way ? "if" ?
onedreamer Aug 09, 2008, 02:58 AM ok this is funny: if I use GreySaber's code in RFCUtils the play now button is greyed out and if I start a custom game I'll be defeated at turn 0... what gives ?
AnotherPacifist Aug 09, 2008, 06:11 AM well not really, since gold and elephants are very likely to come in groups of 2-3.
Yeah, that's why I said close to the spawn site, e.g. immediate surrounding 8 blocks of tile, and there could be a condition that said that once 1 resource is turned, ignore the rest. (see the British/Japan code for sheep)
onedreamer Aug 09, 2008, 06:34 AM you can use getBonusType, but I don't see a condition in the British/Japan part that will change only one ?
Also, did anyone seriously test these fixes ?
These are my findings:
- AP's code doesn't work: wheat and cows are still on mountains.
- GreySaber's code greys out the play now button and you loose at turn 1 if you try a custom game.
- GreySaber's logic isn't as he intended I believe, since 3000 BC civs are born both before 2250BC and 650BC, they should get both marble and stone, but they won't because the first of the 2 considered resources will fill up all available plots for the second.
onedreamer Aug 09, 2008, 09:48 AM I fixed the resources on peak stuff. I had to use getPlot. Attached the files.
edit: I forgot to update the condition for England & Japan, you can do easily yourself. Btw this condition almost never kicks in: I've seen only once Japan on a island, most of the times on a peninsula, or on the mainland just at the far east of Asia. Same thing about England, except I haven't seen it on an island even once.
Corm Aug 10, 2008, 05:52 AM I fixed the resources on peak stuff. I had to use getPlot. Attached the files.
edit: I forgot to update the condition for England & Japan, you can do easily yourself. Btw this condition almost never kicks in: I've seen only once Japan on a island, most of the times on a peninsula, or on the mainland just at the far east of Asia. Same thing about England, except I haven't seen it on an island even once.
Nice one. Fix seems to work. Thanks dreamer dude.
Just as an aside I have had a lot of Japan and England starts on a separate Island. Also had the Netherlands and Portugal start on a separate island too (what was essentially the British Isles).
GreySaber Aug 10, 2008, 07:58 PM - GreySaber's code greys out the play now button and you loose at turn 1 if you try a custom game.
- GreySaber's logic isn't as he intended I believe, since 3000 BC civs are born both before 2250BC and 650BC, they should get both marble and stone, but they won't because the first of the 2 considered resources will fill up all available plots for the second.
For the first, I was somewhat concerned about this, as I had it happen a few times as I was testing, and as I said, I have made other mods, so I wasn't sure it would work for everyone. Sorry. =(
Second, if you note the "con.lCivGroups" the first one is group 2, the second group 0, so they actually pull different groups of Civs. Group 0 is iGreece, iRome, iVikings, iSpain, iFrance, iEngland, iGermany, iRussia, iNetherlands, iPortugal while Group 2 is iEgypt, iBabylonia, iPersia, iArabia, iTurkey. Group 0 is mainly the Euros, which is used for the cows. Hence why Khmer or Maya don't get them from the original code (different group).
As for setting the birth to = 3000BC, it caused the game to hang up. So I went with less then, based on the first date set in the Consts.py that wasn't 3000BC.
onedreamer Aug 11, 2008, 03:37 AM but the problem is that the function isn't called for the first 4 civs. It's called from iBabylonia+1, which means Greece.
onedreamer Aug 21, 2008, 03:21 AM I have attached:
- Peak fix (peakfix.zip), including cPickle (thanks Musicfreak). You can just overwrite Musicfreak's patch with these files.
- Updated Persian and Roman city lists (City.zip), includes cPickle.
- Some XML modifications that will allow:
building of pastures in jungle (no prereqs, doesn't remove the jungle -- for pigs).
building of plantation for rice (calendar, removes the jungle, +1 food).
oasis reverted back to 3 food, 2 commerce.
I made these changes to take care of otherwise awful starts in jungles and deserts, the random map script terrain shouldn't be as harsh as the fixed map.
Lone Wolf Aug 31, 2008, 05:45 AM I still get the Native Conquerors. Apparently, the lCivBioOldWorld and lCivBioNewWorld in Consts.py are not used for determining who gets the Conquerors. (There is iBarbarian in lCivBioOldWorld both in RFC Regular and Random, but nobody gets Barbarian Conquerors).
So far, you can just replace all the references to Natives in Barbs.py to Barbarians. BTW, what is stuff like
# city coordinates, spawn 1st turn and retries
lUr = [77, 38, 0, 0] #3000BC
lJerusalem = [73, 38, 0, 0] #3000BC
lBabylon = [76, 40, 0, 0] #3000BC
lSusa = [79, 40, 0, 0] #3000BC
lTyre = [73, 40, 0, 0] #2700BC #turn10
lKnossos = [69, 39, 13, 0] #2600BC
lHattusas = [73, 43, 34, 0] #2000BC
...
is doing in RFC RAND Barbs.py?
|
|