Luanti support#808
Conversation
Added support for Luanti world formats and adjusted spawn point logic for new worlds.
Implement Luanti world saving functionality and serialization.
|
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! 🙌 |
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.
|
I added GUI support, fixed remaining issues with lighting and some blocks. Remaining issues:
@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. |
|
Hey there, thanks a lot for the effort! I will need some time to review all of this. But highly appreciated :) |
|
@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 |
Refactor properties_to_param2 function to remove unused stair and trapdoor block IDs. Update to_luanti_node calls to include optional properties.
|
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". |
|
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). |
|
Btw there is another attempt to bring it to almost luanti : |
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.
|
I've removed the Minetest game, fixed the cobble stone block mapping and enabled 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 |
Removed luanti_game argument from command line options.
Removed validation for luanti-game value in args.rs.
|
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. |
Summary
Adds native Luanti/Minetest world generation as a new output format alongside Java and Bedrock Edition. Worlds are generated as
map.sqlitedatabases 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 aLuantiGameenum andgame_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--luantiflag and--luanti-gameoption (values:minetest_game,mineclonia). Added mutual exclusion with--bedrock. Validates game name.src/main.rs— Addedmod luanti_block_map, wiredLuantiWorldformat variant through CLI flow, createsArnis Luanti World Ndirectories.src/data_processing.rs— Addedluanti_gameandground_levelfields toGenerationOptions. UsesWorldEditor::new_luanti()constructor for Luanti worlds.src/world_editor/mod.rs— AddedLuantiWorldvariant toWorldFormatenum. Added Luanti-specific fields toWorldEditorstruct (luanti_game,luanti_level_name,luanti_spawn_point,luanti_ground_level). Addednew_luanti()constructor andsave_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— Addedrusqlite 0.33(with bundled SQLite) andzstd 0.13dependencies.Key Technical Details
mcl_singlenode_mapgen = falseinmap_meta.txtand writesmcl_levelgen.confwithdisable_mcl_levelgen = truein the worldmod to prevent Mineclonia's terrain generator from overwriting the arnis maplighting_complete = 0x0000and initializes param1 to 0, then uses a Lua worldmod (arnis_mapgen) that callsminetest.emerge_area()+minetest.fix_light()on first player join to properly compute lightinghardened_clayinstead ofterracotta, quartz inmcl_nethermodule instead ofmcl_core)Usage
CLI:
The world is created as
Arnis Luanti World Ninside the output directory.To play the generated world, copy/move the world folder into your Luanti worlds directory:
~/.minetest/worlds/%APPDATA%/minetest/worlds/~/Library/Application Support/minetest/worlds/Then launch with:
luanti --worldname "Arnis Luanti World 1" --goOr 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/.