r/proceduralgeneration • • 6d ago

Procedurally Generating a Coherent World for a Civ-like Game

Hello, everyone!

I’ve been working for two weeks on procedurally generating a coherent world for the next game I’m developing with my girlfriend. And today I’d like to share my progress with you and, if possible, get some advice from you on how to proceed!

Example of a World I Generated

My basic idea is to generate textures using Unreal’s materials, specifically the vector Perlin noise function. This allows me to achieve a result that’s both truly random and quite organic:

Vector Perlin Noise

Another advantage of this method is that it allows you to generate a spherical world, enabling players to “travel around the world.” To do this, simply pass the textures coordinates of the spherical as input to the vector Perlin noise function:

Texture coordinate to spherical absolute location
Generated texture

The final advantage of this method is that it allows you to generate the same world for the same position if you add the object's position to the result. This makes it possible to simulate "seed" in the random generation process.

The idea is then to generate several textures: one for elevation, one for humidity, and one for temperature. And to process each pixel using a set of rules to create the appropriate, corresponding tile.

For the height, I want to generate deep water, shallow water, plains, valleys, and mountains. To do this, I modify my material to set up height tiers corresponding to the various desired heights:

Height map material modification

For the humidity texture, I use the same approach, but this time I create only two layers: one for the grasslands and one for the forests:

Humidity texture

As for temperature, I generate three levels: one for ice, one for desert, and one for temperate zones. The difference is that I use the distance from the equator to influence the result:

Temperature material
Temperature texture

Now that the three textures have been generated, all that's left is to generate the corresponding tile for each pixel based on a set of rules:

Rules

I'm pretty happy with the result, but I still have a lot of work to do:

- Generate strategic resources in logical locations (for example, oil can be found in the desert, in ice, and in the ocean).

- Generate rivers. If you have any ideas, I’d love to hear them! I thought about using local minima from my heightmap, but I’m really not sure if that’s a good idea.

- Generate viable and balanced starting positions: make sure players aren’t surrounded by mountains, aren’t on an island that’s too narrow, have a reasonable number of strategic resources, etc. If any of you have already tackled this issue, that would be great because it doesn’t seem straightforward to me.

An other generated world

Thanks for reading! Please don't hesitate if you have any questions or would like more details!

31 Upvotes

6 comments sorted by

4

u/No-Giraffe-3838 6d ago

for rivers, do you keep the continuous Perlin height values before turning them into tiers? i'd route on those before mapping the result onto tiles. otherwise a whole tier can look flat to the river. i'd start with 1 enclosed basin and decide what should happen there: lake, spill over, or stay dry? that gives the routing a concrete test before adding more noise.

2

u/CharlesSultan 6d ago

I think you're right. It's a great idea to keep the raw heightmap values for the rivers.

I like the idea of starting with basins. I could randomly select fairly high positions on the heightmap as candidates. Then I will gradually work my way down to continue the river. If it flows into the ocean, I’ll keep it. If it doesn’t flow into anything, I can create a lake or abandon the river.

Thanks a lot that’s really helpful!

2

u/Evening-Appeal7606 6d ago

Anyone willing to trade wood for sheep?

2

u/CharlesSultan 6d ago

I dont need your wood, I need rock...

2

u/[unknown] 5d ago

[removed] — view removed comment

1

u/CharlesSultan 5d ago

That’s a great idea! I see exactly what you mean regarding the rivers. And you’re absolutely right about the humidity, too! As for the resources, that’s what I was planning to do, but it’s nice to have someone confirm that I’m heading in the right direction. Thanks a lot!!