Home Artists Posts Import Register
Join the new SimpleX Chat Group!

Content

You're now up to date with my experiments, this is as live as it's going to get!

Over the weekend I took one step backwards to take two steps forward. The large-scale terrain rendering had a size limit - and I didn't like that - so I had to refactor the terrain storage system.

Previously terrain chunks were stored in a 4096x4096 grid of chunks, meaning once you travel 4km in one direction, the terrain cuts off! To create larger worlds, I'd have to increase the size of this grid, which would then use more RAM. This isn't scalable or efficient.

Infinite Terrain System

Since each terrain LOD only renders a 16x16 grid of chunks at any one time, storing any more than that is a waste. It's better to keep the visible terrain in memory and dispose everything else.

Let's say we only render a 4x4 grid of chunks around the player. From a birds eye view that would look like this:

As you travel to the right, the left-most chunks will teleport over to the right side and their meshes will be updated to look like the new terrain. From your point of view, the terrain behind you (hollow square) disappeared and new terrain (blue square) appeared in front of you:

The terrain meshes are regenerated on a background thread so this process is stutter-free.

Check out these videos to see this in action!

Biomes

The old approach in my previous videos was purely height based, i.e.. all terrain above 500m was mountain, terrain below 50m was beach, the rest was grasslands.

I'm not a fan of this and wanted to control biomes with other factors, e.g. have some flat deserts, rocky wastelands, areas with cliffs, etc. This is much more difficult than I thought!

Currently the terrain is all generated using perlin noise, which from the side looks like this:

This is good for mountains, but what if the biome generator puts an ocean between two peaks?

Yuck!

I'm not sure how to solve this yet, I don't think Perlin noise is the right approach to combine with biome generation. I'll need to look at other games and see how they tackle this.

Islands

Rather than dive further into biomes, I pivoted to island generation. This will use a perlin noise generator that lowers the altitude of the terrain the further it gets from the 'center' (a random position I chose).

The next step is to colour the terrain based on its altitude:

This looks okay-ish, and terrible from the front:

There needs to be some horizontal colour variation, so I'll use another perlin noise generator to randomise push the colour of each triangle into the next/previous biome:

That worked, but our water is now purple!?

That's much better, but now new lands have risen from the water. Let's add a rule that all water must stay as water.

Technically right... but now the terrain looks like dirty playdoh.

Getting somewhere! I adjusted the scale and strength of the new 'offset' perlin noise generator and it produced the above results. It's a bit aggressive in turning mountains into forests so let's adjust it a bit further:

Much nicer!

This is giving me an idea for a hack-and-slash game, where you wash up on the beach and have to explore the perimeter to find a boat, which then takes you to the next island. Rinse and repeat, level up, fight monsters, upgrade gear, etc.

I'd like to participate in a game jam too, i.e. create a game in 24 hours or 7 days. I think that would be a great way to figure out what parts of our engine aren't great for iterating quickly, and it'll make us commit to something with a tiny scope. Should be fun!

Files

Comments

Anonymous

Game jams are fun! I've only done one, but it was a blast

Anonymous

A lot of time for biomes a heat map and moisture map are generated (perlin noise) and overplayed, and based on the value of both a biome is chosen

vercidium

Yeah I tried that for colour but it’s still all the same rocky mountainous terrain. I’d like a mix, some plateaus, some with cliffs, some oceans and islands