Random Chitchat 2012-2016
(07-03-2012, 06:06 AM)xoft Wrote: Hey, you did great, you made (kinda) jungle trees Smile

thanksBig Grin
Thanks given by:
(07-03-2012, 04:24 AM)STR_Warrior Wrote:
(07-03-2012, 04:13 AM)FakeTruth Wrote: A game I created with four others in 48 hours Smile

http://www.youtube.com/watch?v=_aIP6TnHsyM

It really is A LOT of fun, but you do need four players and four XBOX controllersTongue

nice looks epic Smile and that in 48 hours Smile

ThanksBig GrinBig Grin

Thanks given by:
there is a bug now with the jungle trees Sad they grow on apple bushes :S
soo where are you now working on?? Smile (please say worm-nest caves please say worm-nest cave) xD
i am now working on the lilypad finisher Smile i have this:    
Thanks given by:
xoft can you help me?? i don't know how to let the lily pads spawn randomly Sad 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 Sad i'm stuck ;(
this is the code i have now: http://www.mediafire.com/?0583zf3az8gql5j
Thanks given by:
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.
Thanks given by:
sorry i don't know how to implent that in the finisher Sad
Thanks given by:
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.
Thanks given by:
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
}
}
}
}
}
}
}
}
}
Thanks given by:
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; }
Thanks given by:
i think i should know more about c++ before editting the server moreTongue
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
}
}
}
}
}
}
}
}
}
Thanks given by:




Users browsing this thread: 106 Guest(s)