1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Working Maps and Map Issues

Discussion in 'Civ4Col - Medieval: Conquests' started by Kailric, Jul 27, 2013.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I'll post a list of working maps here and possible issues.


    I have uploaded some maps that work with this mod. There is now a FaireWeather version for the mod that needs testing.
     

    Attached Files:

  2. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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?
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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)


    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.
     
  4. drjest2000

    drjest2000 Chieftain

    Joined:
    Dec 8, 2001
    Messages:
    332
    Location:
    retired
    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
     
  5. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.
     
  6. drjest2000

    drjest2000 Chieftain

    Joined:
    Dec 8, 2001
    Messages:
    332
    Location:
    retired
    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 >_<
     
  7. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.
     
  8. drjest2000

    drjest2000 Chieftain

    Joined:
    Dec 8, 2001
    Messages:
    332
    Location:
    retired
    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.
     

    Attached Files:

  9. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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 :)
     
  10. drjest2000

    drjest2000 Chieftain

    Joined:
    Dec 8, 2001
    Messages:
    332
    Location:
    retired
    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
     
  11. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.
     
  12. drjest2000

    drjest2000 Chieftain

    Joined:
    Dec 8, 2001
    Messages:
    332
    Location:
    retired
    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....
     
  13. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.
     
  14. drjest2000

    drjest2000 Chieftain

    Joined:
    Dec 8, 2001
    Messages:
    332
    Location:
    retired

    Attached Files:

  15. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I have uploaded some maps that work with this mod. There is now a FaireWeather version for the mod that needs testing. Thanks to drjest2000 for his help in editing this map.

    Edit: Uploaded new version of maps 1.1
     
  16. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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:
     
  17. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    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.
     
  18. Fullerene

    Fullerene Chieftain

    Joined:
    Aug 26, 2009
    Messages:
    228
    Gender:
    Male
    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:

    ---
    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.
     
  19. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    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.
     
  20. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.



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

Share This Page