07-03-2012, 11:50 PM
Absolutely the same, pseudocode:
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.
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)
}
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.