Totestra: A new PerfectWorld2 fork

Hello, I would like to personally configure the generator to play pangaea, without many continents. The current setting for pangea resolution does not allow for this. Is it possible? If so, what piece of code would you like to change?
According to my impressions, it is worth saying that there are no large lakes in deserts at all, and the search for bonus resources on the map seems to devalue their value
 
Last edited:
If you want a Pangaea, that’s an option in the map generator to “Allow Pangaeas”, but that only allows but does not guarantee we will have a Pangaea in the generated map.

To force everything to be pretty much on one island (“Pangaea”, if you will), I have made the BigIsland map script which is a fork of Totestra optimized to make a single big continent with relatively few islands.

Edit: Another option is to have all players start on the same landmass; this way, even if Totestra doesn’t generate a Pangaea, the game still plays like a Pangaea in the way all players can be reached without a navy.
 
Last edited:
Here is a fork I have made of Totestra optimized to make Arabian adventures. Unlike the BigIsland fork which tweaks the land generator to have the generator (almost always) make a single land which only sometimes has outlying islands, the Totestra generation engine is left largely untouched. Instead, I am running a script on my Raspberry Pi [1] which generates about one or two worlds a minute [2] continuously. Every time it finds a map suitable for an Arabian adventure (not too close to the poles; no snow; little or no tundra; 40% or more desert), it notes the seed and size of the main island. I have so far found 90 different suitable seeds: 40 small, 59 large. By default, the script chooses a larger seed, but it’s also possible to choose a smaller land, any of the 89 suitable lands, or choose a fixed seed (the 90th suitable seed).

I should point out it’s not possible to adjust the climate or the size of the generated map; it will always be a huge arid 144x96 map, and everyone will start on the largest landmass (every other land mass will be a new world in the midgame),

This allows a suitable Arabian style adventure to be played (large desert, everyone on same landmass) while having there be a lot of islands to explore in the midgame.

The file is attached. Place the included .py file in one’s PublicMaps folder (usually, C:\Program Files (x86)\2K Games\Civilization IV Complete\Sid Meier's Civilization 4 Complete\Beyond the Sword\PublicMaps\, but your mileage may vary), choose ArabisnTotestra, and be ready to play an Arabian adventure.

Oh, also, this is based on the second version of Totestra, but it uses a different random number generator, and I have restored the ability for the player to choose how much bonus resources they get at their starting location.

[1] I will credit the Python developers for having the final version of Python2 running in 64-bit mode on an ARM CPU run exactly like how Python2 in Civ4 runs on a x86 CPU in 386/32-bit mode

[2] Python2 got faster post-Civ4

[3] Edit: Five more adventures added (compared to numbers above); README.txt added to .zip file. Also, a bunch of bugfixes and features: User selectable hut placement (default, no huts, fixed per random seed, few huts, lots of desert huts, lots of huts everywhere). Better bonus resource placement. Better player start placement.

Edit I am in the process of continually updating the script with more possible adventures on GitHub. See https://raw.githubusercontent.com/samboy/misc-civ4-mapscripts/master/ArabianTotestra.py for an updated version, and https://github.com/samboy/misc-civ4-mapscripts/commits/master for changelog
 

Attachments

  • ArabianTotestra.zip
    51.8 KB · Views: 39
Last edited:
In the, for now, final version of ArabianTotestra, there are 94 possible smaller maps and 90 larger maps one may be randomly selected to play. In addition, there are four different fixed seed maps.

The map also now has formal documentation:

About
ArabianTotestra.py is a map script for Civilization IV. It is derived from Rich Marinaccio's map script Perfect World. While Rich Marinaccio never provided a license for Perfect World, he has given me permission to make derivatives of it and I believe he is OK with any and all non-commercial use of the script.

In this variant of Perfect World, I have made a version of Perfect World which generates the same maps Perfect World generates, but only (by default) selects maps which are suitable for the Warlords Mod "Legends of Ancient Arabia".

This is a map script: It is a Python2 program run by Civilization IV to generate a map for that game.

This map script is designed to model a natural world like Earth: The scipt simulates plate tectonics, rainfall, meteor hits, and other factors which created the continents on Earth.

This script limits the number of worlds that can be generated. A script was run for several weeks to find Perfect World random number generator seeds which generate simulated planets suitable for creating an Arabian adventure: The main continent needs to be near the equator, and there needs to be very little cold areas in that continent. This script, by default, will only randomly select one of the larger possible Arabian adventures found by this script.

Unlike other Civilization IV map generators, all of the players will start on the same continent, changing the map size won't change the size of the generated map (all maps are 144 tiles wide and 96 tiles tall), climate can not be selected (the climate is arid), and the sea level can not be adjusted.

Installation
Place this in one's PublicMaps folder, such as "/Sid Meier's Civilization 4 Complete/Warlords/PublicMaps/". When starting a game, select "Custom Game", and make sure "ArabianTotestra" is visible when selecting "Map".

Options
Size
This should be set to Huge. While it can be set to a smaller size, the map generator always generates an 144x96 map; smaller sizes reduce the default number of players and make war weariness happen more quickly while not affecting the actual map generated.

Era
Set this to the desired era to start with. With the "Legends of Ancient Arabia" mod, this should be "Ancient".

Speed
How fast the game develops. For a quick game, choose "Quick" or "Normal", and choose "Smaller start continents" for the seed below.

Resources
Perfect World had its own unique resource placement code which better simulates resources in the real world. For Civilization games, this is less than ideal. "Full of resources" simply randomly places a large number of resources everywhere on the map; "Resources evenly spread" does not place resources on their own continents, but acts like "Full of resources", except the resource count is lower. "Like Perfect World" uses Perfect World's resource placement code.

Map seed
This determines the seed given to the pseudo random number generator to generate a map. Running a script on a Raspberry Pi server found a large number of maps which appear to be suitable for Arabian adventures.

Selecting "larger start continents" will select one of those seeds which generates a continent with a size of 1400 or higher. This is suitable for a game at "epic" or "marathon" speeds.

"Smaller start continents" will select a seed which makes a continent smaller than 1400 in size. This is for a game at "quick" or "normal" speeds.

"Random" will select any known seed suitable for generating an Arabian adventure.

"Free form (not Arabian)" will select a completely random Pefect World seed; most maps will not be optimized for an Arabian adventure.

"Amira map" is a fixed seed I found in 2018 which looks to be a very enjoyable Arabian adventure. Selecting this will always generate the same map.

"Caulixtla map" is a fixed seed I found in 2012 which is my usual go to Arabian adventure map. If nine players are selected, this is the Hijazi start in the Arabian Caulixtla map included with my fork of "Legends of Ancient Arabia". Note that this map will be upside down compared to the map included with "Legends of Ancient Arabia"; the LOAA version of the map was flipped over 180 degrees back in 2012.

"Fixed seed (Jungle start)" is a fixed seed making a larger continent where the player starts in a jungle.

"Caulixtla map (Jungle start)" is the Caulixtla map again, but with a start in a Jungle, as long as precisely nine players are selected (the number of tribes in "Legends of Ancient Arabia"). If the map does not have nine players, the player may not start in a jungle. This start is the Omani start in the 2012 version of the Arabian Caulixtla map, and the Hijazi start in the 2021 second revision of the Arabian Caulixtla map.

"Fixed seed (Grassland start)" is a different map than the "Fixed seed (Jungle start)" map above, and places the player on a medium sized map. Like the Caulixtla map and other Fixed seed, this seed will always generate the same map.

None of the fixed seed maps will be generated if selecting "Large start continents", "Small start continents", "Random", or free form maps. In addition, the free form maps will never generate a map from the "Large start continents", "Small start continents", and "Random" list of maps.

Player bonus resources
If playing at a harder difficulty, or if simply wanting to play an easier game, it may be desirable to have more resources at one's starting location. There are a large number of levels of bouns resources placed in the player's start.

This allows one to have more starting resources without having to regenerate the map until one has the desired quantity of starting resources.

Hut placement
This determines how goody huts are placed on the map. "Civ4 default" just uses Civ4's default hut placement code; note that a given map seed will have different hut placements every time a map is generated. In other words, if using "Civ4 default" and one of the fixed seeds, the huts will still vary their location every time the map is generated.

"No huts" simply does not put any goody huts on the map. This is the behavior the original "Legends of Ancient Arabia" has with its default map.

"Fixed huts per seed" places a reasonable number of huts on the map. A given map seed will always have the same locations for goody huts.

"Huts are rare" makes huts very uncommon. A given map seed will always have the same locations for huts.

"Many desert huts" places a large number of goody huts in deserts. A given map seed will have the same hut locations.

"Many huts everywhere" has many goody huts all over the map. A given map seed will have the same hut locations.
 

Attachments

  • ArabianTotestra.zip
    56.1 KB · Views: 41
Tell me, why is totestra, if we talk about the quality of generation, better than the PerfectMongoose script? Well, apart from the Arabic theme, of course
 
The current version of Totestra, as available in the very first post in this thread, generates the same maps Perfect World 2 generates for a given seed, except that the coastline mountain bug has been fixed.

ArabianTotestra above is only for people who want an Arabian themed PerfectWorld2 map.

The only differences and possible improvement over PerfectMongoose 3.2 (PerfectMongoose 4 only works with the now-abadoned without source code Mongoose mod) is that the seaside impassible mountains bug has been fixed, and Totestra has support for larger maps than PM 3.2. I have no problem with people using PerfectMongoose 3.2; indeed, let me attach a copy of that script right here, since it can be a bit hard to find.
 

Attachments

  • LM_PerfectMongoose_3.2.zip
    47.9 KB · Views: 59
Last edited:
I am using Neoteric World mod and it seems when using any resource options "Perfect world-like", "spread evenly", and "lots of resources" the map will often spawn tons of the same resource in the same area (happens with the old version of this map script too)
(screenshots are with "spread evenly" option. With "perfect world-like" and "lots of resources" it is even more sever)
Civ4ScreenShot0099.JPG
Civ4ScreenShot0100.JPG

Civ4ScreenShot0098.JPG


Edit: Okay I made coding changes to everything I wanted except the resource bug is still there. Here are my other edits to result in this screenshot for anyone else interested. But could not fix the bonuses bug:
Civ4ScreenShot0102.JPG


Line 192
Python:
self.landPercent = 0.40
(lower sea level)

Line 208
Python:
self.PeakPercent = 0.22
(more peaks)

Line 224
Python:
self.DesertPercent = 0.06
(less desert)

Line 229
Python:
self.PlainsPercent = 0.32
(Less plains so that there is more grassland leading into the center and not just have the center as one big plainsland)

Line 288
Code:
self.RiverThreshold = 3
(more rivers so more civs can spawn inland since there will be less desert inland now)

Line 470
Python:
self.CoastalCityValueBonus = 0.2
(more civs spawn inland)

Line 474
Python:
self.RiverCityValueBonus = 1.5
(civs spawn at the more available rivers inland)

Line 2320
Python:
if allPeaks == True or peakCount>6 or nextToOcean == True:
(mountain peaks allowed to be bigger clusters)

However the varies bonus values don't affect the spawning in any noticeable way (I changed them all over the place).
It also seems that the code beginning at
Line 4009
Python:
#Make sure there are no bonuses of the same type nearby:
is not working for some reason, must be something to do with neoteric world added resources somehow, but affects vanilla resources too. Any ideas?
 
Last edited:
However the varies bonus values don't affect the spawning in any noticeable way (I changed them all over the place).
It also seems that the code beginning at
Line 4009
Python:
#Make sure there are no bonuses of the same type nearby:
is not working for some reason, must be something to do with neoteric world added resources somehow, but affects vanilla resources too. Any ideas?
I think that only applies to resources with a UniqueRange set in XML. The Wine and Ivory in your screenshots don't have that. On the contrary, they get placed in groups. They're also restricted to a single landmass. Not sure if this problem is specific to Totestra. Here are some screenshots from a Huge Fractal map:
Spoiler :

fractal-huge-18civs.jpg

The Totestra BonusPlacer is largely a reimplementation of the resource placement code in the DLL (CvMapGenerator.cpp). You could try reducing iGroupRand in Civ4BonusInfos.xml and, possibly, increasing iGroupRange to 2, meaning that groups get spread over a 5x5 square instead of 3x3 – should then decrease iGroupRand by at least a factor of 9/25. Also, setting bArea to 0 for some resources could help, e.g. for Fur, Gems, Gold, Silver, which, in reality, aren't restricted to a single landmass at all.
 
Perfect, thanks again. Works now when used with the "like perfect world" option (other options will still cause this issue but I'll never use them now anyway).
 
HOLD UP!!! This map generates a GLOBE!!?!?!? When choosing the toroidal option this map is a sphere! My god this changes everything!
Civ4ScreenShot0117.JPG


Trying to remove the ice from the edge doesn't seem to be working. These values set to 0 don't remove them.
Python:
self.iceChance = 1.0
self.iceRange = 4

Cool that submarines will be more useful now to get through that ice, but would be nice to have a way to remove it as an option too. But wow, I didn't think this was possible.
 
Last edited:
Isn't that how Toroid always works, world-wrap at all map edges? I guess the Firaxis scripts don't place land at the poles, so you don't get a proper Antarctica with them ...
And if you comment out the call to createIce (in addFeatures)?
 
Isn't that how Toroid always works, world-wrap at all map edges? I guess the Firaxis scripts don't place land at the poles, so you don't get a proper Antarctica with them ...
And if you comment out the call to createIce (in addFeatures)?
I never knew a civ4 map could be a sphere
Spoiler Nvm. The custom game menu unselects the map if any changes get made to it's coding. :

It still creates the single line of ice at the pole. I guess createice() is just in addition to that dividing line of ice at the pole.

Vanilla Civ4 has this comment in the CvMapGeneratorUtil.py:

Code:
The Polar flag causes a maximum "height value" to be returned for any coordinates
with a zero component. (0,0 or 0,15 or 71,0 - for instance.) This can cause
problems for terrain and features on maps that put land plots in the zero row
or column. This will also cause a problem for any fractal region you generate.
I've included shortcuts for typical uses, but you may need to customize the flags
for some purposes. PlotFlags and TerrainFlags give you full control.
Hopefully the author of this mod has a desire to add a "no ice at poles" option, or something like that.


Civ4ScreenShot0122.JPG


Commenting out createIce() on line 5812 works :D
 
Last edited:
Is it just in my games or has the totestra way too less resources?
Even when I choose "Full of Ressources" there doesnt appear more Ressources.
 
Is it just in my games or has the totestra way too less resources?
Even when I choose "Full of Ressources" there doesnt appear more Ressources.
Sorry for the two year wait for a reply. I have found it generates far less resources now. Food is a problem often. It is a matter of tweaking values now. I've been out of civ modding for so long I cannot remember how to do any of this now. Maaaaybe I'll take a crack at it again over the next two months. (it also seems to spawn diamonds a lot). At least it is still playable as it is in the meantime.

Use "Like Perfect World"
 
Last edited:
Thank you very much for that reply.
It Was only 3 weeks wait for the reply ;)
WAIT! It turns out I had made those edits for "Like perfect world"! like perfect world has better resource spawn.
 
Last edited:
Top Bottom