Page 1 of 1

Building items out of blocks

PostPosted: Sun Jun 01, 2014 16:35
by MirceaKitsune
The idea is actually not mine... or at least it started from another suggestion years ago. Someone once said it would be nice if we could build vehicles by placing blocks on the ground as usual then linking them. This made me consider another ability: What if it were possible to build objects out of blocks, which could be linked to behave as items?

You'd start by placing blocks around as usual. Then you could link neighboring blocks into one entity, adding one at a time to the structure. You could then dig the entire structure by hand, hold it in inventory like other items, and place it back on the ground. Digging it with a pickaxe however should act as currently, and remove that individual block out of the object, so it can still be re-shaped. There should be a limit to how many blocks you can add to a whole structure, and only certain blocks should allow this.

The biggest technical challenge is probably generating and persisting a 3D model on the run, as blocks would be added / removed inside a whole structure. In a sense, this would be one big nodebox created and updated on the run. But if that's overcome, it sounds possible and an interesting feature to have.

What are your thoughts? Can and should we be able to make items out of voxels, which can be taken to inventory and held / placed / dropped / etc?

Re: Building items out of blocks

PostPosted: Sun Jun 01, 2014 16:44
by Casimir
Except for the inventory image to update, it is possible to do as a mod right now (but a lot of work).

Re: Building items out of blocks

PostPosted: Sun Jun 01, 2014 19:39
by MirceaKitsune
Casimir wrote:Except for the inventory image to update, it is possible to do as a mod right now (but a lot of work).


Interesting. Part of it certainly could be done in Lua already. Typically saving a Minetest schematic containing all blocks involved, removing said blocks from the world, while the schematic is possible to rez anywhere at any moment.

However, I'm not aware of the Lua API being able to register item definitions on the run. And like you said, I'm not sure if an inventory image can be generated. Or even better, a real 3D representation. So you see the entire object as a wielded item if you select it on the hotbar or drop it... which would be a lot better and more desired.

Another thing that would require engine additions is the ability to rez such structures as a Lua entities. So you can build robots / vehicles / creatures out of blocks then give them logics and life. Such requires generating a single mesh out of all the blocks involved... including individual nodeboxes, torchlike drawtype, etc. and allowing it to be attributed to items / entities. This would require one of two approaches;

Method 1: Allow full realtime item definitions. This would let Lua analyze all blocks in the structure, and use the maths to generate one big nodebox containing the full shape. When rezzed as an entity, this new definition is used. When rezzed on the ground, the original schematic (individual blocks) are rezzed so the structure can be edited.

Method 2: Add a new drawtype called drawtype_mts. The name is self explanatory; You assign a Minetest schematic file as the appearance of an entity / item. But this requires the engine to understand schematics in a different way, so they can be compiled into a mesh rather than treated as a list of blocks to spawn in the world.

Re: Building items out of blocks

PostPosted: Mon Jun 02, 2014 13:55
by rubenwardy
Sounds like you are talking about Voxel Area Entities.

Re: Building items out of blocks

PostPosted: Mon Jun 02, 2014 21:21
by stu
I already did something like this with my meshnodes mod but like micronodes it is mostly experimental and rather limited by minetest's entity system, though it does work better than I ever expected it to. I believe true voxel area entities are somewhere on the development road map.