Just a query: have you managed to figure out how to allow AI players to recognise and utilise any terrain changes that are made/designed?
There's
good news and
bad news And then kind of
good news again.
Good news first: yes, of course, I figured out (a long time ago already) that AI players will use terrain based on the
land values. As a matter of fact, this was figured out by others before me (Dack especially), but I'm not taking the time, right now, to excavate the thread where they talked about it (probably the Terraform thread).
The
land value is a value computed for each map square, by CIV, upon generating a map when starting a new game. This computed value is either
0 (land
not usable to build a city), or any value in the range
8-15 (land usable to build a city).
This value
never changes after the game is started,
even if the player alters terrain using settlers (deforestation, swamp-draining, etc.).
In a CIV savegame,
the land values are stored in the .MAP file. There are actually
2 sets of land values in the .MAP file:
- First set is the initial land values, as computed by CIV at the beginning of the game
- Second set is the initial land values masked by cities' influence area; my guess is that this is the set that AI players are using in-game to actually build cities, to avoid building their cities to close to each other, but this has to be confirmed
The 2 sets I am talking about can be easily seen when
opening a .MAP file as a PIC image in JCivED, just as shown below:
Now, for the
bad news: I didn't figure out how CIV computed those land values. Actually, I tried to understand, by creating some plain Earth maps and analyzing what CIV did of them, but there was a random factor that I couldn't figure out yet...
So, sadly enough, as of version 0.0.9a
JCivED cannot compute those values for you as CIV would do.
The first final kind-of
good news is that with
JCivED 0.0.9a you can actually
manually edit those values:
- in the Map layers drop-down list, select Land values: the land values will appear as an overlay on the actual map as below:
- then select one the values next to the Map layers; this will act as a brush to paint the Land values layer:
- You can then modify the land values: as shown below, I modified 3 terrain that had value 0 (previously forests or swamps converted to plains by my settlers) and set their value to 14:
Of course, when designing a full map, this is very tedious... So here's teh second kind-of
good news: a tricky workaround to get CIV to compute those values for you:
- First, design your map terrain as you wish in JCivED, by editing an existing savegame
- Then, export your map as an Earth map (MAP.PIC format):
- Next, replace your original CIV's MAP.PIC with the one you just created (don't forget to backup your original file !!)
- Next, start up CIV and start an EARTH game
- Select any difficulty and Civ to start the game, and skip 1 turn so you can actually save your game
- Voila! CIV has computed all the land values for your custom map, and those values are available in your savegame's .MAP file
- Finally, simply replace your custom scenario's .MAP file with the one generated by CIV (only the .MAP file, not the .SVE, if you want to avoid dealing with cities, units, etc. !!)
Notes about this workaround:
-
I didn't test it myself, so there may be issues... For example, I foresee that if your original custom map has only ocean squares matching the hard-coded CIV starting positions, there could be an issue with all settlers starting in the water, and you may not be able to skip 1 turn in order to save your game...
- From my experience, the
special resources will affect the land values; since special resources are controlled by the game's
random seed, and the random seed in defined by CIV when starting a new EARTH game, this may differ from your original custom map's random seed, and thus the land values will not be exactly accurate... But it should be good enough for the AI players to work nicely, and if you want to be perfectly accurate, just replace your custom savegame's random seed with the one generated by CIV
Hope this will help, until CIV's algorithm is actually deciphered !