[Open Source] Infinite Terrain & Level of Detail system

I’ve created an Infinite terrain generator, with a level of detail system that dynamically increases/decreases the terrain resolution based on distance. This allows for massive view distances of around ~6000+ studs. To compliment this, the terrain generation occurs on a just as large a scale, with huge mountains and islands visible in the distance.

Edit: Updated block size to make the terrain scale more similar to real life. View distance is now 48000+ studs (9 miles).


You can try it out here: Infinite Terrain - Roblox

78 Likes

Great idea. I tested the game, I like how the terrain is made of parts with different heights, it is a good design.

2 Likes

Will this be open sourced? I’d love to experiment and learn how this was achieved

4 Likes

Tested the game, it was very interesting. So many different parts were put into this game.
Great job!

He said it in the notes, he may open source it! This will be really cool to try to configure :stuck_out_tongue:!

2 Likes

Just pushed an update with some micro optimizations that should increase performance greatly (~2-3x).
Low end devices will likely still be laggy, but for high end devices the stuttering is nonexistant save for a rare stutter here or there. Will be trying some larger algorithmic optimizations tomorrow.

how was this made in just 6 hours its amazing, I hope it gets open sourced I wanna see how it was made.

2 Likes

I have to agree. I met you in-game on my main account.

2 Likes

This is really cool, and like the others I’d also love to see the code behind it.

The LOD system is really nice, but I'd definitely recommend keeping to lower speeds...
2 Likes

Ive tested out the game and it is really good! Nice work!

1 Like

I’ve released another update, this time I almost doubled the render distance to around ~6000 studs. Performance is slightly lowered, but still much faster than when the original post was made.

1 Like

Interesting. Seems to work well. Camera clips into the ground and seems to show parts descend down to the XZ plane (Y = 0) for the bottom of each part.

The LoD system is very interesting to me and makes an amazing voxel generation. I don’t know how exactly you made it or I am probably overthinking it, but is the LoD customizable at set distances?

The game has now been released open source!

This last update introduces a load balancing system, which queue’s up chunks to be loaded
over time, this allows me to limit the frame time and reduce stuttering, especially at high walkspeeds.
Very high walkspeeds will still run much slower, but will usually stay above 10-15 fps. At high walkspeeds the queue will have trouble keeping up based on the performance of your system, so the terrain around you won’t stay up to date until you stop moving and let it load in. It prioritizes loading terrain nearby, so you won’t fall off the map.

I’ve applied most of the optimizations I wanted to, unfortunately it’s still not performant enough for an official game to use. Hopefully this changes in the future with optimizations and features from roblox themselves.

The code has been cleaned up and lightly documented. It wasn’t coded to be easily understood, so
you may still have trouble understanding it.

All code is in a single LocalScript located at StarterPlayer.StarterPlayerScripts.Terrain

5 Likes

Would this be possible to make it use smooth terrain instead of bricks? Would this increase, or decrease the performance/speed of generation? Once I get home I’ll try and see if I can do something similar with smooth terrain, if it works, I’ll probably make a thread on it and link it here.

You could definitely do the infinite terrain aspect, as most infinite terrain games are voxel based. However it is my understanding that terrain already automatically does LoD so doing that may be redundant. If you get it polished though I feel Roblox is long overdue for some infinite world crafting type game!

1 Like

I was able to edit it and now it generates smooth terrain instead! It only took some minor tweaks so I won’t be making a seperate post on this… the only downside is that it has a tiny bit more performance problems (might just be my machine) Here it is - https://www.roblox.com/games/3963593352/Smooth-Terrain-Infinite-Generation

2 Likes

Awesome edit. This looks great, and performance is still good.

Smooth%20Infinite%20Terrain%20By%20TheKitDev

Proof of Concept I know, but I’ll just note that if walk speed is set too high (ws/100) you can fall through water, especially near shores, throwing repeated HumanoidRootPart errors. Small, but I found experienced this nearly immediately.

Still, great use of dogwarrior24’s generator.

1 Like

It’s open source right now already!

1 Like

I would also like to note, my edits are open-sourced as well too! Not many edits to it, but if you were wanting to know what I added/edited.