[OPEN SOURCED] Custom Terrain Height Map

terrain
generation
procedural

#1

I made a prototype of a custom height map generator. This is my first attempt, and I’m open to suggestions and optimizations. It’s showcased here in this video:
Enjoy the satisfying blocks.

NEW VERSION THAT IS OPEN SOURCED:

The generation speed was significantly decreased for the purpose of this video. I’m not sure whether I’ll actually do anything with it, but I’m still pretty happy with how it came out.

Here’s the source:


#2

You should share source code, then!

What’s the general algorithm? Random assignment of pixels followed by some sort of blur (like, averaging all pixels within 4 blocks of a point)?

It’s cool that it works in chunks which is always nice if you want to have the map expand gradually.


#3

That’s exactly how it works. I actually improved it recently with settings that can add more random splotches of color. The code itself could be cleaned up a tad, but I could open source it I guess. I had the idea to turn it into an island generator thing for some kind of ambitious game I know I’ll never finish.


#4

I just made it SO much better by smearing the colors randomly instead of in an order. It does all parts but in a random order!


#5

And it’s done! Packed with settings for each and every detail.


#6

I’d imagine that a chunkloader would significantly improve this, if you are going to use it.
EDIT: Moved topic to Community Resources because it’s now a tool.


#7

Update: Found old code that caused the script to error; fixed.


#8

Here’s the new version compared to the original video:


#9

This is a plug-in that I’ve been looking for for ages, but I wonder if someone could create a plug-in that creates smooth terrain with correct collisions that wouldn’t lag as much as normal unions or parts. If that’s really complex, could someone try and make a plug-in that converts meshes into smaller meshes or unions somehow? Maybe the game could scan the mesh’s polygons and somehow recreate them into unions or meshes. Both would be hard but I think it’s do-able.

Im not really a scripter so please do correct me if there are flaws :slightly_smiling_face:


#10

It is possible to convert the parts to terrain instead. Otherwise, there are calculations that can be done to fill in the gaps and transform it into something low poly looking. This is very difficult to my knowledge, but using the real-time csg, it’s possible.


#11

How do you do it? I’ve been looking for one for ages.


#12

If you mean roblox terrain, then just use terrain functions to fill it in instead of parts. There’s a whole API for that. If you mean low poly terrain, you’d have to create two triangles for every part and connect them to the nearest corners. It’s no easy task, but the low poly terrain generator plugin probably has some useful code.


#13

I’ve been making an altered version that creates islands. Here’s my progress:

Also proof of Lighting.Ambient at work:


#14

Interesting to see how it handles island overlapping.


#15

thinkin’ about a minecraft game over here