[mod] Schematics utils library [schemlib]

bell07
Member
 
Posts: 534
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

[mod] Schematics utils library [schemlib]

by bell07 » Thu Jul 13, 2017 21:51

At the first: This mod is useless standalone, it is a library-only. So install it only if you like to run an other mod requires it.

This library is an additional API to manage minetest schematics. I'm waiting for the question "Why an lua written API for things already existing in minetest core?" In Minetest the developer can manipulate the world in two ways: per-node using minetest.set node(), and per-schematic using Voxel-Manip or minetest.place schematic(). The developer need to pay attention to multiple things: Is chunk generated? Is chunk loaded? Is cave generator active? If older schematic files are used, some old nodes like doors and torches needs to be replaced by new nodes.

This library is a bridge between both technologies and have some features not in minetest-core, to handle the buildings chunk-less and without worry about compatibility.
The library can handle big plans, my reference-plan is since beginning the AMMOnym's Coloseum with 177x177x71 size / 343.034 nodes / 2.527.156 nodes if filled with air

Image
(no idea how I can adjust the miss-rotated torches for this building :-()

Important features list
- Import WorldEdit "*.we / *.wem" Files
- Import Minetest schematics "*.mts" Files
- Build plan from scratch /modify plan using plan:add_node() method
- Air-Filler: Fill the building with air, with additional borders
- Search for best Y-value to build / check a place if the building is buildable
- Auto-Detection of ground in imported building so cellar should be build under the surface
- Compatibility mapping for unknown nodes, special handling of nodes imported from older MT-versions
- Costs mapping: If each node needs to be provided: node ~= item! So there is a determination which item you need to provide to get the node
- Mirroring and rotation
- Plan overlap checks: plan:contains(pos) / plan:check_overlap(pos1, pos2)
- Analyze surface for best y-offset. With check if building will touch any protected node (ie is_ground_content = false with some exceptions)
- Asynchronous build of whole plan chunkwise (without lag and without worry about unloaded or not generated chunks)
- Build the schematic each node per node
- Builder-NPC AI - basically a method to get the next target nearly to the NPC, but matches some criteria
- Nodes supports metadata (fill chests after placement)
- Plan manager for persistance: Registered plans are saved / restored automatically on reboot
- The Plan manager can be used to look for overlaps to not builded (planed) schematics

The API is still in WIP and I'll enhance it on demand with more features

Other Projects already uses the schemlib:
- Stujone's NPCF-Builder "Tom" from NPCF-Modpack has optional schemlib dependency - viewtopic.php?f=13&t=7321
- My NPCF-Builder implementation "Larry" - viewtopic.php?f=9&t=18085
- Townchest (Instant placement or Larry can do it) - viewtopic.php?f=9&t=15704

License: LGPLv2
Code: https://github.com/bell07/minetest-schemlib
API: https://github.com/bell07/minetest-sche ... /README.md
Attachments
screenshot_20180731_072938.png
(692.69 KiB) Not downloaded yet
Last edited by bell07 on Tue Jul 31, 2018 06:21, edited 2 times in total.
 

User avatar
azekill_DIABLO
Member
 
Posts: 7461
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
texmex
Member
 
Posts: 1067
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [mod] Schematics utils library [schemlib]

by texmex » Sat Jul 15, 2017 22:30

This sounds very good. I'm especially interested in "Search for best Y-value to build / check a place if the building is buildable" combined with automatic placement on map generation.
 

bell07
Member
 
Posts: 534
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Schematics utils library [schemlib]

by bell07 » Sun Jul 23, 2017 10:56

texmex wrote:I'm especially interested in "Search for best Y-value to build / check a place if the building is buildable"
You can try the both mods, townchest and schemlib_builder_npcf to look for the result of this function. It is on my roadmap to create the next mod that generates buildings triggered by mapgen, but not until the rotation is implemented.
 

User avatar
texmex
Member
 
Posts: 1067
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [mod] Schematics utils library [schemlib]

by texmex » Sun Jul 23, 2017 12:00

bell07 wrote:
texmex wrote:It is on my roadmap to create the next mod that generates buildings triggered by mapgen, but not until the rotation is implemented.

I'm glad! By rotation implementation, do you mean in this mod or in engine?
 

bell07
Member
 
Posts: 534
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Schematics utils library [schemlib]

by bell07 » Mon Jul 24, 2017 07:25

texmex wrote:I'm glad! By rotation implementation, do you mean in this mod or in engine?

I meant in this mod. To be able to place the building rotated I need to rotate node position and param2 for facedir/wallmounted nodes. It is not complicated but I have less time at the time :-/
 

bell07
Member
 
Posts: 534
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Schematics utils library [schemlib]

by bell07 » Fri Jul 28, 2017 00:59

Just for reference: The first attempt for mapgen-driven building placement is done:
https://github.com/bell07/minetest-schemlib_mg
Image
ToDo's:
- Own topic in forum
- improve flatting the place under the building
- find bug why sometimes some chunks are lost

ToDo's I need help
- Perlin noises for building "seeds"
- Schematics/Buildings
Attachments
screenshot_20170728_005703.png
(911.61 KiB) Not downloaded yet
 

User avatar
texmex
Member
 
Posts: 1067
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [mod] Schematics utils library [schemlib]

by texmex » Tue Mar 06, 2018 18:29

May I just say that I find this mod quite extraordinary in that it pretty much solves common key issues I hear is a problem when placing schematics in the world. This mod deserves way much more attention.
 

bell07
Member
 
Posts: 534
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Schematics utils library [schemlib]

by bell07 » Tue Mar 06, 2018 21:06

texmex wrote:May I just say that I find this mod quite extraordinary in that it pretty much solves common key issues I hear is a problem when placing schematics in the world. This mod deserves way much more attention.
Thank you for the compliment.

The issue with this mod is Sokomine is always a few steps ahead ;-) I did never reached the goal to support all features that handle_schematics does. (Shematic-preview on formspec for example).
I was proud of the mapgen-driven placement, but Sokimine overtaked me by his basic_houses mod. Once I still have is the intelligent NPC's that can work togehter ;-) And schemlib can handle real big buildings.

I know, the best way is to work together, I thinked about that before I started this mod. It is difficult since I develop mostly in objects style and Sokomine in functional style. In other words I is hard for me to read his code.

This mod is not abandoned, just my motivation is down at the time to work on them further. It would be nice an other "objects-style" developer like to contribute to this mod.

My last insight was I need to rewrite nodes compatibility mapping to support two scenarios (Fresh build by NPC => place dirt vs. older building by mapgen => place dirt_with_???), so again a step back in development.
 

bell07
Member
 
Posts: 534
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Schematics utils library [schemlib]

by bell07 » Tue Jul 31, 2018 06:21

I found again some time for schemlib and did some rewrites according my current lua knowledge. The schemlib requires less ressources now. The main change is the internal data was stripped down to be serializeable.
New is the plan manager for get WIP plans persistant over reboots. The plan manager can be used also to get different mods working together, so the Larry Builder does pick plans marked as "npc_build" from manager now, the townchest does mark his plans with this flag if requested. Also it is possible to use the registered plans for overlap checks independing if the plan is created in the same mod. The Larry does it this way.

The townchest and schemlib_builder_npcf are updated. The schemlib_mg is planned to be rewritten at the next, away from "decorations" to own noise-like placement logic (currently haunts in my head)

The initial post is updated also
 


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 5 guests