Natural wonders development thread

Sorry man, i donwloaded your thing and forgot I never commented back, not ingoring ya!:D

question though, which Tepui is it? Because when i wiki tepui, it is not a specific one, but all the pictures on wikipedia, none have grass so if you can tell me which one it is that would be great:D
 
I'm back!!!!

due to your ability I didn't miss much :lol:
 
I didn't base it off a specific Tepui, I just made it look sort of generic. The stuff on top was supposed to be Jungle, but I couldn't put the trees on because Nifscope said they were different nif versions. It would also be nice to have Jungle around the base of the Tepui.
 
ok python programmers at your stations!

do we all think this code works without any sort of hitch (I have tested with the 3 wonders supplied to me and it works fine)/am I understanding the CyPlot methods correctly...

Code:
		# Natural Wonders - Start
                # This is the code that spawns each natural wonder into the map to add new wonder see below!
                dNaturalWonders = {\
                        #These are parameters for new wonders, you pick a type ie: "TERRAIN_DESERT" and then things about it
                        # in order of appearance: is it a hill?, (if coast) is it next to a land tile? is it a river? is it a mountain?
                        # (if water) is it a lake?, is the tile adjectent to lake or oasis?, is it next to the sea (possibly lake?)?, is it a water tile?
                        # True for yes
                        # False for no
                        # None for doesn't matter (same for terrain, however in this case bWater will handle plot type (bWater CANNOT be None))
                        #Wonder XML name:[TerrainType, bHills, bAdjecentLand, bRiver, bPeak, bLake, bFreshWater, bCostalLand, bWater (CANNOT BE NONE!)]
                        "FEATURE_DEVILS_TABLE":["TERRAIN_PLAINS", True, None, None, None, None, None, None, False],\
                        "FEATURE_ULURU":["TERRAIN_DESERT", False, None, None, None, None, None, None, False],\
                        "FEATURE_SUGARLOAF":["TERRAIN_COAST", None, True, None, None, None, None, None, True]\
                        }
                Map = gc.getMap()
                Game = CyGame()
                for wonder in dNaturalWonders.iterkeys():
                        WonderType = gc.getInfoTypeForString(wonder)
                        TerrainType = gc.getInfoTypeForString(dNaturalWonders[wonder][0])
                        bHills = dNaturalWonders[wonder][1]
                        bAdjecentLand = dNaturalWonders[wonder][2]
                        bRiver = dNaturalWonders[wonder][3]
                        bPeak = dNaturalWonders[wonder][4]
                        bLake = dNaturalWonders[wonder][5]
                        bFreshWater = dNaturalWonders[wonder][6]
                        bCoastalLand = dNaturalWonders[wonder][7]
                        bWater = dNaturalWonders[wonder][8]
                        if bWater:
                                bHills = None
                                bRiver = None
                                bPeak = None
                                bFreshWater = None
                                bCostalLand = None
                        else:
                                bAdjecentLand = None
                                bLake = None
                        #start checking plots
                        lPlots = list()
                        for x in xrange(Map.getGridWidth()):
                                for y in xrange(Map.getGridHeight()):
                                        pPlot = Map.plot(x, y)
                                        bPlotPerfect = True
                                        if not pPlot.isWater() and not pPlot.isAdjacentToLand(): continue #this must be one tile island...
                                        for team in xrange(Game.countCivTeamsEverAlive()):
                                                if pPlot.isRevealed(team, False) or not pPlot.getBonusType(team) == -1: bPlotPerfect = False
                                        if not bPlotPerfect: continue
                                        if not TerrainType == None:
                                                if not pPlot.getTerrainType() == TerrainType: continue
                                        else:
                                                if not pPlot.isWater() == bWater: continue
                                        if not bHills == None:
                                                if not pPlot.isHills() == bHills: continue
                                        if not bAdjecentLand == None:
                                                if not pPlot.isAdjacentToLand() == bAdjecentLand: continue
                                        if not bRiver == None:
                                                if not pPlot.isRiver() == bRiver: continue
                                        if not bPeak == None:
                                                if not pPlot.isPeak() == bPeak: continue
                                        if not bLake == None:
                                                if not pPlot.isLake() == bLake: continue
                                        if not bFreshWater == None:
                                                if not pPlot.isFreshWater() == bFreshWater: continue
                                        if not bCoastalLand == None:
                                                if not pPlot.isCoastalLand() == bCoastalLand: continue
                                        #if bPlotPerfect:
                                        lPlots.append(pPlot)
                        pPlot = lPlots[Game.getSorenRandNum(len(lPlots), "Random Plot")]
                        pPlot.setBonusType(-1) #just in case previous code fails for some reason!
                        pPlot.setFeatureType(WonderType, 0)          
		# Natural Wonders - End

If this is in the clear and easy to understand then I am finished!
 
Looks okay, but that doesn't mean that much from me, since my own code as at average at least one bug per line ^^.

Performance wise you should think about collecting first all not visible plots and then distributing the wonders over them, because currently you iterate over the whole map with every wonder, which is somehow inefficient.
 
"since my own code as at average at least one bug per line" :lol:

hmm, you do have a point there, collecting all not one tile islands and invisible plots should help bring lag down by a tiny bit (it was not even noticable when on standard but when you add more and more wonders :p I also think I need to check that a tile doesn't already have a wonder on it :p what about the dictionary/dynamic wonder defining setup? you think it is ok? (If I had done some more stuff in the sdk it would have been as simple has saying pPlot.isSuitable just like normal features (except these wonders are recognised by the game as being unplaceable :p)

I might do some code reversal tommorrow in that the plots are iterated first then a wonder is checked on each plot as we go along, that will need a more elaborate setup than 'continue' (I think) but unless over 3000 wonders are added it is more efficient :rolleyes:

as for whether my "options" are working as expected I might change a few of those Nones to Trues to see what effect it has on generation
 
Hmm, to improve efficiency:
1)
Code:
if pPlot.isRevealed(team, False) or not pPlot.getBonusType(team) == -1: bPlotPerfect = False
	if not bPlotPerfect: continue
Why add bPlotPerfect and another if statement?
Instead of checking if not revealed, or no bonus,
check if revealed and no bonus, true: continue

2)
Code:
for i in range(CyMap().numPlots()):
	pPlot = CyMap().plotByIndex(i)
This one may be better if you intend to loop through all plots.
Does not need 2 loops and does not need map height and width details

Lastly, you tried in maps where the full map is revealed right at the start? Such as future era in default BTS. If full map is revealed, the reveal check may fail and no wonders spawn
 
that pPlotPerfect is required there as a continue will just move onto the next player instead of the next plot, I had originally done that and then was confused when it spawned on a bonus in revealed territory.

And yes I will swap to the indexing method instead. tbh I hadn't thought about the all revealed thing, as wonders are discovered on plot reveal then nothing would work therefore it is not nessicary to bother. A vice of starting in the future era :p
 
Hmm ok, I forgot the team loop, continue will move to next team.
Then once bPlotPerfect has been set to false, add a break so it will not continue checking for other teams.

For all reveal maps, although the players won't enjoy the discover benefits, at least they can enjoy the "having them in city radius" bonus.
Also, last I heard, dacubz145 seems to intend to reveal map right at start for his mod... :D
 
@J_mie

When you are done with the python, post it back up here and I will add movies as well as I want to add improved terrain art since my wonders I added, their skin look to realistic compared to normal civ 4, it just looks weird so I need to make it more balanced
 
ok, I will add the break/-1, reverse code and see about a full map reveal solution (scanning for era possibly).
 
ok the team = -1 thing doesn't work :(

but break is working fine as are my other changes for the moment. I am checking for the Era as for the revealed plots, I might make another check where I check if plot 0, 0 is visible to all civs (in that case all plots are revealed)
 
Just check start Era will do, don't need another loop through all teams just to see if plot is revealed to all teams.
Be confident in your code :D Too many extra checks add inefficiency
 
hmmm the code reversal came up with some complications so I abandoned it for the moment (I will have to rewrite the whole checking concept, as the way I can see it working is hardcoded more....)

and on the plot revealed to all all I have is this:

Code:
                #check if all plots are revealed by default
                x = 0
                bAllRevealed = False
                for team in xrange(iNumCivs):
                        if Map.plot(0, 0).isRevealed(team, False):
                                x += 1
                if x == iNumCivs:
                        bAllRevealed = True

basically nothing, plus it rules out if all plots are revealed and not future era :p ie a senario (where the natural wonders would be placed differently in each playthrough of the senario :p)

edit: btw I don't check for era now :p
 
"since my own code as at average at least one bug per line"

yes it does :lol:

joking!
 
right attached is the python, DLL, C++ sources + readme and my ammended XML with schema changes (make sure you look at the new tags carefully!) Instructions in the CvEventManager tell you how to add a new wonder to be checked and explain the various options.
 
Back
Top Bottom