Cuberite Forum
Some semi-random thoughts on terrain generation - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Some semi-random thoughts on terrain generation (/thread-409.html)



RE: Some semi-random thoughts on terrain generation - NiLSPACE - 07-21-2014

I made an attempt for an new foliage finisher. Do you think this is the way to do it or should it be done differently? I myself am pretty pleased with the first result (even though it only generates tall grass for now).


RE: Some semi-random thoughts on terrain generation - xoft - 07-21-2014

Tall grass generating may use a different finisher than all the other foliage. Usually there should be rather uniform distribution of tall grass, while all the other foliage blocks would be better in clumps (like in the Nether clump foliage generator). For tall grass, a simple per-block noise value with a threshold should be enough. So which one did you do?


RE: Some semi-random thoughts on terrain generation - NiLSPACE - 07-21-2014

if (m_Noise.CubicNoise2D((float) xx + m_Noise.CubicNoise1D(xx), zz + m_Noise.CubicNoise1D(zz)) < GetBiomeDensity(a_ChunkDesc.GetBiome(x, z)))

but I want a clump generator for the flowers and mushrooms. But that's going to be pretty difficult(or long code) since flowers are now per-biome.


RE: Some semi-random thoughts on terrain generation - xoft - 07-21-2014

I'd recommend splitting these two. Name this one TallGrass and add it already; then make another one, ClumpFoliage, and do only flowers / mushrooms with it.

As for the per-biome settings, simply use the biome at the center of the clump to decide which block to generate, from a per-biome list of allowed blocks. Should be simple enough Smile


RE: Some semi-random thoughts on terrain generation - NiLSPACE - 07-21-2014

Ok that does seem to be the best option. I still have to add long tall grass though so I'll do that first.
EDIT:
But what about the sugar cane then?


RE: Some semi-random thoughts on terrain generation - xoft - 07-21-2014

Sugar canes are special, they need special placement, so yet another finisher.


RE: Some semi-random thoughts on terrain generation - NiLSPACE - 07-21-2014

I was thinking. Maybe we could create group finishers. For example "Vanilla" will create a cFinishGenWormNest, Trees, MineShafts, TallGrass etc.
EDIT:
Oh and I also create a pull request for the TallGrass finisher.


RE: Some semi-random thoughts on terrain generation - xoft - 07-21-2014

What about when we implement a new finisher that's closer to vanilla than what we currently have? Such as when you've now added the tall grass finisher. Should the group change, or not? Neither is a good solution.


RE: Some semi-random thoughts on terrain generation - xoft - 07-25-2014

I have created a super-simple super-fast algorithm for creating wiggly lines like these:
[Image: roughravines.png]
Do you think these would be good as ravines? They would probably look nothing like vanilla, but on the other hand they might look cool as our own feature Smile


RE: Some semi-random thoughts on terrain generation - xoft - 07-25-2014

Btw this is the (Delphi) code used to generate one such line:
procedure SubdivideLine(bmp: TBitmap; pt1, pt2: TPoint; Color: TColor);
var
	MidPt: TPoint;
	dx, dy: integer;
begin
	MidPt.X := (pt1.X + pt2.X) div 2;
	MidPt.Y := (pt1.Y + pt2.Y) div 2;
	dx := pt2.x - pt1.x;
	dy := pt2.Y - pt1.Y;
	MidPt.X := MidPt.x + dy div 5;
	MidPt.y := MidPt.Y - dx div 5;
	bmp.Canvas.Pixels[MidPt.x, MidPt.Y] := Color;
	if ((abs(dx) > 2) or (abs(dy) > 2)) then
	begin
		if (((random(255)) mod 2) = 0) then
			SubdivideLine(bmp, pt1, MidPt, Color)
		else
			SubdivideLine(bmp, MidPt, pt1, Color);
		SubdivideLine(bmp, pt2, MidPt, Color);
	end
end;

SubdivideLine(bmp, Point(100, 150), Point(800, 150), $ff);