Communitas map script

That is some seriously good work.:goodjob:

How hard would it be to make oases only appear if surrounded by desert?

It really wouldn't be much of a oasis if it was next to a floodplain or river.;)

Only surrounded by featureless desert? It would be extremely simple to do so. That would remove both desert hills and flood plains, unless flood plains has it's own identifier in the code (it almost assuredly does). I guess the question remains, in what conditions should an oasis appear?
 
Adjacent to desert hills seems fine; adjacent to flood plains seems weird.

So I'd say: adjacent to flat desert or desert hills only, and not adjacent to another oasis.
 
I would add to the previously mentioned comments on the frequency of isles, that they should be toned down. They make coastal cities viable for sure, but with the religious pantheon that adds 2 culture and 2 faith to each they become very very powerful.
 
I'd say an oasis next to flood planes seems pretty realistic?

The flavorful idea of an oasis is that it is a rare source of water in a dry area with none.

Flood plains already have a lot of water supply, so a groundwater source there isnt' really very special.

Plus the gameplay goal of an oasis is to increase food in an area that doesn't have much; flood plains are already excellent tiles.

They make coastal cities viable for sure, but with the religious pantheon that adds 2 culture and 2 faith to each they become very very powerful.
I would suggest that the problem is then the belief, not the isles. They aren't great tiles by themselves.

Beliefs need to keep in mind that there is much less faith income than there was in GEM, and that BNW has much lower culture income.
 
5% hills feels very low to me. I started a game yesterday and found hardly any city locations with more than 2 hills in them. This results in a city surrounded by pretty much farms and lumber mills, and provides fewer interesting decisions. Hills tiles are the only tiles that can have mines, lumber mills, and farms (with fresh water) built on them, which usually allows a nice amount of customization.

Not having more than 2 mines also makes the game's production agonizingly slow compared to what I'm used to. Maybe I just got unlucky though.
 
5% hills feels very low to me. I started a game yesterday and found hardly any city locations with more than 2 hills in them. This results in a city surrounded by pretty much farms and lumber mills, and provides fewer interesting decisions. Hills tiles are the only tiles that can have mines, lumber mills, and farms (with fresh water) built on them, which usually allows a nice amount of customization.

Not having more than 2 mines also makes the game's production agonizingly slow compared to what I'm used to. Maybe I just got unlucky though.

Looking at the values it seems that hills make up on average around 11% of total land tiles. Where did you get 5% from?
 
5% is the number Thal claimed in the first page (under spoiler). 10-11% sounds more reasonable.
 
5% is the number Thal claimed in the first page (under spoiler). 10-11% sounds more reasonable.

Ah, I see. I'm probably wrong then and it is 5%


The flavorful idea of an oasis is that it is a rare source of water in a dry area with none.

Flood plains already have a lot of water supply, so a groundwater source there isnt' really very special.

Plus the gameplay goal of an oasis is to increase food in an area that doesn't have much; flood plains are already excellent tiles.

Well here's some code for that:

Spoiler :
Code:
function PlacePossibleOasis(plotX,plotY)
	local plot = Map.GetPlot(plotX,plotY)
	if not plot:IsHills() and not plot:IsMountain() and plot:GetTerrainType() == TerrainTypes.TERRAIN_DESERT and plot:GetFeatureType() == FeatureTypes.NO_FEATURE then
		
		local odds = 0
		
		for _, adjPlot in pairs(Plot_GetPlotsInCircle(plot, 1)) do
			if adjPlot:GetFeatureType() == FeatureTypes.FEATURE_OASIS then
				odds = -1
				break
			end
			
			odds = odds + 10 --default desert odds
			
			if adjPlot:GetTerrainType() ~= TerrainTypes.TERRAIN_DESERT then --penalty not desert
				odds = -1
				break
			elseif adjPlot:IsHills() then --penalty desert hill
				odds = odds - 10
			elseif adjPlot:GetFeatureType() ~= FeatureTypes.NO_FEATURE or adjPlot:IsMountain() then --penalty desert feature
				odds = -1
				break
			end
		end
		
		if odds > 0 then
			for _, adjPlot in pairs(Plot_GetPlotsInCircle(plot, 2)) do
				if adjPlot:GetFeatureType() == FeatureTypes.FEATURE_OASIS then
					odds = -1
					break
				end
			end
		end
		
		if odds >= Map.Rand(100, "PlacePossibleOasis - Lua") then
			plot:SetFeatureType(FeatureTypes.FEATURE_OASIS,-1)
		end
	end
end

For a tile to have a chance of having an oasis it must:

1) Not be on a hill/mountain
2) Be a desert
3) Have no features (actually now that I think about it, hills may not count as a feature)
4) Not have an oasis within two tiles
5) Be completely surrounded by featureless desert or desert hills

From there the actual chance of the oasis being placed is determined by it's adjacent tiles:
1) +10% chance if the tile is not a hill
 
@stackpointer

If you haven't already, you could make the changes in Thal's GitHub project and 'commit' them. Then if Thal likes what he sees he doesn't have to go through the rigmarole of coding it all over again.

If you don't want to do that I can do it for you.:)

I'm just trying to think of Thal. If he can keep his workload down all the better.:D
 
@stackpointer

If you haven't already, you could make the changes in Thal's GitHub project and 'commit' them. Then if Thal likes what he sees he doesn't have to go through the rigmarole of coding it all over again.

If you don't want to do that I can do it for you.:)

I'm just trying to think of Thal. If he can keep his workload down all the better.:D

I've only used a VCS in a course several years ago so I'm not really familiar with git. I also wanted people's opinion on what conditions should or shouldn't trigger oases and at what percentages (thus the multiple copies of the same code). Otherwise, feel free to commit whatever changes you feel would be useful for Thal to look at.
 
I want terrain proportions close to standard maps. I listed some details in post #9. Continents Plus and Communitas maps have:

25% freshwater tiles

05% hills
30% flat grassland
25% flat plains
10% flat featureless desert
05% flat feature desert (oasis/floodplains)
10% flat tundra
03% snow

20% forest
10% jungle
03% marsh​

These proportions are all identical in both maps. I tuned this by generating dozens of maps with a short block of terrain-analyzing code to print out the percentage of each terrain, feature, and plot type. Features are oases, floodplains, forests, atolls, fallout, natural wonders, etc. I feel deserts with oases are more realistic than deserts with numerous rivers, but the overall percentage of feature tiles is the same.

If we reduce the proportion of features in deserts below 33%, it will change gameplay, making Arabia and desert religions less useful. We'd need to significantly alter the leader and other desert-related parts of the game to counteract any weakening to deserts. I don't want to make such a big change at the present time.

Civ 5 places bonus resources (like wheat) randomly without any attention to clustering. I estimate changing that to a better system would require 20-30 hours of work.

5% of land tiles are hills on each standard Civ 5 map type (Continents, Pangaea, and this map). These are numbers found by scanning the terrain of maps generated from each map script. I spent about 7 hours getting this map's percentages to match Continents Plus, which should fit, unless there is an error in the code I wrote to scan the terrain (below).

Code:
    -- Print percentages of each tile type
    local iW, iH = Map.GetGridSize();
    local plotTotals = {}
    local terrainTotals = {}
    local featureTotals = {}
    local freshwaterTotal = 0
    local landPlots = 0
    local totalPlots = 0
    
    for x=0, iW-1 do
        for y=0, iH-1 do
            plot = Map.GetPlot(x, y)
            local plotType = plot:GetPlotType()
            local terrainType = plot:GetTerrainType()
            local featureType = plot:GetFeatureType()
            
            plotTotals[plot:GetPlotType()] = (plotTotals[plot:GetPlotType()] or 0) + 1
            featureTotals[featureType] = (featureTotals[featureType] or 0) + 1
            freshwaterTotal = freshwaterTotal + (plot:IsFreshWater() and 1 or 0)
            
            if plotType == PlotTypes.PLOT_HILLS or plotType == PlotTypes.PLOT_MOUNTAINS then
                -- skip terrain, add only to plot
            elseif terrainType == TerrainTypes.TERRAIN_DESERT and featureType == FeatureTypes.FEATURE_FLOOD_PLAINS then
                -- skip terrain, add only to feature
            else
                terrainTotals[terrainType] = (terrainTotals[plot:GetTerrainType()] or 0) + 1
            end
            
            totalPlots = totalPlots + 1
            if plotType ~= PlotTypes.PLOT_OCEAN then
                landPlots = landPlots + 1
            end
        end
    end
    print("-");
    print("--- Table of Final Results, Tile Distribution ---");
    
    print("-");    
    print("- PLOTS -");    
    print(string.format("- %3s%% - %-s", math.floor(100 * ((plotTotals[PlotTypes.PLOT_HILLS] or 0) + (plotTotals[PlotTypes.PLOT_LAND] or 0)) / totalPlots), "LAND" ))
    print(string.format("- %3s%% - %-s", math.floor(100 * (terrainTotals[TerrainTypes.TERRAIN_COAST] or 0) / totalPlots), "COAST" ))
    print(string.format("- %3s%% - %-s", math.floor(100 * (terrainTotals[TerrainTypes.TERRAIN_OCEAN] or 0) / totalPlots), "OCEAN" ))
    
    print("-");
    print("- LAND TERRAIN -");    
    print(string.format("- %3s%% - %-s", math.floor(100 * freshwaterTotal / landPlots), "Freshwater"))
    print(string.format("- %3s%% - %-s", math.floor(100 * (featureTotals[FeatureTypes.FEATURE_FLOOD_PLAINS] or 0) / landPlots), "FLOOD_PLAINS" ))
    for terrainInfo in GameInfo.Terrains("Type IN ('TERRAIN_GRASS', 'TERRAIN_PLAINS', 'TERRAIN_DESERT', 'TERRAIN_TUNDRA', 'TERRAIN_SNOW')") do
        print(string.format("- %3s%% - %-s", math.floor(100 * (terrainTotals[terrainInfo.ID] or 0) / landPlots), string.gsub(terrainInfo.Type, "TERRAIN_", "") ))
    end
    print(string.format("- %3s%% - %-s", math.floor(100 * (plotTotals[PlotTypes.PLOT_HILLS] or 0) / totalPlots), "HILLS" ))
    print(string.format("- %3s%% - %-s", math.floor(100 * (plotTotals[PlotTypes.PLOT_MOUNTAIN] or 0) / totalPlots), "MOUNTAIN" ))
    
    print("-");
    print("- FEATURES -");
    for featureInfo in GameInfo.Features("Type IN ('FEATURE_JUNGLE', 'FEATURE_FOREST', 'FEATURE_MARSH', 'FEATURE_ATOLL', 'FEATURE_OASIS')") do
        if featureTotals[featureInfo.ID] and featureTotals[featureInfo.ID] > 2 then
            print(string.format( "- %3s%% - %-s", math.floor(100 * (featureTotals[featureInfo.ID] or 0) / landPlots), string.gsub(featureInfo.Type, "FEATURE_", "") ))
        end
    end
 
Okay, I trust you on that, but I really, really can't remember seeing so many oases on any of the vanilla maps.
 
It's basically a choice between oases or rivers in desert. I feel oases are more realistic for a desert. Vanilla deserts spawn many rivers instead. Imagine 2 giant vanilla rivers running through one of those deserts you see... now imagine taking that river and shattering it into dozens of tiny oasis tiles. That's what you're seeing. It's the same number of tiles with the rivers turned into oases. :)

It's a mostly cosmetic thing. From a gameplay perspective, oases are more scattered than floodplains, so it's harder to get multiple bonuses in one city. The tradeoff is we don't need to improve them. It's harder in some ways, easier in others.


-----------

PS rivers flowing with vanilla would be awesome!
 
Ah, I didn't realize that the placement of the oases was done purposely to improve desert starts. I guess that seems kind of obvious when you think about it.
 
We could set desert tiles around oases as floodplains, then make oases spawn 15% as often. This compromise would keep about one third of desert tiles valuable, while maintaining the realistic look of few rivers in deserts. I'm going to try it out. :)
 
Oasis were stacking in huge amounts per city (see the screenshots from earlier in the thread). I wouldn't mind there being more of them overall, if the trade off wasn't that they all end up in one area. Flood plains are probably better in most instances to use if that's what it is doing as the tile isn't as good and there isn't a pantheon belief affecting them specifically.
 
The screenshots of oases show average numbers of desert feature tiles for a vanilla map. It might seem like there's more features, but the overall quantity is the same as maps like Continents Plus. It might be somewhat of an optical illusion because oases are more visible than floodplains.

Cities can work fewer oases than floodplains because oases scatter more than river tiles. The blank deserts separating oases also cost more to expand to than lined-up floodplains. I typically choose the desert faith pantheon when I start near lots of floodplains. Pantheons have most effect in the early game, when cities have low food, and work more floodplains than hills.
 
The problem was the oasis being clustered like crazy, not the frequency of flood plains. That part doesn't worry me much. Large numbers of oasis per city would. Makes settling desert superior to other terrain types.
 
The code doesn't place oases adjacent to each other... if that's what you mean by clustering? PerfectWorld originally could do that but I blocked it.
 
Top Bottom