PerfectWorld3

Yes! She will be two in a couple of days. I have about 1/4 the free time I used to, but she's an amazing amount of fun too.



I don't know if we have any Wesnoth players here, but I spent most of 2012 making a Wesnoth campaign called 'The Library of Kratemaqht.' A much bigger project than I imagined when I started!
 

Attachments

  • iris.jpg
    iris.jpg
    67.7 KB · Views: 2,096
I haven't played it but I looked at it and it seems to be a very old school turn based game. Downloading now.

Another I like in the same genre you might be a fan of is Warlock - Masters of the Arcane. Seems similar to it.
 
cephalo is back! nice to hear you're doing great :D

edit: also, sorry for the OT but I really gotta ask :blush: - any interest in updating Elementerra for Fallen Enchantress ? :)
 
I don't know if we have any Wesnoth players here, but I spent most of 2012 making a Wesnoth campaign called 'The Library of Kratemaqht.' A much bigger project than I imagined when I started!
Hi.
It's been a while I last played Wesnoth. Installing the latest version and downloading your scenario right now!
 
Thanks for downloading my Wesnoth scenario guys! :) When you're done, make sure you give some feedback on the Wesnoth boards. My thread there is dyin! Ugh, what would possess me to spend a year of my life on a mod for a ten year old game! It was fun though. I used a lot of my experience working with maps to convert my 3D dragons into 2D sprites, since bitmaps are basically maps. They turned out very well considering that I'm not much of an artist.

[to_xp]Gekko;12063317 said:
cephalo is back! nice to hear you're doing great :D

edit: also, sorry for the OT but I really gotta ask :blush: - any interest in updating Elementerra for Fallen Enchantress ? :)

Yeah, I haven't even had a chance to play FE believe it or not, even though I already own it. I would like to get around to that at some point though. I've been trying to get back to my own strategy game engine project and I am now trying to convert it from DirectX9 to DirectX11, which is very painful and time consuming. Here is an early screenshot of the dx9 version:
Spoiler :
 

Attachments

  • HexMap.jpg
    HexMap.jpg
    242.8 KB · Views: 2,246
They aren't very obviously named, but I think the variables you want are twistMinFreq and twistMaxFreq. I haven't looked at this code in ages, so I might not be an authority on this anymore, :lol: but if you turn those numbers up you should get smaller landmasses etc.

To help remember, what do these numbers actually do mechanically. Intuitively I know that making the % landmass less will mean less land but I have no concept of what a twist min and max freq are.
 
To help remember, what do these numbers actually do mechanically. Intuitively I know that making the % landmass less will mean less land but I have no concept of what a twist min and max freq are.

These are the frequencies of the noise used to make the landforms. If you google Perlin noise, you should find examples of low frequency vs. high frequency. Low is smooth and rolling, high is choppy and noisy. The twist map is a noise map who's frequency is modified by another noise map from the min freq to the max freq.
 
Yeah, I haven't even had a chance to play FE believe it or not, even though I already own it. I would like to get around to that at some point though. I've been trying to get back to my own strategy game engine project and I am now trying to convert it from DirectX9 to DirectX11, which is very painful and time consuming. Here is an early screenshot of the dx9 version:
Spoiler :

You should give Fallen Enchantress a try - it's really a very fun game!:)

That screen looks great, one giant hope I have for Civ VI is actual elevations on the map (even beyond what SMAC had): the flat map is beginning to look very dated. It would add *so* much for immersion...
 
I've fooled around by moving the twist variable around, it just generates a winding connected thing land mass and not a Pangaea type continent. and I've tried setting them both lower and higher than what they were. Land mass being turned up high just makes them more connected and less separate but not into a big blob.

Any other suggestions?
 
Hey Guys,

I've downloaded this great script and can see it as an option for single player. What do I need to do to tweak it, or where do I put it, to be able to play MP with it? Does anybody have a version of the script which is MP enabled they can share? Thanks!!
 
Hi everyone, first I'm trying to learn a little Lua at this stage, so if what follows is twaddle be gentle.

I couldn't help but notice in the last 20 pages of this thread that there were numerous requests of lowering the number of Oases since 2010.

The code reads for eligibility of the plot, if eligible then it places the oasis on the plot.

I wrote a small code that could possibly halve the number placed. Would this work?

Code:
function PlacePossibleOasis(x,y)		
	local terrainDesert	= GameInfoTypes["TERRAIN_DESERT"];
	local featureOasis = FeatureTypes.FEATURE_OASIS
	local tiles = elevationMap:GetRadiusAroundHex(x,y,1)
	local plot = Map.GetPlot(x,y)
	if not plot:IsHills() and not plot:IsMountain() and plot:GetTerrainType() == terrainDesert then
		local canPlace = true
		for n=1,#tiles do
			local xx = tiles[n][1]
			local yy = tiles[n][2]
			local nPlot = Map.GetPlot(xx,yy)
			if nPlot:GetTerrainType() ~= terrainDesert then
				canPlace = false
				break
			elseif nPlot:GetFeatureType() ~= FeatureTypes.NO_FEATURE then
				canPlace = false
				break
				
			elseif                                    -- Lamb 15022013 - start
				local roll1 = Map.Rand(2, "Placing - PW3");
				if roll1 == 1 then           -- (if roll ==0 canPlace)
					canPlace = false
					break
				end                                -- Lamb 15022013 - fin
				
			end
		end
		if canPlace then		
			plot:SetFeatureType(featureOasis,-1)
		end
	end
end
 
I've been working with this script for the past few days to tune it more to my personal liking, and though I'm quite the novice scripter, I've learned a lot regarding civ's map scripts.

I just located the issue causing the ghost mountains on rivers and a fix for it. This bug is primarily presenting itself where two mountains straddle a river. Cephalo's code prevents this from happening by replotting the mountain tiles as land. Turns out, there's a flag for recalculating and rebuilding the graphics around the altered tile.

Taken from Firaxis's TerrainGenerator.lua:
Code:
if allow_mountains_on_coast == false then -- remove any mountains from coastal plots
		for x = 0, self.iGridW - 1 do
			for y = 0, self.iGridH - 1 do
				local plot = Map.GetPlot(x, y)
				if plot:GetPlotType() == PlotTypes.PLOT_MOUNTAIN then
					if plot:IsCoastalLand() then
						plot:SetPlotType(PlotTypes.PLOT_HILLS, false, true); -- These flags are for recalc of areas and rebuild of graphics. Instead of recalc over and over, do recalc at end of loop.
					end
				end
			end
		end
		-- This function needs to recalculate areas after operating. However, so does 
		-- adding feature ice, so the recalc was removed from here and put in MapGenerator()
	end

This is part of a function that prevents mountains from appearing on coastlines.

In particular, this line and the comment associated with it shows what flag needs to be changed, and why.

Code:
lot:SetPlotType(PlotTypes.PLOT_HILLS, false, true); -- These flags are for recalc of areas and rebuild of graphics. Instead of recalc over and over, do recalc at end of loop.

I've yet to test my fix (though commenting out the lines that replot mountains during the addRivers() function did entirely get rid of ghost mountains for me on 10+ spawns of a huge map; before commenting out these lines, 8 out of 10 maps or so, if I looked hard enough I'd find at least one example of side-by-side ghost mountains). I'll report back with detailed code changes once I've done a little more testing.
 
Hi everyone, first I'm trying to learn a little Lua at this stage, so if what follows is twaddle be gentle.

I couldn't help but notice in the last 20 pages of this thread that there were numerous requests of lowering the number of Oases since 2010.

The code reads for eligibility of the plot, if eligible then it places the oasis on the plot.

I wrote a small code that could possibly halve the number placed. Would this work?

Code:
function PlacePossibleOasis(x,y)		
	local terrainDesert	= GameInfoTypes["TERRAIN_DESERT"];
	local featureOasis = FeatureTypes.FEATURE_OASIS
	local tiles = elevationMap:GetRadiusAroundHex(x,y,1)
	local plot = Map.GetPlot(x,y)
	if not plot:IsHills() and not plot:IsMountain() and plot:GetTerrainType() == terrainDesert then
		local canPlace = true
		for n=1,#tiles do
			local xx = tiles[n][1]
			local yy = tiles[n][2]
			local nPlot = Map.GetPlot(xx,yy)
			if nPlot:GetTerrainType() ~= terrainDesert then
				canPlace = false
				break
			elseif nPlot:GetFeatureType() ~= FeatureTypes.NO_FEATURE then
				canPlace = false
				break
				
			elseif                                    -- Lamb 15022013 - start
				local roll1 = Map.Rand(2, "Placing - PW3");
				if roll1 == 1 then           -- (if roll ==0 canPlace)
					canPlace = false
					break
				end                                -- Lamb 15022013 - fin
				
			end
		end
		if canPlace then		
			plot:SetFeatureType(featureOasis,-1)
		end
	end
end

Cephalo included a random integer generator called PWRandint():
Code:
--range is inclusive, low and high are possible results
function PWRandint(low, high)
	return math.random(low, high)
end

As is, your code broke the map script and caused Civ to crash before clicking "Begin Journey". Replacing it with the following should work:

Code:
			elseif                                    -- Lamb 15022013 - start
				local roll1 = PWRandint(1,2);             -- Bobert13
				if roll1 == 1 then           -- (if roll == 2 canPlace)
					canPlace = false
					break
				end                                -- Lamb 15022013 - fin
 
After 6 Huge Maps, I'm pretty confident that my fix works. :D

Here's the fixed code:

Code:
function AddRivers()
	local gridWidth, gridHeight = Map.GetGridSize();
	for y = 0, gridHeight - 1,1 do
		for x = 0,gridWidth - 1,1 do
			local plot = Map.GetPlot(x, y)

			local WOfRiver, NWOfRiver, NEOfRiver = riverMap:GetFlowDirections(x,y)

			if WOfRiver == FlowDirectionTypes.NO_FLOWDIRECTION then
				plot:SetWOfRiver(false,WOfRiver)
			else
				local xx,yy = elevationMap:GetNeighbor(x,y,mc.E)
				local nPlot = Map.GetPlot(xx,yy)
				if plot:IsMountain() and nPlot:IsMountain() then
					plot:SetPlotType(PlotTypes.PLOT_LAND,false,true) [COLOR="SeaGreen"]-- Changed second flag to "true"[/COLOR]
				end
				plot:SetWOfRiver(true,WOfRiver)
				--print(string.format("(%d,%d)WOfRiver = true dir=%d",x,y,WOfRiver))
			end

			if NWOfRiver == FlowDirectionTypes.NO_FLOWDIRECTION then
				plot:SetNWOfRiver(false,NWOfRiver)
			else
				local xx,yy = elevationMap:GetNeighbor(x,y,mc.SE)
				local nPlot = Map.GetPlot(xx,yy)
				if plot:IsMountain() and nPlot:IsMountain() then
					plot:SetPlotType(PlotTypes.PLOT_LAND,false,true) [COLOR="SeaGreen"]-- Changed second flag to "true"[/COLOR]
				end
				plot:SetNWOfRiver(true,NWOfRiver)
				--print(string.format("(%d,%d)NWOfRiver = true dir=%d",x,y,NWOfRiver))
			end

			if NEOfRiver == FlowDirectionTypes.NO_FLOWDIRECTION then
				plot:SetNEOfRiver(false,NEOfRiver)
			else
				local xx,yy = elevationMap:GetNeighbor(x,y,mc.SW)
				local nPlot = Map.GetPlot(xx,yy)
				if plot:IsMountain() and nPlot:IsMountain() then
					plot:SetPlotType(PlotTypes.PLOT_LAND,false,true) [COLOR="SeaGreen"]-- Changed second flag to "true"[/COLOR]
				end
				plot:SetNEOfRiver(true,NEOfRiver)
				--print(string.format("(%d,%d)NEOfRiver = true dir=%d",x,y,NEOfRiver))
			end
		end
	end
	Map.RecalculateAreas(); [COLOR="SeaGreen"]-- This line is just for good measure.[/COLOR]
end

It may be worth noting that I have moved this function above function StartPlotSystem() in my personal WIP version, however I don't think this will matter because the MapGenerator.lua script calls addRivers() waaay before it calls StartPlotSystem().


Edit: After a lot more testing, it turns out that this fix only gets the bad tiles that aren't within 2 tiles of the map seam. If your map wraps and has a lot of stuff going on on the seam, there's still plenty of tiles displaying incorrect graphics. I think the RecalculateAreas() function is broken somehow and is missing those tiles. Unfortunately I haven't been able to find that function anywhere in the .lua scripts and I'm thinking it may be C++ buried within a .dll.

If anybody knows where I can find this function, or what calls it makes to actually reset a tiles graphics, I'd really appreciate the help. :thumbsup:
 
That's awesome Bobert, I'll have to give it a try. The only other thing that bothered me enough to stop using this map is that it's really weak for my favorite civ, The Inca. Since hills register only changes in elevation, they rarely appear next to mountains. Do you have any insight on how I might tweak it to cluster more hills around mountains, like most scripts do?
 
That's awesome Bobert, I'll have to give it a try. The only other thing that bothered me enough to stop using this map is that it's really weak for my favorite civ, The Inca. Since hills register only changes in elevation, they rarely appear next to mountains. Do you have any insight on how I might tweak it to cluster more hills around mountains, like most scripts do?

The easiest thing you could do is just decrease the hills threshhold up at the top of the script. The default is 50% of land, but, you have to subtract the hills threshhold from the mountain threshold to get the actual amount of land that is hills (default mountain threshhold is 85% so 35%). If you want foothills around mountains specifically, increasing the "mountain weight" setting should achieve that.

For more predictable results you could add some code onto the GenerateTerrain() function. Tacking the following onto the very end of GenerateTerrain() [literally right before the last "end"] will guarauntee that any tile above sea level, that's touching a mountain is a hill:
Code:
	for y = 0, gridHeight - 1,1 do
		for x = 0,gridWidth - 1,1 do
			local i = elevationMap:GetIndex(x,y)
			local plot = Map.GetPlot(x, y)
			if not elevationMap:IsBelowSeaLevel(x,y) then
				if plot:GetPlotType() == PlotTypes.PLOT_LAND then
					local tiles = elevationMap:GetRadiusAroundHex(x,y,1)
					local mountainFound = false
					for n=1,#tiles do
						local xx = tiles[n][1]
						local yy = tiles[n][2]
						local nPlot = Map.GetPlot(xx,yy)
						if nPlot:GetPlotType() == PlotTypes.PLOT_MOUNTAIN then
							mountainFound = true
						end
					end
					if mountainFound then
						plot:SetPlotType(PlotTypes.PLOT_HILLS,false,true)
					end
				end
			end
		end
	end
 
Ok, I came up with an ugly fix for the seams. The fix is simple, just don't allow the game to plot anything but flat land in tiles that are within 2 units from the wrap. The following section of code can be found at the bottom of function GeneratePlotTypes():
Code:
for y = 0, gridHeight - 1,1 do
		for x = 0,gridWidth - 1,1 do
			local i = diffMap:GetIndex(x,y)
			local plot = Map.GetPlot(x, y);
			if elevationMap:IsBelowSeaLevel(x,y) then
				plot:SetPlotType(PlotTypes.PLOT_OCEAN, false, false)
			elseif diffMap.data[i] < hillsThreshold then
				plot:SetPlotType(PlotTypes.PLOT_LAND,false,false)
			[COLOR="SeaGreen"]--This code makes the game only ever plot flat land if it's within two tiles of 
			--the seam. This prevents issues with tiles that don't look like what they are.[/COLOR]
			elseif x == 0 or x == 1 or x == gridWidth - 1 or x == gridWidth -2 then
				plot:SetPlotType(PlotTypes.PLOT_LAND,false,false)
			[COLOR="SeaGreen"]-- Bobert13[/COLOR]
			elseif diffMap.data[i] < mountainsThreshold then
				plot:SetPlotType(PlotTypes.PLOT_HILLS,false,false)
			else
				plot:SetPlotType(PlotTypes.PLOT_MOUNTAIN,false,false)
			end
		end
	end

I'm still looking for a more elegant solution, and my preferred method would be to write a new function that does what RecalculateAreas() is supposed to do, only have it focus on the four-column-wide section of the map that RecalculateAreas() seems to neglect. Again, If anybody knows more about RecalculateAreas() than what I can turn up in 5 minutes of Googling, or (even better) knows where I can actually find the code for it, I'd really appreciate the help. :thumbsup:

Firaxis's solution is shift the map so that those columns are as much water as possible. This solution is undoubtedly more elegant than what I've got so far but in order to do that, I'd need to figure out how to change Cephalo's GeneratePlotTypes code so that it generates it all to a metatable instead of directly to the map. Then I'd need to figure out how to adapt Firaxis's shift code to shift both this new "plotTypes" table as well as shifting all the other data tables used for feature and river generation (Rainfall, Drainage, Temperature, possibly Elevation, and probably a few more).
 
Aren't there some variables at the top of the script, by the ones that keep land off the poles, that can be used to keep land off the edges of the map as well? I've set those before and seen good results from it. I hate ending up on a continent that spans the map seam regardless of terrain, because there's all sorts of rendering bugs and scrolling bugs that come up.

edit: It's these
Code:
	--These attenuation factors lower the altitude of the map edges. This is
	--currently used to prevent large continents in the uninhabitable polar
	--regions. East/west attenuation is set to zero, but modded maps may
	--have need for them.
	mconst.northAttenuationFactor = 0.75
	mconst.northAttenuationRange = 0.15 --percent of the map height.
	mconst.southAttenuationFactor = 0.75
	mconst.southAttenuationRange = 0.15

	--east west attenuation may be desired for flat maps.
	mconst.eastAttenuationFactor = 0.0
	mconst.eastAttenuationRange = 0.0 --percent of the map width.
	mconst.westAttenuationFactor = 0.0
	mconst.westAttenuationRange = 0.0

I haven't used this script in a while so I don't recall exactly, but I set the east/west variables with similar values to the north/south and it worked fairly well to prevent continents from spanning the map seam. It would occasionally happen, but worked well most of the time.
 
Aren't there some variables at the top of the script, by the ones that keep land off the poles, that can be used to keep land off the edges of the map as well? I've set those before and seen good results from it. I hate ending up on a continent that spans the map seam regardless of terrain, because there's all sorts of rendering bugs and scrolling bugs that come up.

edit: It's these
Code:
*snip*

I haven't used this script in a while so I don't recall exactly, but I set the east/west variables with similar values to the north/south and it worked fairly well to prevent continents from spanning the map seam. It would occasionally happen, but worked well most of the time.

Yes, the attenuation factors could be seen as a solution but there's a list of nitpicks I have with using them for this issue (the rendering bugs you mention are what I'm trying to fix here). A) The range as a percent doesn't scale to be precise on both large and small maps. B) The attenuation factor would need to be set pretty high, to reasonably avoid the chance of rendering bugs. High attenuation could cause channels and "D" shaped landmasses that appear unnatural. C) It affects landmass creation and could alter it enough that it would mess with people's personal settings [e.g.: more likely to see Pangea's while shooting for solid continents]. The code in my previous post actually guarantees there won't be rendering bugs on the seam, but there will be a four-tile-wide swath of land on the seam that is always flat. If a meaty landmass wraps, the column of flat land looks pretty meh if you know to look for it :lol:.

Yesterday, I successfully moved the local diffMap table, used in Plot Generation, and set it up as a Global. I actually did this so I could use it later in marsh determination but turns out, it was probably the best "first step" towards making xShift possible. Today, I'm going to work on setting up a plotMap table and push full steam ahead with xShift (probably some time between getting side-tracked by smarter oasis placement and setting up the rivercheatfactor to scale with map size :D).
 
Top Bottom