Working Maps and Map Issues

I have sorted out what the problem is that caused the crashes in the two games I mentioned in post #714. On SMALL and TINY maps there is not always sufficient room for the generation of North and South Europe plots, even on STANDARD sized maps there is not always room for North Europe and South Europe plots to be added.

There seems to be a constraint that limits the width of the East and West Europe plots to 6 tiles width, then if there is sufficient room, North and South Europe plots are painted to the map, but in all my testing, the volume of North and South Europe plots is never very high.

The default world sizes are defined in CIV4WorldInfo.xml in the GameInfo folder. A tiny map is set by default to 22x36. On a blank map this would ostensibly generate a Europe plot patten like this:
Spoiler :
However, this is not the case. The East and West Europe plots will swell towards the center of the map. The East Europe plots are given the heaviest weight, so if there is not land obstruction, they may stretch and fill all the way to the west side of the map. This effect can be seen on maps generated by the Firaxis Caribbean map script. So a map with no landmasses would very likely be filled with nothing but East Europe plots, which clearly demonstrates the bias of the original programmer to create maps that replicate European colonization of the Western Hemisphere.

Anyway, the random generation of the land mass + the 4 spaces from land default for all Europe plots can result in maps that do not have sufficient room for North and South Europe plots on any map generated by any map script, so this is not a problem limited to FaireWeather, but includes even Firaxis map scripts like A_New_World. I tried several of the other map scripts at Tiny and Small sizes and the same holds true with them all at those sizes.

Altering the proportions of the default map sizes actually seems to exacerbate the problem. When I added:

Code:
def getGridSize(argsList):
	"Override Grid Size function to make the maps square."
	grid_sizes = {
		WorldSizeTypes.WORLDSIZE_TINY:      (8*4,8*4),
		WorldSizeTypes.WORLDSIZE_SMALL:     (10*4,10*4),
		WorldSizeTypes.WORLDSIZE_STANDARD:  (13*4,13*4),
		WorldSizeTypes.WORLDSIZE_LARGE:     (16*4,16*4),
		WorldSizeTypes.WORLDSIZE_HUGE:      (20*4,20*4)
	}

	if (argsList[0] == -1): # (-1,) is passed to function on loads
		return []
	[eWorldSize] = argsList
	return grid_sizes[eWorldSize]
to A_New_World.py, the maps generated were square, but the North and South ends of the land mass swelled disproportionately to fill an even larger area at the edges of the map, rather than remaining narrow. (Code borrowed from Planets.py, thank you Orlanth)

My working supposition is that the issue is the fractal world generator in the Firaxis Python files being geared to create land masses vaguely shaped like the the isthmus between North America and South America with portions of those continents at either end. Basically making two triangles like arrowheads touching at the tip with a heavy randomization of the peripheral edges.

My working conclusion is that every time a map is generated with a map script it is largely a "luck of the draw" whether that map will have sufficient room for North and South Europe plots. :(

Thanks for all your research on this. Well, I do believe that I can modify the code to place our Europe or trade route tiles where ever we need regardless of ocean. All I need to know is the map size and say on Y plots 0,1,2 that are land I can assign a Europe South or a Southern Land Trade Route (I believe the count starts from the bottom) then get the Map height and assign North Europes that way.

Hey, what would be cool though is to have a truly random map. As of now we can have an east and west sea and a north and south land but what about having it random where it could be a west land, east ocean, south ocean, north land etc. Or a combination of land coming out of the North West corner. In your working with the map scripts do you see any potential for this?
 
Good news I worked it out so that I can assign Land Routes to the North and South edges.


Also, Good news for the FaireWeather map. I discovered what was erasing the North and South trade routes. In C++ there is a function that is called that runs a python function, it is the "afterGeneration();"

Below is the Faireweather Map afterGeneratioin code. I simply prevented the python for using this function and the Map assigned Trade Routes (Europe tiles) as I wanted them too. I am not sure exactly what the below code does for the FaireWeather script as I haven't had time to check it all out.
Spoiler :

Code:
def afterGeneration():
    gc = CyGlobalContext()
    mmap = gc.getMap()
    em.initialize()
    
    europeEast = gc.getInfoTypeForString("EUROPE_EAST")
    europeWest = gc.getInfoTypeForString("EUROPE_WEST")
    
    for y in range(mc.height):
        for x in range(mc.width):
            i = GetIndex(x,y)
            plot = mmap.plot(x,y)
            plot.setEurope(-1)
            if plot.isWater() == False:
                continue
            if x > mc.width/3 and x < 2 * mc.width/3:#dont penetrate past 1/3 of map
                continue
            if y < 4 or y > mc.height - 5:#make room for ice
                continue
            landFound = False
            for yy in range(y - mc.distanceToEurope,y + mc.distanceToEurope + 1,1):
                for xx in range(x - mc.distanceToEurope,x + mc.distanceToEurope + 1,1):
                    ii = GetIndex(xx,yy)
                    if ii == -1:
                        continue
                    newPlot = mmap.plot(xx,yy)
                    if newPlot.isWater() == False:
                        landFound = True
            if landFound == False:
                em.europeMap[i] = 1
                
    europeAreas = Areamap(mc.width,mc.height,False,False)
    europeAreas.defineAreas(europeMatch)
##    europeAreas.PrintAreaMap()
##    print "east europe = %d" % (europeEast)
##    print "west europe = %d" % (europeWest)
    #find europe areas that touch the map east/west edges
    x = 0
    xx = mc.width - 1
    europeAreaIdList = list()
    for y in range(mc.height):
        i = GetIndex(x,y)
        ii = GetIndex(xx,y)
        if em.europeMap[i] == 1:
            areaID = europeAreas.areaMap[i]
            AppendUnique(europeAreaIdList,areaID)
        if em.europeMap[ii] == 1:
            areaID = europeAreas.areaMap[ii]
            AppendUnique(europeAreaIdList,areaID)

    for y in range(mc.height):
        for x in range(mc.width):
            i = GetIndex(x,y)
            plot = mmap.plot(x,y)
            areaID = europeAreas.areaMap[i]
            if IsInList(europeAreaIdList,areaID):
                if x < mc.width/2:
                    plot.setEurope(europeWest)
                else:
                    plot.setEurope(europeEast)

Yes I'm willing to work on that scenario. But I think I'll wait till the AI can use the routes properly.
Not sure how the silk route feature fits in to the Europe map? Maybe it could be available at the Caspian sea or somewhere nearby it.

Ok, we can also use what I discovered to create trade routes within the Europe Map you are wanting to make. All you have to do is decide where on the map we want to access our trade routes and then in the afterGeneratioin () python code we add in the Europe access. You posted a link to a map a while back.. is that the map you are wanting to use?

Edit: Actually, all we have to do is use World Builder to set our Trade Routes in the Europe map and then fix the AI to use those routes.
 
Good news I worked it out so that I can assign Land Routes to the North and South edges.

Also, Good news for the FaireWeather map. I discovered what was erasing the North and South trade routes. In C++ there is a function that is called that runs a python function, it is the "afterGeneration();"

Below is the Faireweather Map afterGeneration code. I simply prevented the python for using this function and the Map assigned Trade Routes (Europe tiles) as I wanted them too. I am not sure exactly what the below code does for the FaireWeather script as I haven't had time to check it all out.
I think that portion of the code, or at least the X,Y portions, simply enforces the self.distanceToEurope option so that the East and West Europe plots don't swell to fill the map as they normally would.

The function:
Code:
            if y < 4 or y > mc.height - 5:#make room for ice
                continue
is the part that "erases" the East and West Europe plots from the top and bottom of the map allowing the formation of a band of water Ice Feature across the top and bottom of the map for "cosmetic" purposes. I have the Ice Generation portion remarked out on my system, I have no use for purely cosmetic features :mischief:

In the most recent update of M:C - when they do appear on the map, I noted that the North and South Europe plots take a different PlayerColor than East and West Europe. So I can easily tell if they are being generated or not. That was very helpful in determining what was to source of my crash problem. So thank you for doing it that way, Kailric :D
 
I think that portion of the code, or at least the X,Y portions, simply enforces the self.distanceToEurope option so that the East and West Europe plots don't swell to fill the map as they normally would.

The function:
Code:
            if y < 4 or y > mc.height - 5:#make room for ice
                continue
is the part that "erases" the East and West Europe plots from the top and bottom of the map allowing the formation of a band of water Ice Feature across the top and bottom of the map for "cosmetic" purposes. I have the Ice Generation portion remarked out on my system, I have no use for purely cosmetic features :mischief:

In the most recent update of M:C - when they do appear on the map, I noted that the North and South Europe plots take a different PlayerColor than East and West Europe. So I can easily tell if they are being generated or not. That was very helpful in determining what was to source of my crash problem. So thank you for doing it that way, Kailric :D

Well, the problem with that python code is that it erases all the Europe plots and then adds back only East and West so if It added North and South as well it would be fine.

It first sets all Europes to plot.setEurope(-1) then it sets them as either plot.setEurope(europeWest) or plot.setEurope(europeEast).

Yes, we can add different colors for the different Europe tiles. I can probably add in xml code to assign each a color.

I have THE_NEW_WORLD map working perfect (it seems) with no polar caps and land units can now travel the Silk Road. Using that map script some times you may start on a large island with no access to the Silk Road by land. In that case you have to sail to the accessible land, found a colony there and use it as a port, much like they had to do in real life.

I'll work on getting the AI to use the land routes next.
 
In theory, changing the code to:
Code:
def afterGeneration():
    gc = CyGlobalContext()
    mmap = gc.getMap()
    em.initialize()
    
    europeEast = gc.getInfoTypeForString("EUROPE_EAST")
    europeWest = gc.getInfoTypeForString("EUROPE_WEST")
    europeNorth = gc.getInfoTypeForString("EUROPE_NORTH")
    europeSouth = gc.getInfoTypeForString("EUROPE_SOUTH")
    
    for y in range(mc.height):
        for x in range(mc.width):
            i = GetIndex(x,y)
            plot = mmap.plot(x,y)
            plot.setEurope(-1)
            if plot.isWater() == False:
                continue
            if x > mc.width/3 and x < 2 * mc.width/3:#dont penetrate past 1/3 of map
                continue
##            if y < 4 or y > mc.height - 5:#make room for ice
##                continue
            landFound = False
            for yy in range(y - mc.distanceToEurope,y + mc.distanceToEurope + 1,1):
                for xx in range(x - mc.distanceToEurope,x + mc.distanceToEurope + 1,1):
                    ii = GetIndex(xx,yy)
                    if ii == -1:
                        continue
                    newPlot = mmap.plot(xx,yy)
                    if newPlot.isWater() == False:
                        landFound = True
            if landFound == False:
                em.europeMap[i] = 1
                
    europeAreas = Areamap(mc.width,mc.height,False,False)
    europeAreas.defineAreas(europeMatch)
##    europeAreas.PrintAreaMap()
##    print "east europe = %d" % (europeEast)
##    print "west europe = %d" % (europeWest)
    #find europe areas that touch the map east/west edges
    x = 0
    xx = mc.width - 1
    europeAreaIdList = list()
    for y in range(mc.height):
        i = GetIndex(x,y)
        ii = GetIndex(xx,y)
        if em.europeMap[i] == 1:
            areaID = europeAreas.areaMap[i]
            AppendUnique(europeAreaIdList,areaID)
        if em.europeMap[ii] == 1:
            areaID = europeAreas.areaMap[ii]
            AppendUnique(europeAreaIdList,areaID)

    for y in range(mc.height):
        for x in range(mc.width):
            i = GetIndex(x,y)
            plot = mmap.plot(x,y)
            areaID = europeAreas.areaMap[i]
            if IsInList(europeAreaIdList,areaID):
                if y < mc.height/2:
                    plot.setEurope(europeNorth)
                if y > mc.height/2:
                    plot.setEurope(europeSouth)
                if x < mc.width/2:
                    plot.setEurope(europeWest)
                else: x > mc.width/2:
                    plot.setEurope(europeEast)
ugly and not the best code, but it should resolve the issue... only it doesn't. So there is more than this that is causing the issue. It may deal with the fact that it is generating a cylindrical map with a virtual Europe ("em.europeMap" in the code) that is redacted from the map before printing, rather than a toroidal map (doughnut map).

As much as I like the look of FaireWeather maps, I'm starting to think it isn't worth the time-investment to continue debugging FaireWeather when so many of its functions were developed with only the vanilla DLL in mind. I was looking at the threads of the latest iteration of the Civ 4 version of the script... a month of real life man-hours spent to refine and debug it for Civ 4 BTS.... :eek:

With my level of understanding, it could take 6 months >_<
 
As much as I like the look of FaireWeather maps, I'm starting to think it isn't worth the time-investment to continue debugging FaireWeather when so many of its functions were developed with only the vanilla DLL in mind. I was looking at the threads of the latest iteration of the Civ 4 version of the script... a month of real life man-hours spent to refine and debug it for Civ 4 BTS.... :eek:

With my level of understanding, it could take 6 months >_<

Well, all you have to do to get it to work is

Code:
def afterGeneration():

   return
    #Haha, you can't change Europes any more

    gc = CyGlobalContext()
    mmap = gc.getMap()
    em.initialize()

With the "return" there it will skip this part of the code and then C++ will put down the Europe tiles and all will work as it should. In my testing of this there was at least a north or south land touching the border of the map but not both. So, the map would work like that just that only one access to Silk Road instead of two. I was planing on looking into this some more when I got the chance and making it so that there was always at least an island of land touching the north and south borders of the map.
 
Here is where I say DOH!!!! :cringe:

*head-desk*

I thought of trying something like that, but I didn't think it would work >_<

Edit... well, on my system, this is what I got from making that change:

Spoiler :


I get maps like that from many map scripts.
 

Attachments

  • buggerMeBlind.jpg
    buggerMeBlind.jpg
    206.2 KB · Views: 850
Here is where I say DOH!!!! :cringe:

*head-desk*

I thought of trying something like that, but I didn't think it would work >_<

Edit... well, on my system, this is what I got from making that change:

I get maps like that from many map scripts.

Well, that don't make a lot of sense. Maybe there is something wrong with your map script other than that. I'd start with a fresh Faireweather and just change the above code and see what it does. I don't see how that function would effect plots being water or not. All, it does is set the Europe flag of already existing water plots.

I've been working with the AI to get it to travel a Land Trade route. It's a pain and took me a while tracking down the right code but I finally got a peddler unit to travel the route, sell his goods, and work his way back. I'll have them stopping at Native villages soon to trade there as well. Or maybe even your house so leave the light on for 'em :)
 
I don't think it's the map script or the code that is at issue. Not with so many map scripts doing the same thing. I have to believe that it's a system related issue. I see a call to "CvPythonExtensions" in most map scripts and I don't have a Python file with that name anywhere on my system. I wonder if that is the cause of the issue
 
I don't think it's the map script or the code that is at issue. Not with so many map scripts doing the same thing. I have to believe that it's a system related issue. I see a call to "CvPythonExtensions" in most map scripts and I don't have a Python file with that name anywhere on my system. I wonder if that is the cause of the issue

Not sure about that but it is probably some code wrapped up somewhere so that us modders can't get to it. Anyway, IIRC I had a map do the same thing other day when I was testing all the maps to see if they would work for M:C. One thing I notice in your python code below..
Code:
if IsInList(europeAreaIdList,areaID):
                if y < mc.height/2:
                    plot.setEurope(europeNorth)
                if y > mc.height/2:
                    plot.setEurope(europeSouth)
                if x < mc.width/2:
                    plot.setEurope(europeWest)
                else: x > mc.width/2:
                    plot.setEurope(europeEast)

Lets say the map is 40 by 40
Ok, just using my logic... if y is less than than 40/2 = 20 then its a North europe so all plots with a y coordinate of Y 19 or less would be marked as such. But now, when you do the x < 20 all X coordinates including the ones you just marked as North will be set as West because you didn't check for the Y coordinate.

So, I am thinking after you set North with a y < mc.height/4 = 10 you will need to do a if( x < mc.width/2 and y > mc.height/4) and in order to set the West with out erasing the North. And sense you are spliting the map into four sections going /2 doesn't work anymore.

Anyway, This will leave all the Y plots with 9 or less alone. I haven't tested any of this but its what my brain says this late at night. It could just be talking non sense and then again I could just be dreaming this. Someone pinch me.
 
I don't know what is causing it, but now all map scripts, even the ones included in the latest update no longer generate North or South Europe plots when I use them in M:C

The same map scripts generate North and South plots in vanilla and in simple mods, even the modified FaireWeather, but none of them will work as they did 48 hours ago in M:C. I think my system is possessed by unclean spirits... when all else fails, blame it on Voodoo....
 
I don't know what is causing it, but now all map scripts, even the ones included in the latest update no longer generate North or South Europe plots when I use them in M:C

The same map scripts generate North and South plots in vanilla and in simple mods, even the modified FaireWeather, but none of them will work as they did 48 hours ago in M:C. I think my system is possessed by unclean spirits... when all else fails, blame it on Voodoo....

Well, one thing is the Colored Europe plots for North and South do not appear unless you have discovered the Silk Road but you can hover over a plot and it should say "Access to Trade Route" or "Access to Europe". If you have cheat mode activated and hold shift it will tell you which ocean you are looking at North, South, East, West.
 
I have this idea where we expand map sizes and divide the globe into East and West Hemispheres where what we have now is the West Hemispheres. Then in order to travel to the East Hemisphere you have to unlock some Tech/Event. Until then just like now you will only see a wall of black and can not cross it. Once the East is unlocked you can then venture across to the "New World". This "New World" will have been developing its Civilizations the whole game up to this point and the new comers will have to contend with the Natives there. However, there will be lots of land and new resources to exploit and riches to bring back to the old world. Hmm, I don't know, sounds awful familiar... was this a movie or something? :lol:
 
There has been talk about something similar for col2071 and there are several ways to do something like that.

  • New plot type
    Unit require owner to have a specific civic to enter
  • Plot lock
    Almost the same as #1
  • Chance plot type
    Change impassable plot to normal water
  • Civ solution: shallow water (min dist to land) until certain tech
    I would like something a bit more creative than this

I like to support the idea of an expanding map, but I'm not sure which way would be best.
 
I have this idea where we expand map sizes and divide the globe into East and West Hemispheres where what we have now is the West Hemispheres. Then in order to travel to the East Hemisphere you have to unlock some Tech/Event. Until then just like now you will only see a wall of black and can not cross it. Once the East is unlocked you can then venture across to the "New World". This "New World" will have been developing its Civilizations the whole game up to this point and the new comers will have to contend with the Natives there. However, there will be lots of land and new resources to exploit and riches to bring back to the old world. Hmm, I don't know, sounds awful familiar... was this a movie or something? :lol:

I like this! But do you have map upside down? Don't you mean that we are now playing eastern hemisphere and across the ocean waits the western hemisphere?

Really I would like the M:C to expand to the renaissance era. Even thought it really sounds like deja vu somehow:rolleyes:

---
New plot type
Unit require owner to have a specific civic to enter

This sounds like the most logical solution. There could be plot type "high seas":) or something. But instead of unlocking tech/civic, there would be new type of ships that can enter it. Those would be unlocked by tech of course.
 
Yeah, I proposed this too in my WHM musings.

Having a terrain type like 'Here be dragons' where you need certain ships or units or even better promotions to be able to cross it.

For WHM you could even have promotion levels, and higher grade HBD tiles, so you first can travel to america, then to south africa, and then round the bottom of the americas and africa to discover the orient.

If you could add a tag to tiles, something like need promotion X to enter.
 
There has been talk about something similar for col2071 and there are several ways to do something like that.

  • New plot type
    Unit require owner to have a specific civic to enter
  • Plot lock
    Almost the same as #1
  • Chance plot type
    Change impassable plot to normal water
  • Civ solution: shallow water (min dist to land) until certain tech
    I would like something a bit more creative than this

I like to support the idea of an expanding map, but I'm not sure which way would be best.

Already talked about? Man, its hard to come up with an original idea these days ;)

Some good suggestions on implementation there, I'm sure we'll figure out the best way if this ever hits the work table. One thought also, we could have it set up so that the Unlocked side is connected by sea tiles, or that you have to use a command like we do now to travel to West side, where there is a wall of black separating the two. This would give a sense of a Great Expanse between the two zones. That way, you could create the whole Earth and not have so much tiles used for ocean. Anyway, its an idea. And actually we could do this for all directions.



I like this! But do you have map upside down? Don't you mean that we are now playing eastern hemisphere and across the ocean waits the western hemisphere?

Really I would like the M:C to expand to the renaissance era. Even thought it really sounds like deja vu somehow:rolleyes:

Yes, I have my map flip flopped, that being I meant West when I said East :blush:
 
Top Bottom