PolyHedraLand banner

PolyHedraLand

2 devlogs
3h 27m 28s

A procedurally generated polyhedral world in Raylib/C

Repository

Loading README...

jimc0

I implemented some basic rendering capabilities. I forgot to log my time (gotta remember to turn on wakatime-mode), but I spent quite a while trying to figure out why my terrain generation was completely messed up, for a while (see attachments for the fun imagery it produced!)

In the end, it turned out that my perlin noise function had a problem dealing with negative coordinates, so I added a small conditional statement to patch it up, and for sanity, I ended up changing the equillateral triangles into just grid-aligned right triangles. Also, I added red/green alternating scheme so that I could see stuff.

I haven’t yet implemented simplex noise (I’m actually finding that perlin noise is producing fairly good results, and it appears to be fairly cheap computationally anyhow), but hopefully I’ll be able to read some papers soon.

Going forward, I kind of want to change the current grid-aligned triangles into a hexagonal grid so that the results look somewhat more interesting, and I also need to edit colors. Also, since right now it’s quite slow (with no optimization, for debugging purposes), I want to look into caching loaded chunks and potentially exporting the triangles as meshes rather than manually rendering individual triangles.

After that, I hope I can start fleshing out the world a bit by adding some form of a sky, adding collision, increasing the control set, and potentially adding some creatures.

Attachment
Attachment
Attachment
Attachment
Attachment
0
jimc0

Implemented 2-dimensional (Fractal) Perlin Noise function.

I plan to use some noise function to generate terrain, and the first one that comes to mind is Perlin Noise. I specifically chose to use the improved 2002 version for the performance gains. and (apparently) better artifacting characteristics.

Online articles can be slightly confusing since a number of them seem to confuse Perlin Noise with value noise… Nevertheless, the original paper by Ken Perlin is reasonably well-written, if somewhat dense.

I think I might end up changing to a different noise algorithm. I somewhat dislike the fact that the noise “peaks” tend to form straight lines in N, E, S, W, NE, NW, SE, SW directions due to the nature of the algorithm. Simplex noise seems like a promising alternative.

Attachment
0