Luanti Voxel Game Engine
repository·master·Indexed 11 days ago
https://github.com/luanti-org/luantiA free, open-source voxel game engine designed for easy modding and game creation. The documentation covers engine compilation across GNU/Linux, Windows, and MacOS using CMake, as well as detailed guides for server-side modding (Lua API), client-side content, mainmenu scripting, and low-level world formats and network protocols. It includes resources for engine developers, such as IDE configuration, profiling, and a roadmap for version 6.0.0.
What's inside Luanti
- Test Tools is a developer-focused mod for Luanti designed to facilitate rapid testing by providing tools to directly manipulate nodes, entities, and objects. It includes utilities for editing metadata, spawning entities, manipulating object properties, and managing attachments.
Overview of Luanti
masterLuanti (formerly Minetest) is a free, open-source voxel game engine designed for easy modding and game creation. It provides a platform for developers to build games and for players to experience voxel-based worlds.Overview of TinierGLTF
masterTinierGLTF is a lightweight, modern glTF deserializer designed for C++17. It functions by mapping glTF JSON objects directly into appropriate C++ structures. It is specifically designed to be safe for loading untrusted input and is tailored for use within Luanti.
Key Capabilities:
- Deserialization: Maps JSON glTF data to C++ structures.
- Safety: Designed to handle untrusted input safely.
- Schema Validation: Validates input against the glTF JSON schema (including indices and miscellaneous fields).
Limitations (What it does NOT do):
- No Serialization: It cannot convert C++ structures back into glTF files.
- No Image Loading: It does not handle the loading or decoding of image data.
- No Resource Resolution: It does not resolve external file references or URIs.
- No Extension Support: It does not support glTF extensions.
Use the Test Nodes mod for engine feature testing
masterThe
testnodesmod is a development utility containing minimal nodes designed to isolate and test specific Luanti engine features. Use these nodes to verify implementation of:- drawtypes: Testing how different node textures and rendering modes behave.
- paramtype2: Testing node interaction parameters (e.g., how nodes react to being clicked or used).
- Node Properties: Verifying specific physics or interaction properties such as
damage,drowning,falling, and other engine-level attributes.
Because these nodes are kept as minimal as possible, they are ideal for debugging specific engine behaviors without the interference of complex node logic.
Test ABM behaviors with the testabms mod
masterThe
testabmsmod provides a set of nodes designed to test various Area Break Modification (ABM) behaviors in Luanti. By placing these specific nodes in a game world, you can verify how different ABM fields affect node behavior.Supported ABM field tests include:
chance: Tests probabilistic execution.interval: Tests execution based on time intervals.min_yandmax_y: Tests execution restricted to specific vertical ranges.neighbor: Tests execution based on the presence of specific neighbors.without_neighbor: Tests execution based on the absence of specific neighbors.
Understand texture loading priority
masterLuanti looks up texture names in a specific order. If a texture is defined in multiple places, the one higher in the list takes precedence. The order from lowest to highest priority is:
- Client:
$path_share/textures/base/pack - Server: Mod-provided textures (in their
texturesdirectory) - Server: Game textures (in
<game path>/textures) - Server:
$path_share/textures/server - Server:
override.txtin the path specified by thetexture_pathsetting - Server:
override.txtin<game path>/textures - Client: Path specified by the
texture_pathsetting - Client:
override.txtin the path specified by thetexture_pathsetting
- Client:
Mitigation of time-based side-channel attacks
masterTo prevent time-based side-channel attacks, SSCSM limits the precision of available clock API functions. Bothos.clock()andcore.get_us_time()are restricted to a resolution ofSSCSM_CLOCK_RESOLUTION_US(20 microseconds).Understand item and stack identifiers
masterLuanti uses several special identifiers to represent specific states or empty items:
"unknown": Represents any item that has not been registered."air": The node that appears where no other node exists."ignore": Represents unloaded mapblocks or nodes not yet set by the map generator. It also appears outside map boundaries.""(empty string): Represents the player's hand when no item is wielded. It acts as a fallback for range and tool capabilities. Note that""cannot be used as anItemStackobject because it represents an empty stack and cannot be stored in an inventory.
Follow naming conventions for registered names
masterTo prevent name collisions, all registered textual names (items, nodes, entities) should follow the format:
modname:<whatever>Where
<whatever>consists of charactersa-zA-Z0-9_.Overriding names: You can override a registration from another mod by prefixing the name with a colon (
:). For example, to redefineexperimental:tnt, use::experimental:tnt(Note: The mod performing the override must haveexperimentallisted as a dependency).experimental:tntConfigure Ore Generation Types
masterLuanti supports several ore generation types to control how ores are distributed in the world. Each type uses different parameters for shape and density.
Available Ore Types
scatter: Randomly chooses locations to generate clusters. Usenoise_paramsandnoise_thresholdto create non-uniform distributions.sheet: Creates a blob-shaped sheet using 2D value noise. It consists of vertical columns with heights betweencolumn_height_minandcolumn_height_max. Usecolumn_midpoint_factor(0 to 1) to control if columns grow upward (1), downward (0), or both (0.5).puff: Creates cloud-like puffs using 2D noise. Vertical displacement is controlled bynp_puff_topandnp_puff_bottomnoise parameters.blob: Creates deformed spheres using 3D value noise. Maximum size is determined byclust_size.vein: Creates veins using the intersection of two 3D value noise instances. This type is highly sensitive to parameters and is ~200x more computationally expensive than other types. Userandom_factor(default 1) to vary density.stratum: Creates a continuous, undulating horizontal layer across the world. Usenoise_paramsfor the Y coordinate of the midpoint andnp_stratum_thickness(orstratum_thicknessfor constant thickness) for vertical thickness. Usey_minandy_maxto limit generation range.
Use Mod Channels for Communication
masterMod channels allow for asynchronous communication between the client and server mods.
- Join a channel: Use
core.mod_channel_join(channel_name). Note that this is asynchronous; the client must wait for the server to acknowledge the join request. - Listen for messages: Register a callback using
core.register_on_modchannel_message(function(channel_name, sender, message)). - Listen for signals: Register a callback using
core.register_on_modchannel_signal(function(channel_name, signal))to react to channel state changes.
Signal IDs:
0:join_ok1:join_failed2:leave_ok3:leave_failed4:event_on_not_joined_channel5:state_changed
- Join a channel: Use
Understand Fractal Value Noise and NoiseParams
masterFractal value noise is used during map generation to create natural-looking variations (terrain, biomes, ores) by combining multiple 'octaves' of simple noise. Each octave adds finer detail.
NoiseParams Reference
When configuring noise, you use a
NoiseParamstable with the following keys:offset: Added to the final result. Can be positive or negative.scale: Multiplier for the combined octaves. Can be positive or negative.spread: A vector{x, y, z}representing the 'wavelength' or scale of the largest structures. Positive numbers only.seed: An integer in the[s32]range. Identical seeds produce identical patterns.octaves: Number of noise generators (1 to 65535). Higher values add detail but increase CPU load. Warning: If any octave's wavelength falls below 1, an error occurs.persistence(orpersist): Controls 'roughness'. Determines how much the amplitude of each octave decreases. Typically between 0.3 and 1.0 (0.5 is common).lacunarity: Controls how much the wavelength decreases per octave. Must be $\ge 1.0$. Common value is 2.0.flags: A comma-separated string of supported flags:defaults: Enables auto-selection of eased/not-eased.eased: Applies a quintic S-curve to noise gradients for smooth, rolling noise. (2D is eased by default; 3D is not eased by default to save performance).noeased: Disables easing for sharp, gridded noise.absvalue: Uses the absolute value of each octave when combining them.
Usage Example
np_terrain = { offset = 0, scale = 1, spread = {x = 500, y = 500, z = 500}, seed = 571347, octaves = 5, persistence = 0.63, lacunarity = 2.0, flags = "defaults, absvalue", }np_terrain = { offset = 0, scale = 1, spread = {x = 500, y = 500, z = 500}, seed = 571347, octaves = 5, persistence = 0.63, lacunarity = 2.0, flags = "defaults, absvalue", }