Totestra: A new PerfectWorld2 fork

vktj

Warlord
Joined
May 6, 2012
Messages
237
Last update: August 7, 2021

2021 updates: Fixed dead link, rewrite Totestra.

In this rewrite of Totestra, I have made the code a lot closer to the original Perfect World by only retaining Totestra’s most essential features (see below for full feature list). People who wish to use the older version of Totestra with more features will find it readily available in the “old/” folder of the attached zip file.

Unlike the older Totestra, this rewrite has support for extra-huge 192x128 maps.

2019 update: It’s now possible to run a Totestra variant which uses the excellent RadioGatún[32] random number generator both inside Civilization IV and as a stand alone Python script. This allows people without Civilization IV to enjoy Perfect World maps, and makes it possible to automate the process of finding really good map seeds. Please download this at https://github.com/samboy/misc-civ4-mapscripts/releases/tag/2019-07-29 or in the second post of this thread.

2017 update: I do accept third party patches, such as the one q3max made. The script is now available at https://github.com/samboy/Totestra-mapscript/releases

Totestra is a map script--a program that makes random maps for Civilization IV. It is based on Cephalo's excellent PerfectWorld2 map script, and uses plate tectonics, meteor, and weather modeling to create a remarkably realistic earth-like planet. It is an update to PerfectWorld that adds more parameters that can be set inside Civ IV to the map generator, as well as fixing some long standing bugs with Cephalo's map generator. One goal of Totestra is 90% compatibility with PerfectWorld2; given the right parameters, Totestra will make mostly the same map that PerfectWorld2 did.

My motivation for making this map script is fill in the gaps since Cephalo has not made any updates to PerfectWorld2 for eight years.

Here is the obligatory screenshot of a map made with this script:



(To get this map: Choose a huge map with temperate climate, use “standard size” for the “bigger maps” setting, and select “fixed seed”)

And a high-resolution version of the same map:



Goals

My goal with this fork has been to address issues people have had with the script which Cephalo has never addressed.

Unlike Cephalo, I feel basic settings should be changed from Civ4's menus instead of editing the script. I like having the knobs on the front instead of in the back of the unit. :)

The following can now be set from the Civ 4 menu:
  • The climate
  • Whether to use a fixed or random map seed
  • Whether to make a normal sized map, a "fast and dirty" small map, or an extra-huge map which takes longer (and uses more memory) to generate.
  • Resource distribution: Whether to evenly spread out resources (less historically accurate; more Civ-game-like) or to have a given resource only on a given continent (more historically accurate; faithful to Cephalo's intentions), or to make a map full of resources (less balanced, but some people may like playing this kind of game)
  • New civilization placement option: Have all civs start on the same continent (either the largest continent, or the second largest continent)
  • The map script now eliminates coastal mountains and reduces other mountains (the code was in Perfect World, but was broken because of a typo)
This script is currently derived from Cephalo's last (and probably final) release of PerfectWorld2.py (version 2.06, not 2.06f), and does not incorporate any third party changes. (This is because of my open source roots; copyright is easier to handle when I derive only from Cephalo's code)

Support

Since I am not getting paid to develop Totestra, the usual expectations a customer may have do not apply here. I may or may not support you, depending on whether I have the time to do so.

That in mind:
  • Read the FAQ first. http://samiam.org/Civ4/TotestraFAQ.html
  • If, when trying to load the script, it gives you nothing but grassland, this means the script failed for some reason. Make sure to post the relevant lines of PythonDbg.log and PythonErr.log so we can try and figure out what's broken with your Civ IV install
  • I can not look at any reports of issues with strange looking maps, strange player placements, etc. unless I know the exact parameters that made the map in question. To get this information, look for a sign in the arctic with the map’s seed.
  • I will probably not implement whatever pet feature you want to have implemented. Remember: You have the source and I don't think Cephalo will mind if you implement it yourself.
  • All support requests or comments need to be posted here in this thread. Please do not PM, email, or use any other contact method to discuss with me this map script.
The script can be downloaded here:

https://github.com/samboy/Totestra-mapscript

A copy of this archive is also attached here (the zip file contains both the current streamlined Totestra.py, the older Totestra.py, and a full Git history of Totestra, going back to 2012 versions of the map script).

To install the script, download then copy the file Totestra.py to the PublicMaps directory, which should be at /Users/yourname/Documents/My Games/Sid Meier's Civilization 4 Complete/PublicMaps or somewhere similar. (Cephalo fixed the bugs which required PerfectWorld2 to be in a system directory a long time ago.)

- Sam
 

Attachments

  • Totestra-mapscript-2021-08-07.zip
    415.8 KB · Views: 487
Last edited:
Here is a mod compatibility chart for Totestra on the mods I have tested it with. Being listed as compatible merely indicates that the map builds and generates a player start for my "reference test" map; it does not indicate that the game is balanced or even playable:
  • Fall from Heaven 2: YES (Furthermore, Cephalo made the Erebus map script)
  • Gods of Old: YES
  • Fairy Tale: YES
  • Next War: YES
  • Rise of Mankind 2.91: YES (There's also a ROM version of PerfectWorld)
  • K-Mod YES (En Dotter report)
  • TAM/The Ancient Mediterranean: YES
  • Tamriel / Elder Scrolls: YES (I get the impression that there are multiple "Elder Scrolls for Civ4" Mods out there; the one I tested is called tamriel.rar and has a size of 41,496,628 bytes)
  • Legends of Ancient Arabia: YES (Requires XML file fix at http://samiam.org/Civ4/Arabia.html to make fully playable games)
  • Master of Mana: YES (BUT it gives an annoying error message when starting the map; MoM includes a port of Perfect World2 which may work better)
  • Barbarians: YES (Warlords mod; smaller maps only)
  • Bare bones: YES (Warlords simple mod; it appears to exist as a framework for modders to start from. Nevertheless, you can play a Totestra-generated map with it)
  • Realism Invictus: YES (Must use "Play now!" and trudge through all of the options instead of "Custom map")
  • Community Civ V: YES (Appears to require admin privileges to play)
  • World War II 1939: YES (Requires admin privileges to play; world map is revealed at game start)
  • Mars, Now! MAYBE (I'm not sure how playable such a map really is, but it does generate and starts the player)
  • Future Mod 2b: MAYBE (Map undergoes "global warming" transformation and resulting game may not be playable)
  • Caveman to Cosmos: MAYBE (Appears to require admin privileges to play; also includes C2C version of PerfectWorld; some claim this won't work but it worked for me)
  • Mongoose Mod: MAYBE (worked in older versions, crashes with MM 4.1)
  • BUFFY/Hall of Fame: NO (While the HoF mods can generate and play a map with Totestra or Perfect World, these maps are disqualified for Hall of Fame games. Also, requiring admin privileges to play a game is something I really don't like)
  • Final Frontier: NO (But I had to try! And, of course, Cephalo made the Spiral Galaxy map script for FF)
  • Dune Wars: NO (But Cephalo did make the Arrakis map script)
  • Planetfall: NO
  • Rhye's and Fall Random: NO
  • Multiverse: NO (It might work if I didn't delete other BtS mods; if someone else tests it with positive results, let us know)
  • Pie Ancient Europe IV: NO (Mod enters a verified infinite loop when generating the map)
  • Pie Ancient Europe III: NO (Mod enters a verified infinite loop when generating the map)

I also have a copy of this compatibility chart at http://samiam.org/Civ4/Compatibility.html

Remember:
  • Please post all support requests about this script here.
  • Please do not file bug reports about getting "nothing but grassland" without enabling full logging in the relevant .ini file, and posting the full PythonErr.log and PythonDbg.log files here.
  • Please do not file bug reports about unusual features in the map without the map's seed (visible as a sign in the arctic) tag included, either as a screen capture or in text form.
  • I will probably not implement feature requests.

Attached are some older versions of the script.
 

Attachments

  • misc-civ4-mapscripts-2019-07-06.zip
    324.9 KB · Views: 252
  • TotestraRG32-2019-07-29.zip
    55.5 KB · Views: 326
Last edited:
Love the script, personally it's the only map script i would play with.

One thing i've noticed is that setting to cold climate, the ice caps are not wider like they should be in real life, or in vanilla bts.

That's all for now, will give more ffedback as soon as i spot something worth mentioning.
 
One thing i've noticed is that setting to cold climate, the ice caps are not wider like they should be in real life, or in vanilla bts.

That's easily enough fixed. I'll fix it after I get the bugs in the "quick and dirty" maps fixed (they trigger a lot of corner cases which rarely occur in Cephalo's default settings); I'm going to have to disable "slow but good" maps for now until I figure out why they cause the generator to go in to an infinite loop (fixing this is a matter of having infinite "while" loops raise an error should a "loop limit" counter become too large).

Another idea which I will probably not implement is to have a "climate amount" which will determine just how tropical/cold/arid/rocky we make a map. They may be done once I get the maps ratios to be adjustable without things blowing up.

Some other blue sky ideas which I would love to have the time to implement but will almost certainly never get around to doing: 1) Make the map generator stand-alone, so we can have it run while we're not looking at the screen and waiting for the map to be drawn. 2) Make it possible to have the map generator make non-Civ-4 maps, such as maps for Freeciv, C-evo, Alpha Centauri, Civ 3, or Call to Power 2 (it's probably possible to adapt the "shrink" routine to fit the heightmap on an isometric or even hexagonal grid).


I'll work on it again Saturday. Thanks a lot for checking out the script.

- Sam
 
May 19, 2012 update: I have fully tested and am declaring stable "fast and dirty" map rendering (it renders fine with the three preset seeds I use for testing). I have disabled "slow and extra-fancy map rendering"; there have been far more complaints about how slowly PerfectWorld renders maps than complaints about how quickly it renders maps.

In addition, I have fixed the issue with ice being generated; ice is now smaller on smaller and/or hotter maps, as well as bigger on colder maps.

Download link at the top of this page; please be sure to enable full logging and include a map generation log (or, at least the seed and settings used to make the map) before reporting issues with the map generator.

I will work on it again in a couple of days.

- Sam
 
I just re-downloaded for the update. The date of the file (inside the file in its comments up top) still says it's May 12's version. Is that just an oversight or did the new file not get uploaded yet?

[Edit: Nm, just noticed the dated text at the bottom of the website page, I'm guessing it is the correct version.]
 
I just re-downloaded for the update. The date of the file (inside the file in its comments up top) still says it's May 12's version. Is that just an oversight or did the new file not get uploaded yet?

Opps...I forgot to update the changelog when I made the May 19 improvements. I'll put the changelog here:

  • Extra-slow maps disabled; they just put PerfectWorld in to an infinite loop
  • "Fast and cheap" maps tested; they work with all three preset seeds so I'm declaring these maps stable. Please note that these more quickly generated maps can not be any size bigger than standard (actually a little smaller), and that the number of continents can not be adjusted
  • Iceberg code overhaul: Polar icebergs are now more common in cold and/or large maps, and less common in smaller and/or warmer maps.

Current to do:

  • Convert map options from arbitrary numbers in to symbolic names. For example: OPTION_MapSeed instead of "0". DONE
  • Allow map aspect ratio to be set. Right now, maps have a fixed 3:2 ratio; the map is always 1.5 times more wide than tall. Allow 2:1 (maps twice as wide as tall), 1:1 (square maps), 2:3 maps (taller than wide), and 1:2 (even taller) maps. There was one user in the old PerfectWorld thread who preferred 2:1 over 3:2 maps. DONE
  • Fix issue with "international date line" (wrap-around seam) cutting continents in the middle. The fix is to use the column with most water for the left edge of the map by rotating the map. Make it possible to disable this (by editing the file), since it is a minor spoiler. This solves an issue two different people have reported with PerfectWorld (1: Not having this sometimes can look ugly on the minimap. 2: It can make for really bad flat maps, since a continent is cut off halfway through) DONE
  • The script supports cylinder, flat, and toric maps. To make it complete, add "Uranus"/"Wrap Y" maps (it wraps going north/south but not east/west). DONE Actually, I made the fourth option a toric map with PerfectWorld2's method of generating ice bergs.
  • I don't think we should pamper users who are used to using certain strategies to win at emperor level. If someone wants a handicap with their starting position, they can ask for it in the options. My philosophy: The purpose of Perfect World is to model reality. Guns, Germs, and Steel by Jared Diamond talks about how real-world "starting positions" were anything but fair, and to try and make them fair without user intervention goes against real history. DONE; user specifies their own handicap
 
I'm using this script with K-Mod (the BEST AI mod for civ4, imho, can't play with anything different)

This awesome mod overhauls the Global Warming, making it much more gameplay friendly, interesting and fun. It now melts the ice caps which serve as a "GW protection".

Would be simply awesome if the wrapping would be Toroidal, but WITH the ice caps still there, so that when the caps melt the pole can be finally crossed.

I wander if that's possible, maybe in an optional version just for K-Mod GW system?


Thanks :)
 
Would be simply awesome if the wrapping would be Toroidal, but WITH the ice caps still there, so that when the caps melt the pole can be finally crossed.

Here's the part of the code that adjusts things for toric maps:

Code:
        if selectionID == 1: #Toroidal
            self.hmHeight -= 1
            self.WrapY = True
            [B]self.iceChance *= 0.1[/B]
            self.northWaterBand = 0
            self.northCrop = 0
            self.southWaterBand = 0
            self.southCrop = 0
            wrapString = "Toroidal"

(Cephalo, if he is up to it, may chime in and explain exactly why it is we have to change the heights in toric maps and can not have water bands or cropping; I honestly don't know.)

The bigger the iceChance multiplier number is, the more ice there is in the poles on toric maps. 1.0 would give the map the same amount of ice as flat or cylindrical maps.
 
I have made an update to the map generator today:

  • Overhaul of selection code; symbolic names are now used instead of numbers. This doesn't affect the script's behavior, but makes it a little easier to read.
  • Map ratios now can be selected. It is now possible to select a tall map, a square map, a "normal" (3:2) map, or a 2:1 "widescreen" (or, if you prefer, "equirectangular projection") map. ("Quick and fast" small maps have a fixed 3:2 ratio)

As always: http://civ4.vk.tj

(Note to self: It looks like the "Allow Pangaea" option has been broken. I'll look at it in the next update Fixed in May 24 update)
 
I have added service tags to generated maps, which is a sign near the polar ice caps which contains a 21-digit hexadecimal string with all of the parameters used to generate a given map (map seed, number of continents, ocean level, island count, etc.).
 
What is handicap level? is it the probability to spawn in a unfavorable zone like desert or small islands?

Anyway keep ut the great work!
 
I just downloaded and tried this map using K-Mod. After turn 1 (settling stuff) i opened world builder to see whats up. I saw a lot of empty areas, empty in resources and/or rivers. Map seemed like a green desert to me. I saw maybe 3-4 food resources in total. Is that supposed to happen cus of some other map scrip mechanic or did my 1st random map just freak out? Is it cus of K-Mod and not the original BTS? I use blue marble adjusted for K-Mod as well.
Map scrip looks promising, i really liked the land masses. Gonna try another randomization now. ;)
 
Just did another random (map ID: 224810008f3d2735334af). Map is rather low on resources. Its similar to my first random but i forgot to write down the seed...
 
Its similar to my first random but i forgot to write down the seed...

If you have a saved game with the first random seed code (look in the auto save folder, my Games\Civilization 4 Vanilla/Warlords/BtS/whatever mod\Saves\single\auto), open up that saved game, enter the world builder, then look around the north pole for a sign with the map seed code.
 
Top Bottom