From c0727c426572745c72a61d26a84754d5a641d562 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 11 May 2014 22:35:41 +0200 Subject: Initial VillageGen implementation. WIP, doesn't generate anything yet. Ref.: 740. --- src/Generating/VillageGen.h | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/Generating/VillageGen.h (limited to 'src/Generating/VillageGen.h') diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h new file mode 100644 index 000000000..d3cc8ef9c --- /dev/null +++ b/src/Generating/VillageGen.h @@ -0,0 +1,48 @@ + +// VillageGen.h + +// Declares the cVillageGen class representing the village generator + + + + + +#pragma once + +#include "GridStructGen.h" +#include "PrefabPiecePool.h" + + + + + +class cVillageGen : + public cGridStructGen +{ + typedef cGridStructGen super; +public: + cVillageGen(int a_Seed, int a_GridSize, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); + +protected: + class cVillage; // fwd: VillageGen.cpp + + /** The prefabs for the sand village. We're not exactly using the cPiecePool functionality, only the containment. */ + static cPrefabPiecePool m_SandVillage; + + /** The prefabs for the plains village. We're not exactly using the cPiecePool functionality, only the containment. */ + static cPrefabPiecePool m_PlainsVillage; + + /** The underlying biome generator that defines whether the village is created or not */ + cBiomeGen & m_BiomeGen; + + /** The underlying height generator, used to position the prefabs crossing chunk borders */ + cTerrainHeightGen & m_HeightGen; + + + // cGridStructGen overrides: + virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override; +} ; + + + + -- cgit v1.2.3 From 9c8e8ef7aece2f881ef97c387600c8a751579b20 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 12 May 2014 22:43:59 +0200 Subject: VillageGen: Added well placement and the general algorithm description. --- src/Generating/VillageGen.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Generating/VillageGen.h') diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h index d3cc8ef9c..acbd76881 100644 --- a/src/Generating/VillageGen.h +++ b/src/Generating/VillageGen.h @@ -21,7 +21,7 @@ class cVillageGen : { typedef cGridStructGen super; public: - cVillageGen(int a_Seed, int a_GridSize, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); + cVillageGen(int a_Seed, int a_GridSize, int a_MaxRoadDepth, int a_MaxSize, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); protected: class cVillage; // fwd: VillageGen.cpp @@ -31,6 +31,12 @@ protected: /** The prefabs for the plains village. We're not exactly using the cPiecePool functionality, only the containment. */ static cPrefabPiecePool m_PlainsVillage; + + /** Maximum number of roads generated one from another (tree depth). */ + int m_MaxRoadDepth; + + /** Maximum size, in X/Z blocks, of the village (radius from the origin) */ + int m_MaxSize; /** The underlying biome generator that defines whether the village is created or not */ cBiomeGen & m_BiomeGen; -- cgit v1.2.3 From f5fdbdaf29738f51fdb8a4a0e5aa78631c6540cf Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 15 May 2014 00:14:06 +0200 Subject: VillageGen rewritten using BFSPieceGenerator. Piece composition is not good yet, the buildings aren't height-adjusted and the road pieces will need special processing. This is mainly for adjusting the per-piece params. --- src/Generating/VillageGen.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/Generating/VillageGen.h') diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h index acbd76881..c6f8f024a 100644 --- a/src/Generating/VillageGen.h +++ b/src/Generating/VillageGen.h @@ -21,19 +21,13 @@ class cVillageGen : { typedef cGridStructGen super; public: - cVillageGen(int a_Seed, int a_GridSize, int a_MaxRoadDepth, int a_MaxSize, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); + cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); protected: class cVillage; // fwd: VillageGen.cpp - /** The prefabs for the sand village. We're not exactly using the cPiecePool functionality, only the containment. */ - static cPrefabPiecePool m_SandVillage; - - /** The prefabs for the plains village. We're not exactly using the cPiecePool functionality, only the containment. */ - static cPrefabPiecePool m_PlainsVillage; - - /** Maximum number of roads generated one from another (tree depth). */ - int m_MaxRoadDepth; + /** Maximum depth of the generator tree*/ + int m_MaxDepth; /** Maximum size, in X/Z blocks, of the village (radius from the origin) */ int m_MaxSize; -- cgit v1.2.3 From 6aa7df367f8db7506a8a5ab853c26e3c9fd60253 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 22 May 2014 21:47:56 +0200 Subject: Villages have min and max density setting. Also made roads use 3+9 scheme, instead of 3+5, for the house connectors. Fixes #1020. --- src/Generating/VillageGen.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/Generating/VillageGen.h') diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h index c6f8f024a..5faaae8a6 100644 --- a/src/Generating/VillageGen.h +++ b/src/Generating/VillageGen.h @@ -21,16 +21,25 @@ class cVillageGen : { typedef cGridStructGen super; public: - cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); + cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); protected: class cVillage; // fwd: VillageGen.cpp + /** The noise used for generating random numbers */ + cNoise m_Noise; + /** Maximum depth of the generator tree*/ int m_MaxDepth; /** Maximum size, in X/Z blocks, of the village (radius from the origin) */ int m_MaxSize; + + /** Minimum density - percentage of allowed house connections. Range [0, 100] */ + int m_MinDensity; + + /** Maximum density - percentage of allowed house connections. Range [0, 100] */ + int m_MaxDensity; /** The underlying biome generator that defines whether the village is created or not */ cBiomeGen & m_BiomeGen; -- cgit v1.2.3 From ee50790398791c38e563eee04cf12780fab74baf Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 16 Jun 2014 15:12:50 +0100 Subject: Merge branch 'master' of github.com:mc-server/MCServer --- src/Generating/VillageGen.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Generating/VillageGen.h') diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h index 5faaae8a6..694ea2358 100644 --- a/src/Generating/VillageGen.h +++ b/src/Generating/VillageGen.h @@ -21,7 +21,7 @@ class cVillageGen : { typedef cGridStructGen super; public: - cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); + cVillageGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen); protected: class cVillage; // fwd: VillageGen.cpp @@ -49,7 +49,7 @@ protected: // cGridStructGen overrides: - virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override; + virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override; } ; -- cgit v1.2.3