AssignStartingPlots defaults for VP

tu_79

Deity
Joined
Feb 11, 2016
Messages
7,376
Location
Malaga (Spain)
We've included some exclusive features of our map script, communitu_79a, into vp by accident, but now that we're at it, let's discuss how resource distribution should look like for an interesting and balanced gameplay.

Let me show what can be modified:

1 There's an initial basic resource spawn around capitals, with a few horses and some bonus resources. This has not been changed much.

2. Then there's a general resource distribution around the whole map. Each bonus and strategic resource is placed with a frequency (every x tiles in map), an amount (for strategics), a location where it can spawn, and the minimum distance allowed from other resource of the same kind.
For example, currently horses are generated in grassland with a frequency of 32, an amount of 2 to 4 units per resource in the standard distribution, and a minimum distance between horses of 1 or 2 tiles (decided randomly).

3. Finally, there's a guaranteed minimum of sttategics per player. For example, there's a guaranteed minimum of 4 horses per player. Usually the mapscript produces more horses per player, but if by chance there is not enough, then it spawn a few more.

Beware that though the frequency of a resource might look high, if the terrain is rare then there will not be many of said resources. Example, giving iron to snow tiles with a low frequency (every 20 tiles) might give zero iron if there's not enough snow tiles (if less than 20 tiles are snow).

So far, you've noticed a few changes from vanilla. Horses can spawn in flooding plains and in tundra, and they can be adjacent to other horsies in such climates. Stones can spawn in hills. There's more bison and fewer sheep. There's more deer in boreal forest.
You've also noticed how reducing the minimum distance between same resources produces map clusters. A note on distances: there are two values. For example, if we place horses with a 1,1 distance, then all horses will be at least 1 tile apart from each other. If they are 1,2 distance, then half the horses will be at least 1 tile apart and the other half will be 2 tiles apart from each other. Being at 0, 3 means that 25% of the horses can be adjacent to others, 25% must be at least 1 tile apart, and so forth. This rule only applies to the horses generated by the general map creation.

So, let's hear your thoughts on what this should look like.
 
I will note my comments from playing on Communitas_79 for a while now, which I believe has been operating under these changes for that time.

1) Stones on hill are fine by me. The bison and sheep numbers have also been fine personally. Sometimes I hate the horses spoiling my flood plain triangles, sometimes I like making a solid food and production tile with them, so again I'm "meh" on that.

2) Sometimes you get a LOT of camp resources in an area, like Goddess of the Hunt wet dream amounts. I do like that most tundra areas I've seen have a good amount of deer, making them workable.

3) I do find that the strategic clustering seems a bit strong. There are many a game where I will have 0 oil and coal, and more aluminum than I will ever use (I had 30 in my last game, from having just one continent). I don't mind some clustering, but I think that could be reduced a tad.
 
Here are just my thoughts about the changes.

First, more Horses can directly impacts many others things. Fealty boosts Pastures so that's one thing to be aware of. Open Sky Belief gets buffed if you get more Pastures, especially near your capital. Polish Ducal Stables gets a pretty big buff too.

Secondly, Stone on hill will affect Inca the most as there might be fewer Hill for their UI. Maybe fewer Sheep will break even but we'll see how this works out.

Thirdly, more Deer in boreal forest can not only affect something like Goddess of the Hunt but also starting location. Does this make Tundra more powerful due to the amount of food the player/AI has just from research Trapping?

Fourth, the clustering feels like something a human player can better take advantage of. Not sure how the AI deal with this though. In addition, it makes city settling locations too obvious. There should be hard decisions as to whether to grab this or that as opposed to everything conveniently at one location for a single city.

Just some thoughts. I don't know fixes but I'd like these things addressed while trying to determine what's considered balanced.
 
1. Stone on hills:
It ends up being a better variation of a mine. So it's a buff to production on hills, which I don't think is needed. It does make real life sense though. the idea that stone only appears on flat land surely isn't realistic. My games have seen snow that is just littered with stone (enough to get 6 copies in one city).

2. Bananas on Marsh:
This is new and it's fine. Marsh could use a little love.

3. Horses on Desert and Tundra
My first complain is realism, but I see the gameplay counterargument. Maybe we could limit these stacks to just 2 horses as a compromise?
Either way, there is an unintentional large increase in the number of horses which makes evaluating this harder.

4. Clustering
New clustering for bonus resources is great. It leads to specialized cities and helps out a few mediocre pantheons. I'm happy to say I like it.

Strategic resources should not be clustered though. IDK the values but I really think whatever was spreading them out before did a good job. Even if we add the resources to new terrain types, I hope the spread of those resources is similar to that distribution. I don't want 17 horses in 4 cities.

Thirdly, more Deer in boreal forest can not only affect something like Goddess of the Hunt but also starting location. Does this make Tundra more powerful due to the amount of food the player/AI has just from research Trapping?
I had a capital this patch with 15 Spirit of the Stars and Sky resources LOL

For example, currently horses are generated in grassland with a frequency of 32, an amount of 2 to 4 units per resource in the standard distribution, and a minimum distance between horses of 1 or 2 tiles (decided randomly).
I want to note that I've seen several stacks of horses with 5 units this patch. I think 2 or 4 is the ideal.
 
3. Finally, there's a guaranteed minimum of sttategics per player. For example, there's a guaranteed minimum of 4 horses per player. Usually the mapscript produces more horses per player, but if by chance there is not enough, then it spawn a few more.

Could there maybe be a guaranteed maximum of strategics per player too? It would require randomly deleting strategics until you got under the limit, I'm not sure how feasible that is. But a bloat of strategics in some ways can be just as bad as a deficit.

I am largely agnostic to resource clustering and bonus resource placement, though the current setup with superclusters occurring is good for Spain, bad for border-expanding civs, and probably slightly bad for Tradition. For my part I think tundra sucks and would welcome horses on tundra and stone on tundra hills, but I don't think other terrains (except snow I guess) need any buffs. Extra bonuses on marshes, deserts, and stone on non-tundra hills seem unnecessary.
 
I don't know how to remove resources once spawn, so I think the better way to prevent excessive resources is by using higher amplitudes, this is, placing fewer resources with the general method.

I agree horses are a bit too much. The clustering around cities can be prevented by setting a larger minimum spawn distance. I think they are realistic and useful in tundra (deer provide food, but it needs still some production), but I'm finding them troublesome in flooding plains, especially when they occur so often that they ruin my farm clusters. First thing I would do is to raise the amplitude for flooding plains horses to 70, the same as in tundra.
Next thing would be to forbid adjacency to any strategic resource. Note that some adjacency might still occur if the resource is placed with the last function.

About hills, yes, stones are supposed to counter balance the fewer sheep (they were too much, imo), but I wasn't sure if the result was balanced for lack of testing. Besides, stones and bison were rare in vanilla. Again, this isn't fixed in stone. If you dislike stones on hills, I'll try to move that just for our map.

I'll be open to suggestions for a couple of days more before making the changes and will share the new lua hopefully before this weekend.
 
I'd like to see:

No or less horses on Tundra. Tundra has lots of strategics already, it doesn't need horses as well. Horses also don't live in that area naturally. Forest, and stone are better ways of giving production to Tundra IMO.
Fewer desert horses. I love some horses, but there are too many currently. Horses are one of the main attractions of plains and grassland and it should stay that way.
Minimum distance between horses = 1. I don't think having strategic resources adjacent to one another is balanced. Much better if they are spread out. While we're on the subject, sources of iron shouldn't be adjacent to each other either.

No or less stone on plains. The main reason stone exists is so that hammer-poor areas such as grassland and desert can compete. Plains don't need it - it's overkill. I would much rather see wheat, bison, or horses here.
No or less stone on hills. Hills are literally made of stone, and mines do nothing but provide production. Makes zero sense for them to get an extra boost IMO.
Less stone in snow. This one isn't a big deal, but it feels like there is too much at the moment.
Remember that stone provides a 10% bonus to wonder production for early-game wonders. It's intended to stand out. At the moment stone is everywhere. If every other city has that 10% bonus, what is the point of having it?

I don't understand where the sense of having too much sheep is coming from and I'd like some of them back. Especially now pastures have been buffed and sheep got an extra buff on top of that. I want wool for my hill-folk to keep warm lol. I get that the inca like to have terrace farms on their hills, but sheep only exist on one type of terrain - there just aren't that many of them on a map. Also, not related to the core game but I like that Events for VP gives the Inca a buff on sheep tiles which helps them feel like a bonus rather than a nuisance.

On the subject of resource clustering in general: I understand that farm triangles are nice and some UIs benefit from adjacency but other UIs work the other way around: I can't place my Encampments or my Chateaus adjacent to one another and I don't want all the resources in one spot. Same goes for villages.
I want to note that I've seen several stacks of horses with 5 units this patch. I think 2 or 4 is the ideal.

I think this is a good point. I like having 3 horses sometimes - feels more natural than them always being 2 or 4. But 5 horses is too much for one tile, particularly with how much money you can make from selling strategics.
 
Last edited:
I wish that it would be possible to select options for generating resources.
I like games more , where there is no strategic balance and dislike that every player have the same guaranteed resources.
I have tried "sparse" , but even than there are everywhere clusters of iron or horses.
I play allways on huge maps , marathon speed.
I would like to have , for example ,. no iron in my empire , so that i have to conquer another player ground to get it.
 
I think the numbers of Bison are too high. It was an uncommon resource introduced in a DLC but now they are everywhere in huge clusters. Besides feeling weird to me this throws off balance for Goddess of the Hunt which was a good pickup for camp luxury starts or forested Tundra.
Spoiler Bison Spawn :
bis.png

As for marsh bananas I did not like them because of sightings such as the one below, which could be why civ 5 devs did not have them spawn that way in vanilla. Though checking for latitude is possible. Simply spawning them on marsh makes sense for communitas or africa maps because these maps only create warm marshes.
Spoiler Arctic Bananas :
20200902170936_1.jpg

For Desert horses I have no Strong feelings, I feel that they should be quite rare thematically though.
Stone on Hills I don't find particularly disruptive either, so far at least, though maybe there should be way less of it and more sheep.

As for strategics, I probably need more games on this patch to tell for sure, but I feel that I liked the old distribution more, it gave me games where I'd have to get creative to secure the Strategics I needed. Now Iron in particular seems to be handed rather liberally so far. There's also a bit too much oil found on jungle. Among other things, I just really liked (got used?) to the old way of seeing resources, would not mind just reverting back to it.
 
Last edited:
About reversing everything.
We played with the resources as a given because Gazebo didn't want to mess with maps. CrazyG was right in that we discuss every change, except when the change is something devs find really worthy. This is not something that should be forced, but at the same time it's something we can modify intentionally, both for gameplay and taste, instead of accepting the old distribution just because.
The code has also a couple of improvements that prevent overflowing, so even if we end up with something very similar to the original distribution it would be worthy.

I understand that right now the changes are quite radical and many things must be tempered, but there must be something that we might like more than before.

So far most of the critics are very constructive. I'm thrilled.
 
I thought it might be worth briefly touching on the things I like about the change, for the sake of keeping some of the changes.

I only just noticed that jungle now sometimes occurs on grassland which is cool! I like that desert in general feels less barren and that desert cities are stronger. I also like that tundra starts feel a bit stronger, and that there are more camp resources. Hunt felt very situational in the past - tundra specific really. Now I feel that if I get Furs in the Jungle or plains Ivory, Hunt is still a useful option and actually quite strong. Generally speaking, I like bison. I do agree there are a lot of bison at the moment though, so a few less would make sense. I like that there is some stone on snow because sometimes there are lots of strategic resources there and I'd rather not have those cities just act as a happiness trap. Snow being less terrible also makes tundra starts with lots of snow around slightly less painful. I like marsh bananas in the tropics but I agree it is strange near tundra, so I understand if that is changed.

I'm also glad to have people who know how to work with this code so that we can adjust things if we want to. Before all of this I wouldn't have known where to start myself :).
 
Last edited:
I'm glad you all voiced your opinions about resource distribution. Feedback is very important for a better mod.

Clarifications
  • The minimum and maximum distances specified in a resource distribution create an area where no resource of the same type can spawn in. Valid types are strategic, luxury (minus marble), bonus, fish, city state, natural wonder, marble. There seems to be a sheep layer defined in the code comments, but it's not used at all. See also the Impact Table entry in the Terminologies below.
  • Real life horses do exist in tundra and desert, just in low amounts.
  • I have very little experience on "standard" maps like Continents and Pangaea. I don't recall the existence of seeing marsh near tundra, for example, or having so many flat grassland and plains plots (and few hills, mountains and lakes) on the map.
How resource distributions exactly work

Since there are confusions about how it works and what was changed in this version, I'll use my time to dig through the code and explain the whole thing (in detail) here. Luckily the script is well-documented (though a bit outdated on the details) so I don't have to dig VERY deep into it.

I'll go through everything I understand from reading AssignStartingPlots (and MapGenerator). I won't include luxury distribution which functions perfectly well and wasn't changed at all.

Terminologies:
  • Plot types: Mountain, Hills, Land, Ocean. They define the shape of a plot.
  • Terrain types: Grassland, Plains, Tundra, Desert, Snow, Coast, Ocean. MOUNTAIN and HILL are also defined, but they're not referred to in this. HILL is likely unused as it's not really a terrain in the game. Imagine them as textures on the plot graphics.
  • Feature types: Forest, Jungle, Marsh, Flood Plains, Oasis, Ice, Atoll, and No Feature. All Natural Wonders and Fallout are features too, but you can disregard them for this. They're extra sprites added on plots and provide a modifier to the plot yields.
  • Resource types: Each of the resources defined in the game, and a value for no resource. They're more extra sprites, but some combinations like Furs on hills don't look good and were forbidden.
  • Every plot consists of one of each above type. No exceptions.
  • Fertility: a value that measures the yields of plots. There are currently two different ways to calculate this.
  • Area/Landmass: a body of connected non-ocean plots surrounded by ocean. "Continent" is an ambiguous term so it's not used here.
  • Region: a rectangle of plots that maps to one major civ's starting location. Each area is divided into regions equal to the number of major civs spawning there. The division method is different depending on mapscript, but you can assume each region has roughly the same fertility.
  • Strategic deposit: a plot with a strategic resource
  • Major deposit: a strategic deposit with a higher amount, hardcoded in the script as uran_amt, horse_amt, oil_amt, iron_amt, coal_amt, alum_amt = 2, 4, 6, 4, 7, 7 for standard setting. I've added a 20% chance of spawning 20% more and 20% chance of spawning 20% less, for each deposit.
  • Minor deposit: a strategic deposit with a lower amount, hardcoded in the script as uran_amt, horse_amt, oil_amt, iron_amt, coal_amt, alum_amt = 1, 2, 2, 2, 2, 2.
  • Impact table: a multi-layered table of all map plots that serves as a banlist for resource placement. An impact placed on a plot on the strategic layer with radius 3 means no strategic resource can be placed anywhere within 3 tiles of the plot, if the impact table is checked before placement.
Resource placement in chronological order:

0. PlaceImpactAndRipples
This happens after all regions have been determined and during the determination of start locations.

For each start location determined, the following impacts are done:
  • Strategic layer with radius 0 (no strategic spawn on start location)
  • Luxury layer with radius 3 (all luxury spawns near start location are placed specifically later)
  • Bonus layer with radius 3 (all bonus resources near start location are placed by NormalizeStartLocation)
  • Fish layer with radius 3 (same as above)
  • Natural Wonders layer with radius 4 (no NW may spawn near start location, though this is further restricted later)
At the same time, the function also tries to prevent 2 major civs from starting too close to each other by decreasing the viability score of plots in a 8-tile radius from the determined start location, with a higher penalty towards closer plots.

1. NormalizeStartLocation
Note that no resource has been placed yet as of now. This function ignores the impact table.

Comment from dev:
This function measures the value of land in two rings around a given start location, primarily for the purpose of determining how much support the site requires in the form of Bonus Resources. Numerous assumptions are built into this operation that would need to be adjusted for any modifications to terrain or resources types and yields, or to game rules about rivers and other map elements. Nothing is hardcoded in a way that puts it out of the reach of modders, but any mods including changes to map elements may have a significant workload involved with rebalancing the start finder and the resource distribution to fit them properly to a mod's custom needs. I have labored to document every function and method in detail to make it as easy as possible to modify this system. -- Bob Thomas - April 15, 2010

First, it measures each type of land plots in two rings around each start location, then calculate production scores and food scores for turn 0 plots (first ring only) and early turn worked plots (it's assumed you don't work featureless hills).

Then, it adds strategic balance resources near the starting position, if the setting is on. The original way was adding 1 minor deposit of iron, horses and oil within 3 plots of each starting position. Now it adds 1 minor deposit of iron and horses 4-6 plots from each starting position (prioritize closer, strictly following terrain/feature rules (no forested horses!)), so you have to settle for them.

If early hammers will be too short, attempt to add a minor Horses or Iron deposit to second ring. This is a bad practice IMO (balance-wise and you won't reveal Iron on time) and I think it should be changed to Stone instead.

Next, according to the food scores, a different number of food bonus resources (Bison, Deer, Wheat, Sheep, Fish, Cattle, Banana) and/or Oasis (at most one) will spawn in the first three rings. Legendary Start gives two more bonus resources. Resource spawned depends on plot/terrain/feature type.

Lastly, add up to 2 Stone to random flat featureless grassland plots in the first two rings (prioritize first) if grassland count is high and plains count is low. It adds stone even if the start location is 90% grassland hills, so this could use some change.

2. AttemptToPlaceNaturalWonder
This is the function to attempt to place a specific Natural Wonder on the map. If successfully placed, the Natural Wonder would generate the following impacts:
  • Strategic layer with radius 1
  • Luxury layer with radius 1
  • Bonus layer with radius 1
  • City State layer with radius 1 (with fertility checks, City States won't spawn near Natural Wonders anyway in this version)
  • Marble layer with radius 1
  • Natural Wonders layer with radius (map height/5)
This is why there's never any resource around a Natural Wonder (fish excluded) and they never spawn near each other.

3. PlaceCityStates
This is the function to place City States on the map. For each successful City State placement, the following impacts are generated for the plot:
  • Strategic layer with radius 0 (no strategics on city tile to prevent blocking Mercantile luxury spawns)
  • Luxury layer with radius 3 (CS has a specific set of luxuries exclusive to them)
  • Bonus layer with radius 3 (placed by NormalizeCityState)
  • Fish layer with radius 3 (same as above)
  • Marble layer with radius 3 (they can't build wonders; don't waste Marble on them)
  • City State layer with radius 4 (minimum distance between CS)
4. PlaceStrategicAndBonusResources
The main thing! This places the majority of strategic and bonus resources on the map outside the three rings of major and minor civ starts. Luxuries have already been placed before this.

Resource settings:
Scarce: only 2/3 of resource deposits are placed on the map via this function
Abundant: 3/2 of resource deposits are placed on the map via this function
Random: the multiplier is logarithmically randomized between 2/3 and 3/2
Strategic and bonus resources have different random values.

ProcessResourceList:
This places major deposits of a specific resource on a specific plot/terrain/feature type with a specific frequency, and then places a randomized radius of impact (between a defined min and max radius) for the resource category on the plot.

For example:
Resource to be placed = horses
Plot list = featureless flat plains (with 300 plots on the map)
Frequency = 34 -> Number of plots = ceil(300/34) = 9
Impact = 1-2

It'll place 9 major deposits of horses (20%: 3, 60%: 4, 20%: 5 in standard resource setting) randomly on the map's featureless flat plains plots, while banning any more strategics to be placed in the 1-2 plot radius from the selected plots.

(Note that I've simplified the definition of the impact table. In reality impact values are not absolute, and lower impact plots can have resources placed if all plots in the plot list are impacted and there are still resources to be placed. That could happen if the impact radii are set too high, or the frequencies are set too low.)

Spoiler Detailed current strategic resource distribution list (ordered) :




4.1 AddModernMinorStrategicsToCityStates
For each city state, there's a 20% chance to place coal, 20% chance to place oil, and 20% chance to place aluminum. All are minor deposits and no impact is checked nor placed when placing these resources. These have also been changed to follow terrain rules.

4.2 PlaceSmallQuantitiesOfStrategics
Minor strategic deposits are scattered on the map, using the land plot list. The frequency is set to 160 times the number of major civs, that means for each player, every 160 land plots have a minor strategic deposit. (Wait, now that I think of it, this really shouldn't scale with number of players. Oops. Gotta change it to maybe 20 instead.)

If a land plot is selected to have a minor deposit, its plot/terrain/feature type is checked and a specific resource type is picked randomly for it.
Spoiler Minor deposit resource type chances :




Each resource placement also makes an impact with a radius of (0: 25%, 1: 50%, 2: 25%).

4.3 PlaceOilInTheSea
The final strategic placement is oil in the ocean. The planned amount of oil in the ocean is 50% of the oil on land, of which half is placed as 3-nodes and the other half is placed as 2-nodes, and the number of deposits for each are capped at 20% of all coast plots. The 3-nodes place an impact of 4-7 radius while the 2-nodes place an impact of 2-4 radius.

4.4 Fallback plan if there's not enough strategics
There's a final final addition of strategic resources if the map has too few per player. The script adds minor deposits until it reaches the minimum amount required. The amounts per player are 4 Iron/Horses/Coal/Oil, 5 Aluminum and 2 Uranium.

4.5 PlaceFish
This places fish on 10% of coast tiles, with an impact of radius (0: 1/7, 1: 1/7, 2: 1/7, 3: 3/7, 4: 1/7). Unlike the Communitu_79a version, this doesn't check surrounding fertility and distance to land. Which is fine I guess, since the standard maps don't really plan to make habitable tiny islands.

4.6 PlaceSexyBonusAtCivStarts

Comment from dev:
This function will place a Bonus resource in the third ring around a Civ's start. The added Bonus is meant to make the start look more sexy, so to speak. Third-ring resources will take a long time to bring online, but will assist the site in the late game. Alternatively, it may assist a different city if another city is settled close enough to the capital and takes control of this tile.

This adds one Deer/Banana/Wheat/Sheep/Cattle to the third ring of every start location, according to region type. It ignores the impact table. Hills region gets a second sheep. If none of the third ring tiles satisfy terrain restrictions, it attempts to add a fish instead.

4.7 AddExtraBonusesToHillsRegions

Comment from dev:
Hills regions are very low on food, yet not deemed by the fertility measurements to be so. Spreading some food bonus around in these regions will help bring them up closer to par.

This calculates an "infertility quotient" from comparing the amount of hill/mountain tiles to flat grassland/plains tiles, which scales from 1 (flat grassland/plains more than or equal to hills/mountains) to 2 (all hills/mountains). Then, it adds bonus resources to the region as below (All frequencies are further divided by the infertility quotient):

Spoiler Hills region bonus resource list :


That's... a lot of sheep.

4.8 The remaining of bonus resources
Spoiler Detailed current bonus resource distribution list (ordered) :




5. NormalizeCityState
Similar to NormalizeStartLocation, but with different scoring and no addition of strategic resources or stone. I won't go into the details.

Extra: AdjustTiles
This fixes all the terrain issues with resources, mostly for luxuries.
  • Marsh and oasis are removed from mining/quarry luxuries. Originally this removed floodplains too, but it's just weird that the plot suddenly isn't flooding just because some gold is there.
  • Furs and ivory plots are flattened because they look bad with hills.
  • Add trees for tree luxuries and deer, except sugar, cinnamon and dyes that are also fine on marsh. Forests are always added for deer and furs, and also for other resources that are above the latitude of jungle spawns.
  • Remove trees and marsh on open land luxuries like perfume.
  • Change grassland incense to plains.
Extra 2:
Ancient ruins are placed after all of these, and then "continent type" is determined for every tile (only affects graphics).
 
Last edited:
What is the point to discuss all the parameters in the code and mess around with the mapscript? We have a well balanced script for continents and pangea: The old one. If you like to change it in the communitas map, do it and discuss as much as you like. But I would prefer if you let the old script as it has been before. It was much better then.
 
Very detailed indeed. I didn't suggest changing anything about resources around capitals since they looked fine.

Replacing the starting iron with a starting stone is risky, since it gives an edge to wonder building and it allows the stone building that trades production. If you know there's always some stone around, that can change the starting decisions very strongly. But you wouldn't rush iron only for a small iron deposit, would you?
 
What is the point to discuss all the parameters in the code and mess around with the mapscript? We have a well balanced script for continents and pangea: The old one. If you like to change it in the communitas map, do it and discuss as much as you like. But I would prefer if you let the old script as it has been before. It was much better then.
Don't worry. After we're done with it, the changes will not feel too different from vanilla. They are a bit radical now because they were intended only for our map.
 
Top Bottom