Caveat

So, the claim that this project was built using entirely the C standard library isn't entirely true, I actually did use SDL2, but only to open a window and render the framebuffer, as well as handle some basic keyboard input. I may be a bit of a masochist for making all this from scratch, but I'm not freaky enough to create my own GDI and window manager.

Inspiration

I started off with the idea to create a minecraft clone from scratch, based on a whim. I have some experience in 3D graphics and making games, so I figured it would be a fun challenge. And a challenge it turned out to be, frustratingly I had to scrap my original idea of a full game and stick to just the terrain generation and graphics rendering.

What it does

The program generates a heightmap based on random perlin noise, then creates a 3D mesh of the heightmap. This mesh is rendered to a pixel buffer by my custom software rendering code. Once this buffer is updated, SDL then renders it to the window.

How I built it

Using my knowledge of computer graphics, as well as generous googling and some ahem, inspiration from others' code.

Challenges I ran into

Everything was going fairly smoothly until I tried to implement camera control, a problem I've tackled before and not had much issue with. This time, however, I ran into a perplexing bug that I couldn't quite make heads or tails of. Although I was incredibly sleep deprived, I decided not to give up on solving it, which was a stupid idea. I only became more bitter, confused, and tired the longer I kept at it. Eventually I gave up due to time constraints and decided to make something more feasible.

Accomplishments that I'm proud of

My software graphics rendering engine works really well, being able to render a surprising number of pixels/polygons to screen despite it being CPU-bound. In addition, the rendering engine is pretty tidy, at just 194 lines of code. Also, the perlin noise works well and creates reasonably good looking terrain.

What I learned

Sometimes, you need to throw in the towel on a dream.

What's next for std::terrain_gen

Probably nothing.

Built With

  • c/c++-standard-library
Share this project:

Updates