First thing i would do is clarify the program with small change, maybe causing it to speed up in the process. Dynamic array might be reference-based by default, but i don't think it becomes very clear with this:
Code:
function TWorldGenerator._genStepGround(Chunk: TChunk): TChunk;
function TWorldGenerator._genStepTraps(Chunk: TChunk): TChunk;
You are passing a big array as parameter, and returning one aswell. You could simply refer to it, apply changes to it directly (because that's what already happens, right?), so:
Code:
procedure TWorldGenerator._genStepGround(var Chunk: TChunk);
procedure TWorldGenerator._genStepTraps(var Chunk: TChunk);
These would change too:
Code:
_genStepTerrain(Chunk);
_genStepCarve(Chunk);
_genStepGround(Chunk);
_genStepBlocks(Chunk);
_genStepTraps(Chunk);
I'm still pretty "new" to perlin noise, but aren't you supposed to combine many random waves. First ones smooth big ones, then smaller and sharper. From line 99+, you are using same frequency for all of them. Do i just misunderstand the code?
Could be the PerlinNoise2d() already does the multi-wave math for you.
Bookmarks