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

PerfectMongoose (PW3 Civ4 Port)

Discussion in 'Civ4 - Map Scripts' started by LunarMongoose, Dec 14, 2010.

  1. Antmanbrooks

    Antmanbrooks Chieftain

    Joined:
    Jun 20, 2007
    Messages:
    436
    Location:
    The Cheshire Plain.
    Hello, excellent map script for the record. I love it!

    How easy would it be to make this map script add terrain features like swamps and scrub to grassland and desert respectively? I'm playing Realism:Invictus mod at the moment and within that mod they have swamps and scrub but as is to be expected these features don't get added to most scripts.

    The mod comes with PerfectWorld and Tectonics as two of the most realisttic world generation scripts and I've added PerfectMongoose to the list in my version. For some reason Tectonics adds the above terrain features but this and PerfectWorld don't?

    If it's easy enough can someone explain what I need to do and if it's a massive headache that requires a certain kind of upbringing then is there any kind souls out there willing to help?
     
  2. Antmanbrooks

    Antmanbrooks Chieftain

    Joined:
    Jun 20, 2007
    Messages:
    436
    Location:
    The Cheshire Plain.
    Actually ignore this, I've just figured that you have realeased a PerfectMongoose_v321_MM_Edition as part of your MongooseMod. That seems to add scrub anyway and by replacing your FEATURE_MARSH for FEATURE_SWAMP it seems to work pretty well anyway! Do you mind if I introduce this to the Realism:Invictus team?
     
  3. LunarMongoose

    LunarMongoose Chieftain

    Joined:
    Jan 29, 2006
    Messages:
    730
    Gender:
    Male
    Location:
    Boston, MA, USA
    Oops, didn't see this, sorry. Re-posting my PM response, for the record:

    Yep; my Marsh placement got a lot more advanced in the 3.2.1 update! But it wasn't posted publically til I FINALLY released MM 4.0 a month ago. It sucked that my biggest mod update ever (by far) delayed the release of the custom version of the mapscript for 3 months, b/c I thought it was awesome. :)

    And to everyone else: don't worry, I'm still planning to release vanilla 3.2.1 here as well, I just haven't had time yet (and I wanted to give MM users first crack at it :p).

    No, of course not... Only my more recent SDK code is sealed away in a deep dark vault of eternal silence and shadow. :p

    I do have to make sure you give me a nice big credit mention though!
     
  4. Cykur

    Cykur Chieftain

    Joined:
    Apr 7, 2008
    Messages:
    167
    Anyone have a copy of the Perfect Mongoose 3.2 script? I only have 3.1 and all the download links for Perfect Mongoose stuff seems to be dead. Hopefully Lunar Mongoose checks in some time, he did some great work tuning up the PW2 script.
     
  5. kxta

    kxta Chieftain

    Joined:
    Jul 20, 2012
    Messages:
    13
    Location:
    Great White North
    I second this. The shutdown of MobileMe was announced a long time ago so I suspect it has been orphaned now, someone from the community will have to post on MediaFire or something.
     
  6. vktj

    vktj Chieftain

    Joined:
    May 6, 2012
    Messages:
    199
    I'll post Perfect Mongoose 3.2 (here called LM_PerfectMongoose) here. Heck, I'll do one better: Here is Perfect Mongoose 3.2 and every other map script I could find for Civ4.

    The version of my own Totestra included in this zip file is an older one, and the zip file doesn't include the SandBar map scripts, but I have posted the latest Totestra in its thread and a link here on CivFanatics to the latest SandBar in its thread.

    Also: The "SM-DOWN" and "SM-UP" files are not map scripts, but text files with the file size and RadioGatun[32] sums of all the other files.

    - Sam
     

    Attached Files:

  7. Cykur

    Cykur Chieftain

    Joined:
    Apr 7, 2008
    Messages:
    167
    Thank you so much!
     
  8. kxta

    kxta Chieftain

    Joined:
    Jul 20, 2012
    Messages:
    13
    Location:
    Great White North
    A gentleman and a scholar you is :D
     
  9. LunarMongoose

    LunarMongoose Chieftain

    Joined:
    Jan 29, 2006
    Messages:
    730
    Gender:
    Male
    Location:
    Boston, MA, USA
    Yes, I knew it was coming ever since they didn't renew my billing last fall and said they'd given me 6 extra months free b/c of the shutdown. Unfortunately, this is me we're talking about, so I pretty much ignored the problem until the day it was killed.

    From there, I was playing Diablo 3 every waking second (which I badly need to get back to), then on to being sick for 3 weeks, then on to a frenzy of research about PC watercooling parts for the last 2 weeks so I don't screw up my new build with corrosion and ruin it.

    It actually took a couple hours of research to track down all the free hosting options available and find out their exact rules about size limits, bandwidth, inactivity, etc - the info is not always made easy to find. I've settled on FileFactory for my really big files (MongooseMod is up on there now after 5 long-and-ultimately-failed upload attempts), and MediaFire for small files due to their friendlier inactivity policy (any file downloaded refreshes the timer on all of them, in particular). I should have those posted here in a bit.

    And yes, I still owe you a slightly-bugfixed-and-updated version of this mapscript file, which should hopefully be soon since I have to work on my mod more too, and I've put my Civ obligations off as long as I can at this point. :p

    Don't worry, I expect to still be around on this forum at the age of 100, just not necessarily all the time. :) Thanks for the compliment btw, Cykur!
     
  10. tdfriese

    tdfriese Chieftain

    Joined:
    Oct 30, 2010
    Messages:
    76
    Location:
    Chicago
    Hi LunarMongoose - first let me say that this is a great port of a great script, the best out there in my book. Most importantly, it seems that the rainfall donut of PW2 has been fixed, leaving true tropical and desert bands.

    Today I'm here with a problem to fix - one thing I keep seeing in my recent Realism Invictus games is the presence of stranded squares of jungle at the border between the subtropical plains and deserts.

    I'm attaching a biome map below which shows that there is usually a slow transition from jungle to mixed savanna to arid grassland to full desert. This is particularly clear in the Sahel region of Africa.

    World Biome Map

    I don't have a good sense of how the script works, but my suspicion is that these areas at the edge of deserts have a high temperature but middling rainfall and somehow become jungle. In that case, the solution might be to raise the rainfall threshold for jungle slightly. I don't have screenshots with me right now, but I can bring some if you want me to.
     
  11. Cykur

    Cykur Chieftain

    Joined:
    Apr 7, 2008
    Messages:
    167
    I haven't been able to download Mongoose Mod from Filefactory, after making me go through all the steps of waiting, it doesn't seem to make a connection to the download server. I'll try it again later at off-peak times, maybe it is just a temporary problem.

    I tried out the PerfectMongoose v320 script that vktj was kind enough to upload, and after several tests it doesn't seem to generate any Marsh terrain. I tried both the PW2 & PW3 climate and land models a few times each but no Marsh.

    I do see how v320 appears to create more defined climate bands. The maps are very nice. One small request if you should happen to ever update this script again; can you look into an option to reduce or smooth coastal mountain ranges?
     
  12. vktj

    vktj Chieftain

    Joined:
    May 6, 2012
    Messages:
    199
    When I fixed this in my old Totestra.py script, this is what the code looked like. The code also eliminates mountain peaks with more than three adjacent mountain peaks.

    Code:
            #break up large clusters of hills and peaks
            for y in range(mc.height):
                for x in range(mc.width):
                    i = GetIndex(x,y)
                    if self.plotMap[i] == mc.HILLS and mc.smoothPeaks == 1:
                        allHills = True
                        for direction in range(1,9,1):
                            xx,yy = GetXYFromDirection(x,y,direction)
                            ii = GetIndex(xx,yy)
                            if self.plotMap[ii] != mc.HILLS:
                                allHills = False
                        if allHills == True:
                            self.plotMap[i] = mc.LAND
                    if self.plotMap[i] == mc.PEAK and mc.smoothPeaks == 1:
                        allPeaks = True
    		    peakCount = 0
    		    nextToOcean = False
    		    #print "peak at %d %d" % (x,y) #DEBUG
    		    # While we're here, let's eliminate seaside peaks
                        for direction in range(1,9,1):
                            xx,yy = GetXYFromDirection(x,y,direction)
                            ii = GetIndex(xx,yy)
                            if self.plotMap[ii] != mc.PEAK:
                                allPeaks = False
    			else:
    			    peakCount += 1
                            if self.plotMap[ii] == mc.OCEAN:
    			    #print "nextToOcean %d %d" % (x,y) #DEBUG
                                nextToOcean = True
                        if allPeaks == True or peakCount > 3:
                            self.plotMap[i] = mc.HILLS
    		    if nextToOcean == True:
    			self.plotMap[i] = mc.HILLS
    
    As a point of comparison, Cephalo's original PerfectWorld code:

    Code:
            #break up large clusters of hills and peaks
            for y in range(mc.height):
                for x in range(mc.width):
                    i = GetIndex(x,y)
                    if self.plotMap == mc.HILLS:
                        allHills = True
                        for direction in range(1,9,1):
                            xx,yy = GetXYFromDirection(x,y,direction)
                            ii = GetIndex(xx,yy)
                            if self.plotMap[ii] != mc.HILLS:
                                allHills = False
                        if allHills == True:
                            self.plotMap[i] = mc.LAND
                    if self.plotMap == mc.PEAK:
                        allPeaks = True
                        for direction in range(1,9,1):
                            xx,yy = GetXYFromDirection(x,y,direction)
                            ii = GetIndex(xx,yy)
                            if self.plotMap[ii] != mc.PEAK:
                                allPeaks = False
                        if allPeaks == True:
                            self.plotMap[i] = mc.HILLS
    
    - Sam
     
  13. LunarMongoose

    LunarMongoose Chieftain

    Joined:
    Jan 29, 2006
    Messages:
    730
    Gender:
    Male
    Location:
    Boston, MA, USA
    Hi guys. Sorry for being awol/mia so long, the last year in particular has been kinda crazy for me. Also apologize for the FileFactory thing, it wasn't on purpose, I'll be moving all my files somewhere better pretty soon.

    Interesting with the peak reduction code, vktj. I'll try it out. Thanks.

    Main point of this post: As part of my latest big and overdue MongooseMod update (currently in 24/7 eat/breath/sleep-Civ4 development mode once again), I've been working heavily on PM the last week. Initially that was all about supporting the boatload of new terrain and feature types I'm adding in my MM-specific version of the mapscript (not copying C2C's PM code for the same content either, doing it all from scratch, and pretty sure I'm doing it better hehe).

    BUT, I finished all that up two days ago, and now I'm trying to tackle something else that's been bothering me for a long time: rivers. Basically, there are two things I don't like about Cephalo's river code (which no one has ever updated since the early PW2 days afaik, btw): they're mostly very short with a few medium-length rivers at most, and they're always ultra-dense in the tropics and very, very sparse in most other parts of the map (no matter HOW low you set the RiverThreshold global).

    These both stem from his fundamental design, which is based on his RainfallMap and his ElevationMap. Obviously connecting rivers to rainfall and geography is realistic, but imo it's not good for game balance to have anything other than an even distribution over the whole map. (Plus I really, really miss the super-long snaky kind that I used to have in my games many years ago.) The obvious solution is to switch back to the default normal vanilla river generator contained in the SDK code.

    I've already tried this on PM, and it works, but the rivers are STILL a little sparse just in general (I guess that's vanilla's original balance though), they start on flatlands more often than I'd like, and they seem to cause fewer lakes to spawn (though I can probably compensate for that in the mapscript control globals).

    I've spent most of the last two days trying to write my own river generator. The idea was to force it to always start in hills, peaks, or lakes, and always run to (other) lakes, or coast. As well as increase the overall density a bit versus the vanilla Civ4 generator. However, writing a full river system is actually pretty hard, and I didn't want to copy the vanilla code verbatim into Python because it's awfully long, lol. So I'm currently trying to decide if I should keep plugging away at my own code, start over and translate the SDK code, or just keep the vanilla system engaged and try to fix the lakes.

    But I really think a system that starts in random locations (rather than rainfall-based to avoid ultra-dense river-tropics), and goes in random directions once started (rather than ElevationMap-steepness-based to avoid all-pipsqueak rivers) is better for gameplay, even if less realistic in principle. (In practice it's probably more realistic though, and I'm not sure how to bridge that gap, to be honest. I tried a number of variations on using the rain and height data already, and couldn't really make anything good come out of it.)
     
  14. LunarMongoose

    LunarMongoose Chieftain

    Joined:
    Jan 29, 2006
    Messages:
    730
    Gender:
    Male
    Location:
    Boston, MA, USA
    So I've looked at it more closely now, and it turns out the vanilla river generator isn't that long afterall... How they got it working so well with less code than I'd already written in my still-only-half-working version, I have no idea...

    Anyway, that led me to discover the PLOTS_PER_RIVER_EDGE xml global. When boosted from its vanilla value of 12 to a nice sparkling 8, it produces results on PM that I'm VERY happy with. Plus Cephalo's lake code seems to be highly dependant on how many rivers were placed just prior in the AddRivers() function, so cranking that up fixed the lake situation automatically.

    Would you guys be okay with me just distributing a single-entry xml global file with the next version? I could port the whole vanilla generator to Python and then make the change there, but I really don't want to bother, lol.

    (The standard vanilla mapscripts do get a bigger increase from this change than PM does, but that's unavoidable given that they have larger and more uniform landmasses, and they still don't really feel "overloaded" on rivers.)
     
  15. cephalo

    cephalo Chieftain

    Joined:
    Jul 26, 2007
    Messages:
    2,055
    Location:
    Missouri, USA
    One easy thing you might try is using a constant value for rainfall instead of using values from the rainfall map. That should be uniform and highly adjustable, while also accurately using the altitudes to guide the rivers. Then it all depends on just watershed size.
     
  16. LunarMongoose

    LunarMongoose Chieftain

    Joined:
    Jan 29, 2006
    Messages:
    730
    Gender:
    Male
    Location:
    Boston, MA, USA
    Ooh, hi Ceph! Great to see you still around. :)

    Yes, I did think of that, and it was one of the things I mentioned having already tried. It does even them out so you get equal numbers of rivers in all areas, but it still leaves them all being very short. They mostly bee-line straight to the nearest Coast tile, which is usually not far away b/c of the jagged non-uniform landmass shapes. Even on Huge (and above) map sizes, the longest you get are "medium" length at best, and they're not very snakey.

    On PM I am ecstatically happy using the vanilla generator now with its density value increased, and can't wait to play again based on that. I did want to make it a map menu option for which river system gets used, but b/c of the way the vanilla SDK code calls Python code, that would require porting the whole generator to Python, heh.

    (Technically there IS another way, a brilliant workaround hack I thought of ;): let the SDK code always do its rivers, then in the next Python hook function, if and only if the map option is set to use Python rivers instead, delete all the rivers from the map that were just placed, and do the Python ones. But given how much better the SDK rivers are for gameplay imo, I was leaning towards just doing that...)
     
  17. LunarMongoose

    LunarMongoose Chieftain

    Joined:
    Jan 29, 2006
    Messages:
    730
    Gender:
    Male
    Location:
    Boston, MA, USA
    Just a heads-up, in addition to the other somewhat-significant stuff I've already done (vanilla river option, absolute height option, new proximity code for Old World landmasses, slightly updated Oasis placement, meteors disabled on the smallest 3 map sizes regardless of setting), I'm currently working on a full bugfix-slash-major-improvement update of the Player Starting Location Code.

    No offense to Cephalo (b/c his mapscripts themselves are wonderful and amazing and I honestly couldn't live without them :worship:), but his still-in-use starting plot code from PW2 is really, REALLY awful, lol.

    Already I've found two CRITICAL bugs, two MAJOR bugs, and several minor bugs with it, as well as there being a LOT of room to add missing or enhanced functionality. I haven't tested it yet b/c I'm only half done so far, but I think it's safe to say it should be working at least slightly better pretty soon. ;)

    The Vanilla Edition™ of PM v3.3 will be released as soon as I'm done with the big MongooseMod 4.1 update I'm still working on. I currently expect to have THAT out around next Weds (Jan 23), give or take, so allow an extra day for this. :)
     
  18. LunarMongoose

    LunarMongoose Chieftain

    Joined:
    Jan 29, 2006
    Messages:
    730
    Gender:
    Male
    Location:
    Boston, MA, USA
    Whelp, as usual, the Mongoose emerges from the Dragon Cave battered, beaten, scarred, and a little singed... but victorious. :viking:

    * Fixed a HUGE number of bugs in getPlotPotentialValueUncached().
    * Added a HUGE number of missing evaluations (and modified a large number of existing ones) in getCityPotentialValue() and getPlotPotentialValueUncached(), which should now be pretty much perfect.
    * Rewrote the player assignment code in SetStartingPlots() from scratch so it scales proportionally instead of only adding and removing players from the largest landmass til it hits the right number, AND did it directly with floats instead of an iteration-based refinement loop. (Okay so technically I still have one, but it's not the MAIN loop any more! :p)
    * Allowed starts on very small islands, but added detection for being Coast-linked with other landmasses to form a "region", which must meet a higher minimum size requirement.
    * Blocked starting locations that are walled-off by Peaks into very small areas.
    * Blocked starting locations on terrain/features that don't allow city founding.
    * Took the corners off the PlotList Eatery™ Bar and Grill.

    And yes, it works pretty darn well now. :D

    (So much so, in fact, that my attention has suddenly turned to the SDK city location evaluator, since it keeps making the AIs found their first cities on worse tiles right next to my perfect mapscript-selected ones, lol. Unfortunately THAT function is much more complicated...)

    This was SUPPOSED to be a quick update, which I had originally budgeted only "a few hours" for, lol. Well, 3 full days of work later, I'm finally happy with the results. The delay will push the release back a few days, but I'm working as fast as I can... Keep an eye on MongooseMod 4.1 for an idea of my schedule, hehe.
     
  19. Midnight-Blue766

    Midnight-Blue766 The filidh that cam frae Skye

    Joined:
    Sep 24, 2007
    Messages:
    3,445
    Location:
    Bonnie Scoltland
    The download doesn't seem to be working. :(
     
  20. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    30,740
    Location:
    Germany / Netherlands
    See further up the site ;).

    I've now updated the entry in the download database with that link.
     

Share This Page