itch.io is community of indie game creators and players

Devlogs

Devlog #2: Terrain improvements

Endangered Space
A downloadable game for Windows

If you are interested on what I plan to be in the game in the future, or what I worked on last month for my game, please take a look at my previous devlog.

What I’ve been working on so far

I planned to start working on the gameplay (the thing you do while playing the game, other than walking, since walking is not gameplay). However I ended up getting sidetracked by more important matters, such as bug fixes, and improving the terrain system. Let me explain, in detail, what I’ve been working on.

Terrain Difficulties

Teaching terrain basic math if more difficult than you’d think. Part of the reasoning is because dirt can’t think. But the other part is that terrain in games is very difficult to get right.

When I created the first iteration of the terrain system, I didn’t have much time and wanted to get something to show off. So I used a method to make terrain that wasn’t very flexible. The new terrain is much more flexible. It allows more variable heights based on biomes, uses a chunk-based system, and more impressive mountain ranges.

However this had a side effect. At the edges of every chunk, you could see a weird seam, a line that was lighter than the rest of the terrain. It took me a week to learn what caused this issue, and it was when I wasn’t even looking for it.

Texture

The old terrain system’s height based rock texture was fine for early testing, but it looks terrible, so I decided to fix it. It is now based on the steepness of the terrain. This makes the terrain much more varied in appearance, breaking up the endless grass texture.

Normals

However, this terrain system had a problem. A big problem. Near the edges, it looked really bad.

I used the normals (normals are used by game engines for the correct shading of 3D objects) of the terrain to find how steep each section is, and the normals were made independently of other terrain chunks using the default normal generator in the engine. To fix this, I made each normal manually instead of using the default engine code.

Looks so much better now. And it fixed the issue with the light border around the edges of terrain.

Optimization

Of course, optimizing the terrain to have good performance wasn’t easy. It helps that I have a low-end PC to test how the game would play on weaker hardware. With integrated graphics I get a stable 40 FPS with all the graphics settings set to medium-low values.

I had to make chunk generation multi-threaded, or every time it generated a chunk, there would be a large frame drop. Of course, that wasn’t enough, as I still had frame drops when moving fast in the starship. So I had to make the terrain render at a lower quality when moving very fast.

… And that’s it!

Phew, that was a lot of explaining. The next thing I will hopefully get to working on is more gameplay stuff. Lootable structures, more items, weapon customization, and maybe even make a start on adding npcs. Please leave your feedback and ideas in the comments below, and if you enjoyed this post, join the Discord!

Download Endangered Space
Leave a comment