ubc-minetest-classroom / minetest_classroom

Repo for Mintest Classroom game
GNU General Public License v3.0
10 stars 6 forks source link

Features/worldgen #117

Closed lukasgolson closed 2 years ago

lukasgolson commented 2 years ago

This PR implements the Lua scriptable world generation framework/pipeline/[insert keyword here] for realms. The framework is heavily simplified and built from initial testing and experimentation with world generation. I will add documentation to everything once more pressing issues have been completed.

The pipeline enforces a 3-step process used internally by games such as Minecraft and Minetest. First, a heightmap is generated in stone, water, and air. Surface details such as lakes, lava ponds, etc., Secondly, surface layers (e.g., dirt, grass) replace stone and details are added. Finally, trees and schematics are placed.

It should be noted that when generating a world, step 1 is independent but steps 2 and 3 are linked.

With this PR, 2 height map generators and 3 decorators have been created for R&D testing. They are all viable as are but have lots of room for improvement. The two height map generators take less than a second to generate large (up to 2,000 X 2,000) worlds, while the decorators [v1, v2] are slower (but still faster than the vanilla world generator).

The biomegen decorator is about the same speed or slightly slower than the vanilla decorator.

The V1 height map generator uses simple perlin noise to create plains / flatlands like terrain.

The V2 height map generator builds on V1 to add mountainous hills, and more interesting terrain features. It also introduces cliffs under rare circumstances.

The V1 world decorator adds simple grass and sand over the terrain in appropriate locations.

The V2 world decorator builds on V1 to add L-system trees. I want to expand on this version once we have the tree system in place.

The biomegen world decorator interfaces with a modified version of the biomegen mod to decorate the terrain with vanilla-registered biomes and features from the base game / other mods.