Posts | ||
---|---|---|
Random Terrain Generation | Locked | |
Thread Options | ||
Mar 17 2013 Anchor | ||
Now I have another problem. If you could take a look at my generation and tell me what I did wrong or if you see any flaws, basically I want it to generate a chunk which is 128 layers high and each layer needs 80 blocks. For some reason when I use this code some layers randomly have a weird number of blocks. Also I need frequency to be more effective, for instance copper has a frequency of 3 yet it seems to appear quite abundantly in layers but I think that is because I only have about 4 blocks put in right now.
Edited by: ExoNaut |
||
Mar 21 2013 Anchor | ||
Hi ExoNaut, so you want 128 layers each with 80 block, randomly picked from a block-pool (Block.getAllBlocks()) with a frequency of how much they should appear?
Instead of Block.getAllBlocks().size() use 80, the value how much blocks you really want to add.
It's not the best and it still can be optimized with a different data structure. Hope it helps. Edited by: MausGames |
||
Mar 21 2013 Anchor | ||
Alright thanks, the only question I have is how do I used that last bit of code (the frequency) to actually add that many blocks to the layerBlocks? |
||
Mar 22 2013 Anchor | ||
Something like this:
Best regards Edited by: MausGames |
||
Mar 22 2013 Anchor | ||
Thank you very much Now the problem seems to be that even though dirt is at a frequency of 1, and stone at 25 dirt appears more often than stone. |
||
Mar 23 2013 Anchor | ||
Debug it step by step, monitor the variables, try to understand what's happening and find strange behaviors. |
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.