| 
		
	
	
	
		
	Posts: 4,637 
	Threads: 115 
	Joined: Dec 2011
	
 Thanks: 697Given 518 thank(s) in 441 post(s)
 
 
	
	
		 (07-03-2012, 06:06 AM)xoft Wrote:  Hey, you did great, you made (kinda) jungle trees  
thanks   
	
	
	
		
	Posts: 1,450 
	Threads: 53 
	Joined: Feb 2011
	
 Thanks: 15Given 130 thank(s) in 99 post(s)
 
 
	
	
	
		
	Posts: 4,637 
	Threads: 115 
	Joined: Dec 2011
	
 Thanks: 697Given 518 thank(s) in 441 post(s)
 
 
	
		
		
		07-03-2012, 06:28 PM 
(This post was last modified: 07-03-2012, 07:28 PM by NiLSPACE.)
		
	 
		there is a bug now with the jungle trees    they grow on apple bushes :S 
 
soo where are you now working on??    (please say worm-nest caves please say worm-nest cave) xD 
 
i am now working on the lilypad finisher    i have this:
   
	
	
	
		
	Posts: 4,637 
	Threads: 115 
	Joined: Dec 2011
	
 Thanks: 697Given 518 thank(s) in 441 post(s)
 
 
	
	
		xoft can you help me?? i don't know how to let the lily pads spawn randomly    i just took the code of the snow and ice finisher and combined them to let the lilypads hover above the water. but i don't know how to go further now    i'm stuck ;( 
this is the code i have now: http://www.mediafire.com/?0583zf3az8gql5j 
	
	
	
		
	Posts: 6,482 
	Threads: 176 
	Joined: Jan 2012
	
 Thanks: 131Given 1085 thank(s) in 857 post(s)
 
 
	
		
		
		07-03-2012, 10:30 PM 
(This post was last modified: 07-03-2012, 10:33 PM by xoft.)
		
	 
		Have a look how trees are placed generally, in cStructGenTrees::GenStructures(). First the generator decides how many trees it's gonna place in a chunk (GetNumTrees()), then for each tree it picks a random coordinate pair within the chunk (GenerateSingleTree()) and tries to grow a tree there (GetTreeImageByBiome()). Use a similar approach for lily pads - in each chunk, pick a few random coordpairs and place lily pads if they fit (above water, free block).EDIT: Lily pads are much easier than trees, because they are single-block, they don't need any of the "neighboring chunk" processing that trees must do.
 
	
	
	
		
	Posts: 4,637 
	Threads: 115 
	Joined: Dec 2011
	
 Thanks: 697Given 518 thank(s) in 441 post(s)
 
 
	
	
		sorry i don't know how to implent that in the finisher    
	
	
	
		
	Posts: 6,482 
	Threads: 176 
	Joined: Jan 2012
	
 Thanks: 131Given 1085 thank(s) in 857 post(s)
 
 
	
	
		Absolutely the same, pseudocode: Code: int NumLilyPads = GetNumLilyPads(a_BiomeMap);for (int i = 0; i < NumLilyPads; i++)
 {
 int x = m_Noise.IntNoise3DInt(a_ChunkX + a_ChunkZ, a_ChunkZ, i) % cChunkDef::Width;
 int z = m_Noise.IntNoise3DInt(a_ChunkX - a_ChunkZ, i, a_ChunkZ) % cChunkDef::Width;
 // Place lilypad at {x, z} if possible (empty block, water below)
 }
The GetNumLilyPads() adds up the number of biSwamp items in a_BiomeMap[], divides by a reasonable constant (64?) to produce a reasonable count of (max) lily pads per chunk. 
Lilypad placing should probably take into account if the biome at given block coords is biSwamp or not (cChunkDef::GetBiome(a_BiomeMap, x, z) ), in addition to the normal lilypad placement conditions.
	 
	
	
	
		
	Posts: 4,637 
	Threads: 115 
	Joined: Dec 2011
	
 Thanks: 697Given 518 thank(s) in 441 post(s)
 
 
	
	
		so the code for lilypad would be a bit like this: Quote:void cFinishGenLilypad::GenFinish(int a_ChunkX, int a_ChunkZ,
 cChunkDef::BlockTypes & a_BlockTypes,    // Block types to read and change
 cChunkDef::BlockNibbles & a_BlockMeta,   // Block meta to read and change
 cChunkDef::HeightMap & a_HeightMap,      // Height map to read and change by the current data
 const cChunkDef::BiomeMap & a_BiomeMap,  // Biomes to adhere to
 cEntityList & a_Entities,                // Entities may be added or deleted
 cBlockEntityList & a_BlockEntities       // Block entities may be added or deleted
 )
 ;{
 // Turn surface water into Lilypads in Swampland
 
 int NumLilyPads = GetNumLilyPads(a_BiomeMap);
 for (int i = 0; i < NumLilyPads; i++)
 {
 int x = m_Noise.IntNoise3DInt(a_ChunkX + a_ChunkZ, a_ChunkZ, i) % cChunkDef::Width;
 int z = m_Noise.IntNoise3DInt(a_ChunkX - a_ChunkZ, i, a_ChunkZ) % cChunkDef::Width;
 // Place lilypad at {x, z} if possible (empty block, water below)
 {
 switch (cChunkDef::GetBiome(a_BiomeMap, x, z))
 {
 
 case biSwampland:
 {
 {
 int Height = cChunkDef::GetHeight(a_HeightMap, x, z);
 switch (cChunkDef::GetBlock(a_BlockTypes, x, Height, z))
 {
 case E_BLOCK_WATER:
 case E_BLOCK_STATIONARY_WATER:
 {
 cChunkDef::SetBlock(a_BlockTypes, x, Height + 1, z, E_BLOCK_LILY_PAD);
 cChunkDef::SetHeight(a_HeightMap, x, z, Height + 1);
 break;
 
 
 for (int z = 0; z < cChunkDef::Width; z++)
 {
 for (int x = 0; x < cChunkDef::Width; x++)
 {
 switch (cChunkDef::GetBiome(a_BiomeMap, x, z))
 {
 
 case biSwampland:
 {
 {
 int Height = cChunkDef::GetHeight(a_HeightMap, x, z);
 switch (cChunkDef::GetBlock(a_BlockTypes, x, Height, z))
 {
 case E_BLOCK_WATER:
 case E_BLOCK_STATIONARY_WATER:
 {
 cChunkDef::SetBlock(a_BlockTypes, x, Height + 1, z, E_BLOCK_LILY_PAD);
 cChunkDef::SetHeight(a_HeightMap, x, z, Height + 1);
 break;
 }
 }
 }
 break;
 }
 }
 }
 // for z
 }
 }
 }
 }
 }
 }
 }
 }
 }
 
	
	
	
		
	Posts: 6,482 
	Threads: 176 
	Joined: Jan 2012
	
 Thanks: 131Given 1085 thank(s) in 857 post(s)
 
 
	
	
		You seem to have some leftovers from the previous code in there. Also, no need to use switch() if you're comparing to a single value, just use if (not-equal) { continue; }
	 
	
	
	
		
	Posts: 4,637 
	Threads: 115 
	Joined: Dec 2011
	
 Thanks: 697Given 518 thank(s) in 441 post(s)
 
 
	
		
		
		07-04-2012, 12:52 AM 
(This post was last modified: 07-04-2012, 01:16 AM by NiLSPACE.)
		
	 
		i think i should know more about c++ before editting the server more  
 
i now have this:
 Quote:void cFinishGenLilypad::GenFinish(int a_ChunkX, int a_ChunkZ,
 cChunkDef::BlockTypes & a_BlockTypes,    // Block types to read and change
 cChunkDef::BlockNibbles & a_BlockMeta,   // Block meta to read and change
 cChunkDef::HeightMap & a_HeightMap,      // Height map to read and change by the current data
 const cChunkDef::BiomeMap & a_BiomeMap,  // Biomes to adhere to
 cEntityList & a_Entities,                // Entities may be added or deleted
 cBlockEntityList & a_BlockEntities       // Block entities may be added or deleted
 )
 ;{
 // Turn surface water into Lilypads in Swampland
 
 int NumLilyPads = GetNumLilyPads(a_BiomeMap);
 for (int i = 0; i < NumLilyPads; i++)
 {
 int x = m_Noise.IntNoise3DInt(a_ChunkX + a_ChunkZ, a_ChunkZ, i) % cChunkDef::Width;
 int z = m_Noise.IntNoise3DInt(a_ChunkX - a_ChunkZ, i, a_ChunkZ) % cChunkDef::Width;
 // Place lilypad at {x, z} if possible (empty block, water below)
 {
 {
 
 if (biSwampland)
 {
 {
 int Height = cChunkDef::GetHeight(a_HeightMap, x, z);
 switch (cChunkDef::GetBlock(a_BlockTypes, x, Height, z))
 {
 case E_BLOCK_WATER:
 case E_BLOCK_STATIONARY_WATER:
 {
 cChunkDef::SetBlock(a_BlockTypes, x, Height + 1, z, E_BLOCK_LILY_PAD);
 cChunkDef::SetHeight(a_HeightMap, x, z, Height + 1);
 break;
 
 
 for (int z = 0; z < cChunkDef::Width; z++)
 {
 for (int x = 0; x < cChunkDef::Width; x++)
 
 {
 case biSwampland:
 {
 {
 int Height = cChunkDef::GetHeight(a_HeightMap, x, z);
 {
 if (E_BLOCK_WATER)
 {
 if (E_BLOCK_STATIONARY_WATER)
 {
 cChunkDef::SetBlock(a_BlockTypes, x, Height + 1, z, E_BLOCK_LILY_PAD);
 cChunkDef::SetHeight(a_HeightMap, x, z, Height + 1);
 break;
 }
 }
 }
 break;
 }
 }
 }
 // for z
 }
 }
 }
 }
 }
 }
 }
 }
 }
 |