Sirian's Map Info Reference

davbenbak said:
Hopefully my question is not a technical as some of the others. Is there an easy way to delete either units or cities from a map? We all make mistakes right? I sure liked the map editor in Civ3 where I was prompted as to which features of a plot I wanted to delete (units, resource, city, etc.) Is there an "undo" button/option?

My Map Viewer/Editor MapView might be something that couzld please you. I´ve to admit that cities and unit´s aren´t supported yet, featuress like oasis and ice neither but you can do pretty much with it already, especially when it comes to deleting or editing/adding specific categories of a plot, like resources, features, roads or just change terrain etc.

 
Sirian,

I've been trying to generate rivers on my map script which features mountain ranges. The problem with the default implementation include rivers corssing mountain ranges and taking long detours through icy terrains.

From what I understood, the getRiverAltitude global function can control the altitude which is considered by an algorithm I do not control in order to determine the flow of rivers. If I understand correctly, that algorithm spawns a river start and tries to reach the sea from there. This is not what I'd like, since I believe such an algorithm provides inherently wrong river systems when there are mountain ranges. It will create rivers which go either along the range or which will come perpendicularly to it, look stuck, and go through.

I'd like to create a map script where I tell the rivers where they end (thus start from the sea) and then move up until I find something interesting, like a lake, hill or mountain, or a terrai where the altitude is at its maximum. This would create shorter rivers with much more realistic behaviour around mountain ranges. At least, I hope so. But I don't know where to start in order to do so. Is it feasible, and how?
 
LDiCesare said:
Sirian,

I'd like to create a map script where I tell the rivers where they end (thus start from the sea) and then move up until I find something interesting, like a lake, hill or mountain, or a terrai where the altitude is at its maximum. This would create shorter rivers with much more realistic behaviour...

You can manually place rivers any way you please. You need to give each one its own RiverID number, or it won't work correctly. This is especially true if combining hand-placed rivers with ones generated by the default process.

It may also be necessary (I don't think so, but this is the worst case) for you to determine the path of the river first, working backward, then actually place the river segments working forward. That would be what to try if placing backward doesn't work out correctly.

You probably have everything you need by examining the Mississippi River creation in Great Plains along with the river creations in Oasis. Those are the instances where I generated my own rivers.

Let me also tell you that BY FAR, rivers gave me more headache than anything else involved with map scripting. I think we got things opened enough to make it possible to do just about anything now, though.


I downloaded v2 of Tectonics the other day. I haven't tried it out, but I looked at the code briefly. It does look like a promising alternative to the Civ3 Fractal Generator as a basis for creating terrain.

Plates are a funny thing, though. I don't think all of your assumptions match the real world behavior of plates (for instance, the meeting of two plates in the Indian Ocean, at ground zero for last year's massive tsunami, doesn't seem to be modeled. Or maybe I didn't examine it closely enough). There is also the problem that realistic is usually unbalanced: massive deserts or jungles or plains, almost monochromatic terrain in huge areas. I purposely moved terrain generation away from larger patches of terrain types because it turned out to be quite unintersting to play with city after city with 21 grass plots, for instance.

The "wind" and rainfall looked like a promising element, though. Although, things like hurricanes can defy such models, and yet make a big difference to climate and terrain.

If I get the opportunity, it might be fun to put some work in to experimental models for different ways to generate terrain. One thing that bugs me is that the Continents map type (the basic fractal map) has nothing resembling volcanic islands, archipelago regions, or small irregularities along coasts. I was very happy with the way Pangaea turned out. I really like having a few small islands off the coast now and then, or some snaky peninsulas or various inland seas, which we don't get from the core fractal. Islands and Custom Continents are the closest I came to successfully mixing large and small bodies of land, and I'd like to do more in that direction. Your plate work doesn't seem to generate small landmasses, though. Or does it?

Maybe you could do a sampler similar to what I did for my map reference, so we could see what kinds of lands your script generates? Visuals might help attract more folks to the script, too.


- Sirian
 
Hi Sirian, thanks for the answer.
The tectonics simulation is very crude. I didn't add code to create hot spots like Hawaii. When plates meet I decide either they go towards each other or not, and if they do, they either collide (both raise) or there is subduction (one rises). It's very crude, as I know subduction can cause the creation of islands on the plate going down a bit back from the meeting line, but my goal was to get mountain ranges.
There are sometimes small islands generated, particularly at the meeting of two or three sea plates, or if you happen to have a land seed totally surrounded by water seeds. The map is very very random.
The climate generation is not very good as the desert stripes are too predictable. The wind etc doesn't give me enough prairies either.
I'll try to upload some more pictures too.
 
I updated my script to include new river generation system. The script I wrote is really ugly but I understand why it took you the most time to get rivers to flow correctly. The choice of west of river/north of river gave me a headache (so when I am north of a river, I want to check the 4 plots around the beginning of the river and that's getWE or getNS api and ... arghh. If I ever finish Clash I won't code rivers as a part of a northern or western square. Don't know how, but there must be something simpler.
I also updated the forum threads here and on apolyton to include some more screenshots. It's a bit hard to see the mountains, but you can see the islands and continents fairly well.
 
I'm curious to hear your response to the rather widespread claims that "random map generation" is something of a false phrase, and that in fact civ 4 basically picks pre designed maps at random from a list.

I'm not sure how I feel about these claims yet as civ IV blue screens and crashes too often to play enough to find out.
 
Sirian, I'm working on a map script and am having a small problem. I have set up the map so that it is all land. I have defined my own AddLakes() so that the map generator doesn't add in any random lakes. The problem I am having is that a one-tile lake is being created to the north of each players starting plot whenever the starting plot does not have a river right next to it.

Is there an additional function that I need to override to prevent this from happening?

Also, where can I get a list of all of the functions that the map generator will automatically use from the map script? I have found many of the functions in the map scripts, but there are probably more. It would be helpful to have a complete list.
 
tywiggins said:
Sirian, I'm working on a map script and am having a small problem. I have set up the map so that it is all land. I have defined my own AddLakes() so that the map generator doesn't add in any random lakes. The problem I am having is that a one-tile lake is being created to the north of each players starting plot whenever the starting plot does not have a river right next to it.

Is there an additional function that I need to override to prevent this from happening?

normalizeAddLakes()

You need to override that function to stop the default behavior. While you are there, you probably also need to override this one too:

normalizeAddRiver()


Also, where can I get a list of all of the functions that the map generator will automatically use from the map script?

./Civilization 4/Assets/Python/EntryPoints/CivMapScriptInterface.py

Anything from that list not overridden has some sort of default operation.


- Sirian
 
iSkratch said:
I'm curious to hear your response to the rather widespread claims that "random map generation" is something of a false phrase, and that in fact civ 4 basically picks pre designed maps at random from a list.

There was a bug that reset the random map seed (by mistake, obviously) and so would cause the map generator to produce certain maps (made from certain seeds) over and over for those experiencing the bug.

The map generator produces maps based off the same PRNG (pseudo random number generator) that everything else in the game uses. Given the same seed, it will produce the same map again.

The seeds are not supposed to repeat, but something was causing them to reset back to the beginning of the PRNG seed sequence. That bug is supposed to have been found and fixed as of v1.52 so it should not be a problem any more.

This was never a problem with the map generator, by the way. My map work was catching the blame, but the bug affecting the seeds was coming from somewhere else.


The map generation code is no secret, however. You don't have to take my word for it. Open the code and look for yourself. The map scripts are here:

./Civilization 4/PublicMaps/

The Entry Point file is here:

./Civilization 4/Assets/Python/EntryPoints/CvMapScriptInterface.py

The map utility file is here:

./Civilization 4/Assets/Python/CvMapGeneratorUtil.py

What you see is what you get. Go ahead and look for yourself. :)


- Sirian


PS: you can manually force a given seed by setting a certain switch in the Civ4.ini file to something other than 0. Then you can see that the map generator will produce identical maps from identical seeds, no matter what that seed happens to be! Remember to change it back to 0, though, so that random map generation will resume.
 
I'm going to bang my head for not remembering the CvMapScriptInterface.py myself in the first place. I had read it and forgotten it when I started my map. Grrr.
One question, though, it appears that the sequence is:
1)generateRandomMap actually calls
1.1)generatePlotTypes
1.2)generateTerrain
2)addRivers
3)addLakes
4)addFeatures
5)addBonuses
6)addGoodies
Apart from using one function to do something different from what it names implies, is there a way of reordering data? Like setting terrain after rivers have been generated?
Incidentally, I do not know how flood plains are determined, whether all desert + river are flood plains or not, and if that's not the case, when is the change made? For instance, is it possible to have desert (not flood plains) by a river?
Now back to banging my head.
 
LDiCesare said:
A. Apart from using one function to do something different from what it names implies, is there a way of reordering data? Like setting terrain after rivers have been generated?

B. I do not know how flood plains are determined, whether all desert + river are flood plains or not, and if that's not the case, when is the change made?


A. You can do anything you like whenever you like, unless you are calling on data that hasn't been generated yet or passing back mismatched information compared to what the Return call is expecting.

B. Flood Plains are a Feature and are processed with the rest of the Features. (You can change how they are handled. For instance, there is different Flood Plains behavior with the Fantasy Realm map script, if the support necessary to release that map ever makes it in.)


- Sirian
 
That's odd... I only did a minor edit of the Terrain Generator class of the Python map generator, and now it says there's a problem with CvEventInterface?

Oh, well... That'll teach me to make backups... And now to reinstall...
 
hi Sirian!

I try to create a process that generate resources in random maps.And i want to know if it's possible to override the values in the 'CIV4BonusInfos.xml' directly in the .py file ???

I've tried to create a worker in the random map and that does nothing.

but is it possible to add an unit or a barbarian city in a random map ?


Many thanks for all note in the files .This is helpfull !!

I've done some changes in your maps and create a little map :

http://forums.civfanatics.com/showthread.php?t=151629
 
Where would be the best place to add post-generation custom features to the terrain?

I'd like to pick one random point on the map (within 0.8 latitude), and increase the height of all the terrain at a distance X by one level (hills to mountains, ocean to coast, etc) to simulate a crater. I havn't exactly figured out where to put this, although I have a general idea of where the plot selection goes on.
 
Hi!

I achieve to put units,barbarian cities and bonus resources (without being normalized) in the random map generator ,adding them in the function:
- def startHumansOnSameTile()

But this fonction seems to be call two times ,if i put a worker or a resource ,this will appear two times !
I resolve this with a global variable but 'startHumansOnSameTile()' is realy called two times or did i make a mistake ?

I also try to open a window during the map generation to allow the player to define lots of settings. I can open a pop up!but the generation of the map still continue and i can't use function to get popup's entries. I wonder if it's possible?

hi Thalassicus, perhaps you will found the answer of your question by reading
the 'def addFeatures()' in the file 'Archipelago.py' wich replace Peak along the Coast !

thanks ! bye !
 
Is there any way to disable the generation of a certain type of terrain? I'm trying to remove plains and forests from maps and after tweaking CvMapGeneratorUtil.py it worked for the most part except around the starting locations for each civ. This is probably because of the normalizing functions (addgoodterrain, removebadterrain, etc). Is there any way to override these functions without tweaking each and every map script located in the publicmaps folder? In other words, where are the normalize functions located, or is it to be left for the SDK?
 
Termite: the normalize functions are handled in C++. You can override them, but yes it's work for every map script. I'm not sure if you'll be able to mess with them or not, after the SDK, but I'd guess yes.


Thalassicus: The best place to mess with plot types (heights -- water/flat/hill/peak) is at the front of the terrain generator function. See Mirror or Pangaea for examples.


Sto: AfterGeneration() would be better than StartHumansOnSameTile() -- check the Entry Points file under the Python Assets for more about where to best put which operations.


- Sirian
 
I'm overriding getRiverAltitude and returning an integer in the range 0 .. 1000. Does this method care and/or is this method sensitive to the range of values returned? What does the default implementation return? Mine seems to work, mostly, though it picks a few paths that surprise me.

As an aside, I was thinking that a marvelous debugging tool would be to have a method in python to be called with each plot on the map and returning a string, which would be printed hovering over that plot in the display. Map scripting people could use it to debug things more visually (I could immediately see if the rivers are actually flowing downhill or not), and I can think of a variety of other uses. Does such a thing exist already (I haven't found it yet)?
 
surt said:
I'm overriding getRiverAltitude and returning an integer in the range 0 .. 1000.

That will work OK.


it picks a few paths that surprise me.

The value you return is added to terrain heights. The intended result is a combination of "tilting" the river to flow in a certain direction while still having its path affected by the local terrain.


Does such a thing exist already (I haven't found it yet)?

No. However, what does exist is that Print commands output to a debug file. I found that to be all I needed in debugging my scripts. If you think map tags for display in-game would help you, though, I don't see why it couldn't be done.


- Sirian
 
Top Bottom