Skip to content

Luanti support#808

Open
3rd3 wants to merge 38 commits intolouis-e:mainfrom
3rd3:luanti
Open

Luanti support#808
3rd3 wants to merge 38 commits intolouis-e:mainfrom
3rd3:luanti

Conversation

@3rd3
Copy link
Copy Markdown

@3rd3 3rd3 commented Mar 21, 2026

Summary

Adds native Luanti/Minetest world generation as a new output format alongside Java and Bedrock Edition. Worlds are generated as map.sqlite databases using the v29 mapblock format with zstd compression, compatible with both minetest_game and Mineclonia game packs.

What Changed

New files:

  • src/luanti_block_map.rs (710 lines) — Block ID mapping from internal IDs to Luanti node names. Contains separate mapping tables for minetest_game and Mineclonia, plus a LuantiGame enum and game_id() helper. From MC2MT with some corrections. The map may still need to be improved for better color matching etc.
  • src/world_editor/luanti.rs (568 lines) — Luanti world serializer. Handles mapblock serialization (v29 format, zstd compression, node ID mapping), SQLite database creation, and world metadata files (world.mt, map_meta.txt, worldmod for spawn/lighting).

Modified files:

  • src/args.rs — Added --luanti flag and --luanti-game option (values: minetest_game, mineclonia). Added mutual exclusion with --bedrock. Validates game name.
  • src/main.rs — Added mod luanti_block_map, wired LuantiWorld format variant through CLI flow, creates Arnis Luanti World N directories.
  • src/data_processing.rs — Added luanti_game and ground_level fields to GenerationOptions. Uses WorldEditor::new_luanti() constructor for Luanti worlds.
  • src/world_editor/mod.rs — Added LuantiWorld variant to WorldFormat enum. Added Luanti-specific fields to WorldEditor struct (luanti_game, luanti_level_name, luanti_spawn_point, luanti_ground_level). Added new_luanti() constructor and save_luanti_world() dispatch in the save path.
  • src/gui.rs — Wired Luanti format selection through the GUI generation pipeline (Rust side). Creates worlds in ~/.minetest/worlds/. Frontend HTML/JS dropdown options for selecting Luanti/Mineclonia are not yet added.
  • Cargo.toml — Added rusqlite 0.33 (with bundled SQLite) and zstd 0.13 dependencies.

Key Technical Details

  • Mapblock format: v29 with zstd compression, 16×16×16 node blocks, each node stored as param0 (node ID) + param1 (light) + param2 (rotation/variant)
  • Mineclonia compatibility: Sets mcl_singlenode_mapgen = false in map_meta.txt and writes mcl_levelgen.conf with disable_mcl_levelgen = true in the worldmod to prevent Mineclonia's terrain generator from overwriting the arnis map
  • Lighting: Sets lighting_complete = 0x0000 and initializes param1 to 0, then uses a Lua worldmod (arnis_mapgen) that calls minetest.emerge_area() + minetest.fix_light() on first player join to properly compute lighting
  • Block names: Mineclonia uses different node names than minetest_game (e.g., hardened_clay instead of terracotta, quartz in mcl_nether module instead of mcl_core)

Usage

CLI:

# Generate for minetest_game (default)
arnis --bbox "LAT1,LON1,LAT2,LON2" --luanti --output-dir /path/to/output

# Generate for Mineclonia
arnis --bbox "LAT1,LON1,LAT2,LON2" --luanti --luanti-game mineclonia --output-dir /path/to/output

The world is created as Arnis Luanti World N inside the output directory.

To play the generated world, copy/move the world folder into your Luanti worlds directory:

  • Linux: ~/.minetest/worlds/
  • Windows: %APPDATA%/minetest/worlds/
  • macOS: ~/Library/Application Support/minetest/worlds/

Then launch with:

luanti --worldname "Arnis Luanti World 1" --go

Or select it from the Luanti main menu.

GUI (not tested):
The Rust backend supports Luanti format selection, but the GUI frontend (HTML/JS) needs dropdown options added for "Luanti (minetest_game)" and "Luanti (Mineclonia)" — the format strings should start with "luanti" and contain "mineclonia" for the Mineclonia variant. When using the GUI with "New World" mode, worlds are created directly in ~/.minetest/worlds/.

@gabrielpantoja-cl
Copy link
Copy Markdown

Amazing work on this PR! As a Luanti server admin running VoxeLibre for kids, I've been dreaming about recreating real Chilean cities (specifically Valdivia, with its rivers and wetlands) for educational purposes. This native Luanti support is a game-changer — it eliminates the painful Minecraft→MC2MT conversion pipeline entirely. The dual mapping table approach (minetest_game + mineclonia) is really well thought out. Can't wait to test this with our server. Keep up the great work! 🙌

3rd3 added 9 commits March 21, 2026 21:28
Refactor world directory path and luanti_game assignment for clarity.
Added styles for the Luanti game dropdown component.
Added support for Luanti world format and game selection.
Added constants for trapdoor block IDs and updated properties_to_param2 function to handle open trapdoors with wallmounted param2 values.
@3rd3
Copy link
Copy Markdown
Author

3rd3 commented Mar 22, 2026

I added GUI support, fixed remaining issues with lighting and some blocks.

Remaining issues:

  • Trapdoors near windows are not oriented correctly.
  • Some mappings still wrong for Mineclonia.

@gabrielpantoja-cl I'm glad there is interest in this feature. Feel free to test it; it should work via the GUI now. Though I have not tested Windows nor macOS platform. Make sure to backup existing world files. There is still work left to do, but I lack time to continue this for now.

@louis-e
Copy link
Copy Markdown
Owner

louis-e commented Mar 27, 2026

Hey there, thanks a lot for the effort! I will need some time to review all of this. But highly appreciated :)

@3rd3
Copy link
Copy Markdown
Author

3rd3 commented Mar 27, 2026

@louis-e You're welcome. I noticed that Claude left out much of the details of the MC2MT mappings, especially the orientations which are encoded in param2 and build up through C macros. It only added some of the special cases for stairs and trap doors, and even that incompletely I think. I can ask it to redo that tonight.

I'll also ask it to make OS-dependent world folder discovery: https://codeberg.org/halon/Minetest#paths
Though not sure what to do in case of a portable installation. I guess automatic search would be overkill. Maybe displaying an output location chooser dialog would make sense as fallback; maybe it should check on startup instead of during saving.

3rd3 added 3 commits March 28, 2026 00:02
Refactor properties_to_param2 function to remove unused stair and trapdoor block IDs. Update to_luanti_node calls to include optional properties.
@3rd3
Copy link
Copy Markdown
Author

3rd3 commented Mar 27, 2026

I added new mappings.

I did not touch the OS-dependent path determination for now because I wasn't sure how to integrate it into the existing "save path".

@3rd3
Copy link
Copy Markdown
Author

3rd3 commented Mar 28, 2026

I just systematically checked the block similarity using color, image feature and text embedding distances between Minecraft blocks and the respective Luanti game blocks and made some adjustments based on that.

The matches for Minetest Game are (perhaps unsurprisingly) much worse compared to Mineclonia that I have to wonder if its worth supporting Minetest Game at all.

I guess that is why MC2MT only supports Mineclonia.

If there is no interest in Minetest, I can remove it entirely from the PR (GUI dropdown + CLI args).

@proller
Copy link
Copy Markdown

proller commented Mar 31, 2026

Btw there is another attempt to bring it to almost luanti :
https://github.com/freeminer/freeminer/blob/master/src/mapgen/mapgen_earth.cpp
Mapgen using arnis converted to cpp
No separate convert operation needed, anything generated on fly around player
Also it works on 32bit maps - whole world available on single[player| server]
To test it find and join to servers "fm: Earth"

3rd3 added 9 commits April 19, 2026 16:31
Refactor lighting calculations and remove unused world bounds computation.
Removed support for MineTestGame and related functions.
Updated gui_show_in_folder function documentation and renamed city_boundaries_enabled to land_cover_enabled. Adjusted logic for spawn point calculation and added support for fetching building data from Overture Maps.
Updated button label for Luanti to 'Luanti/Mineclonia' and added new settings for land cover and rotation angle. Removed the Luanti game dropdown section and added a disable height limit toggle.
Added styles for html and body, adjusted container and footer styles, and removed unused luanti game dropdown styles.
@3rd3
Copy link
Copy Markdown
Author

3rd3 commented Apr 19, 2026

I've removed the Minetest game, fixed the cobble stone block mapping and enabled fly and fast by default for quick explorations.

There was also an issue with fixing the light in very large worlds during startup in Luanti. In my tests the game froze and it ended up corrupting the database, possibly due to Lua timeouts. For now, I've solved this with lazy/on-demand calls to fix_light() based on user positions. This also removes the delay during startup. Perhaps the radius could be extended to avoid shadows appearing very late. An alternative may be to port the lighting code to Arnis.

@3rd3
Copy link
Copy Markdown
Author

3rd3 commented Apr 19, 2026

Actually the previous lighting code does work with large areas, but it just takes a very long time to compute the first time the world is loaded, maybe 1.25 times as long as the Arnis generation itself, and it is frozen at the beginning and then only a small area is visible for a while. The current lazy lighting may need to be tested with more players regarding performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants