[Mod][Library] Biome generator for Lua mapgens [biomegen]

Post Reply
User avatar
Gael de Sailly
Posts: 774
Joined: Sun Jan 26, 2014 17:01
GitHub: Gael-de-Sailly
IRC: Gael-de-Sailly
In-game: Gael-de-Sailly Ginkgoo
Location: France

[Mod][Library] Biome generator for Lua mapgens [biomegen]

by Gael de Sailly » Post


This mod aims at re-implementing core biome system (biomes, decorations and dust) for Lua mapgens. It is a library (it does not do anything standalone), providing functions intended to be used in Lua mapgen mods, at the end of mapgen loop.

It reads biomes and decorations registered by minetest.register_biome and minetest.register_decoration, so it is natively compatible with minetest_game and all mods/games using these functions to add content.

It applies to mapgens that generate only stone, water, river water and air, and requires to add biomegen as a dependency (mandatory or optional) of the mapgen mod.

^ biomegen used by a Lua mapgen, under vanilla Minetest Game

The main function is biomegen.generate_all(data, area, vm, minp, maxp, seed), to be added after mapgen loop, but before writing vm to map. It generates biomes, decorations, ores and dust (for now using core function for ores). Other function do these steps separately, check Readme for more details.


Code: Select all

local data = {}

minetest.register_on_generated(function(minp, maxp, seed)
	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}


	-- Generate biomes, decorations, ores and dust
	biomegen.generate_all(data, area, vm, minp, maxp, seed)

	-- Calculate lighting for what has been created.
	-- Write what has been created to the world.
	-- Liquid nodes were placed so set them flowing.
Example mod to see it in action: lvm_example-biomegen (modified version of Paramat's lvm_example). The screenshot comes from it.

Download zip / Browse the code
Just realize how bored we would be if the world was perfect.

Post Reply

Who is online

Users browsing this forum: Google [Bot], sirrobzeroone and 6 guests