how can I edit schematics?

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

how can I edit schematics?

by burli » Mon Feb 06, 2017 08:37

I want to edit schematics. Can I convert them to Lua schematics and back to binary?
 

User avatar
duane
Member
 
Posts: 1273
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: how can I edit schematics?

by duane » Tue Feb 07, 2017 00:04

This is why I don't use binary schematics. You're saving a trivial amount of space in exchange for making them very difficult to edit.

The schematic code is in the source. You could always cobble together something to read it back and spit out lua code. Personally, I'd just as soon not support the concept that much. I'd rather see it removed.
Believe in people and you don't need to believe anything else.
 

User avatar
TumeniNodes
Member
 
Posts: 2515
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: how can I edit schematics?

by TumeniNodes » Tue Feb 07, 2017 00:11

burli wrote:I want to edit schematics. Can I convert them to Lua schematics and back to binary?

schematics... the necessary evil.... (for now anyway)

not sure if this helps?
paramat wrote:Default tree (and logs, bushes, corals, large cactus, papyrus, waterliiy) schematic files are created from simple Lua tables using this mod https://github.com/minetest-mods/saveschems
Worldedit cannot set certain parameters so is of limited use.


I have yet to use it so far so not sure if it enables editing or solely creating
I'm not your buddy, guy...
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: how can I edit schematics?

by burli » Tue Feb 07, 2017 06:47

So there is no converter or built-in function to convert mts files to lua. That is dump

I think, schematics are not bad, but without an editing tool the binaries are pretty useless

I need a little bit help. Is it possible to place rotated nodes in a lua schematic?

Edit: wow, the forum was gone for a long time. To answer myself: yes, nodes can be rotated with param2. Any documentation about param2 rotation or do I have to guess?

And prob stands for probability, right? 255 means, that these nodes always spawn, the lower the value the lower the chance to spawn
 

User avatar
TumeniNodes
Member
 
Posts: 2515
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: how can I edit schematics?

by TumeniNodes » Tue Feb 07, 2017 12:50

I found this (still related to the last code I posted earlier)
paramat explains a bit more regarding creating mts schematics, including regarding forced place and normal rotation

I hope something here helps.
https://forum.minetest.net/viewtopic.php?f=9&t=12011

There are also some items in a search which turn up links to "supposedly" mts editors but, #1 not sure if they truly are "editors" and #2 they are windows apps.
When I was looking for the same thing just recently (which is why paramat replied giving the link to the code I posted to you) I found nothing under linux... there was an article claiming a few programs which could open them which turned out to be a bluff.

In worst case, you may need to redo the schematics you wish to edit... using your own settings
I'm not your buddy, guy...
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: how can I edit schematics?

by burli » Tue Feb 07, 2017 14:01

Thank you. But why using the binary format? Just because file size?
 

User avatar
TumeniNodes
Member
 
Posts: 2515
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: how can I edit schematics?

by TumeniNodes » Tue Feb 07, 2017 15:03

burli wrote:Thank you. But why using the binary format? Just because file size?


probably just a very early-on choice, and by now what is required to change it, and what else may it affect? As well as, has it been an issue, or a big enough issue to make it a priority atm?

I imagine some have been thinking about a few similar aspects, and thinking of what to change. But then a list builds in the mind, in regards to like I stated above...

This should be changed
How do I change it
What is required and how much work+time
What else might it affect
Does it deserve priority attention (is it that important at this time)
What else might be more important

As we all know, there is a very small team, and much to do.

I think what you've been doing is very good, and definitely makes sense.
You have many really great ideas, and you do the work, and even nicer..., the dev team is really on-board with it all and there is momentum.
So, thank you to all of you.

I think if you are patient, use of .mts schematics may eventually be phased out. It will be just a matter of how can it be replaced, and the issue's priority level.

Keep on truckin' :D
I'm not your buddy, guy...
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: how can I edit schematics?

by burli » Tue Feb 07, 2017 15:50

Hmm, I just want to know why we need the binary format if there is the lua format.

I think, schematics are not the worst thing. I don't know if they should be used for trees, but I have other things in mind where I can use them, but I would always use the lua table.

I don't know what could be an alternative for trees. The old v6 method is complicated and slow, but more flexible. It has it's own charm.
 

User avatar
ExeterDad
Member
 
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: how can I edit schematics?

by ExeterDad » Tue Feb 07, 2017 17:56

burli wrote:Hmm, I just want to know why we need the binary format if there is the lua format.

I think, schematics are not the worst thing. I don't know if they should be used for trees, but I have other things in mind where I can use them, but I would always use the lua table.

I don't know what could be an alternative for trees. The old v6 method is complicated and slow, but more flexible. It has it's own charm.

Also... if we distribute binaries... where is the source code for the tree's? In another mod? Unless I've missed something somewhere.
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: how can I edit schematics?

by burli » Tue Feb 07, 2017 18:09

ExeterDad wrote:Also... if we distribute binaries... where is the source code for the tree's? In another mod? Unless I've missed something somewhere.

The source for the default trees is in the saveschem mod
 

User avatar
ExeterDad
Member
 
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: how can I edit schematics?

by ExeterDad » Tue Feb 07, 2017 20:46

burli wrote:
ExeterDad wrote:Also... if we distribute binaries... where is the source code for the tree's? In another mod? Unless I've missed something somewhere.

The source for the default trees is in the saveschem mod

Yes they are. But I only found them by accident, in a unrelated repo. I would think they need to be with Minetest_game sources.
 

User avatar
duane
Member
 
Posts: 1273
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: how can I edit schematics?

by duane » Tue Feb 07, 2017 22:01

burli wrote:Hmm, I just want to know why we need the binary format if there is the lua format.

I think, schematics are not the worst thing. I don't know if they should be used for trees, but I have other things in mind where I can use them, but I would always use the lua table.

I don't know what could be an alternative for trees. The old v6 method is complicated and slow, but more flexible. It has it's own charm.


Aside from the tiny saving in file size, it's slightly easier and quicker to read the binary format in the C code. Of course, you still have to maintain both sets of code...
Believe in people and you don't need to believe anything else.
 

User avatar
paramat
Developer
 
Posts: 3209
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: how can I edit schematics?

by paramat » Tue Feb 07, 2017 23:26

See https://github.com/minetest-mods/saveschems for the latest and maintained version of this mod.

> This is why I don't use binary schematics. You're saving a trivial amount of space in exchange for making them very difficult to edit.

> But why using the binary format? Just because file size?

The priority is fast placing in the world, most large structures in the world are schematics and are placed at mapgen time. Mapgen speed has priority, file size is of little importance, but it being less helps.

> So there is no converter or built-in function to convert mts files to lua

minetest.serialize_schematic can create a lua table string from a .mts file https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2601
More schematic info https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L947

> I think if you are patient, use of .mts schematics may eventually be phased out.

This is funny, as if they are seriously flawed in some way. They are very well coded by hmmmm and work very well.
They are like small bits of world database since they have content ID, param1 (prob) and param2 (various uses).
 

User avatar
ExeterDad
Member
 
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: how can I edit schematics?

by ExeterDad » Wed Feb 08, 2017 02:41

paramat wrote:<snip>

minetest.serialize_schematic can create a lua table string from a .mts file https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2601
More schematic info https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L947
<more snip>

A winning answer there! Thanks paramat!
I was pondering how to edit a .mts file last week and have had great interest in this thread.
 

User avatar
TumeniNodes
Member
 
Posts: 2515
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: how can I edit schematics?

by TumeniNodes » Wed Feb 08, 2017 04:45

> I think if you are patient, use of .mts schematics may eventually be phased out.

This is funny, as if they are seriously flawed in some way. They are very well coded by hmmmm and work very well.
They are like small bits of world database since they have content ID, param1 (prob) and param2 (various uses).

Never used the term "flawed". I prob should have given the answer I first thought to give which was "I don't know", because I don't (or didn't know until now why use of .mts was chosen) So, foot in mouth for me.
It was not a hack of any sort towards hmmmm's work in anyway. I hope it would not be viewed that way.

I have yet to even get into making schematics for trees or anything else, I am still working on how I want the trees I'm working on to look.

I figured, "if" using a binary file such as .mts "was" an issue, "maybe" it would eventually be replaced down the rd. I should have known better than to speak outside of my tech zone.

So, a really dumb question then... is there some means to create a script which could be used to edit .mts schematics? The same as for mapgens? In order to make it a bit easier for not so technically skilled individuals?
Or is it it impossible, or simply best to just follow the documentation provided.
I'm not your buddy, guy...
 

User avatar
TumeniNodes
Member
 
Posts: 2515
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: how can I edit schematics?

by TumeniNodes » Wed Feb 08, 2017 04:54

nevermind, I will study up on the saveschems mod
I'm not your buddy, guy...
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18

Re: how can I edit schematics?

by burli » Wed Feb 08, 2017 12:17

paramat wrote:The priority is fast placing in the world, most large structures in the world are schematics and are placed at mapgen time. Mapgen speed has priority, file size is of little importance, but it being less helps.

Is there a difference in performance between binary and lua schematics? I assumed that there is a difference while loading, but once the schematic is in memory there should be no difference
 

User avatar
paramat
Developer
 
Posts: 3209
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: how can I edit schematics?

by paramat » Wed Feb 08, 2017 18:16

Hmm of course, sorry i misunderstood, you both mean storing them in a subgame as a Lua table as opposed to an mts file. So once a Lua table is converted to mts it will be just as fast in mapgen.
Maybe the saveschems mod should be included in the MTGame repo somehow.

TumeniNodes, no problem :]
Indeed a schematic editing mod could possibly be written.

I was discussing the conversion of mts to lua with a modder and they came up with this to convert the mts to a block of lua code:

Code: Select all
function ai_library.build:build_tree(self)
   local building = minetest.get_modpath("open_ai").."/schematics/jungle_tree.mts"
   if self.schem == nil then
      local str = minetest.serialize_schematic(building, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)"
      
      local schematic = loadstring(str)()
      
      print(dump(schematic))
   end
end
 

User avatar
TumeniNodes
Member
 
Posts: 2515
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: how can I edit schematics?

by TumeniNodes » Thu Feb 09, 2017 02:06

paramat wrote:Hmm of course, sorry i misunderstood, you both mean storing them in a subgame as a Lua table as opposed to an mts file. So once a Lua table is converted to mts it will be just as fast in mapgen.
Maybe the saveschems mod should be included in the MTGame repo somehow.

TumeniNodes, no problem :]
Indeed a schematic editing mod could possibly be written.

I was discussing the conversion of mts to lua with a modder and they came up with this to convert the mts to a block of lua code:

Code: Select all
function ai_library.build:build_tree(self)
   local building = minetest.get_modpath("open_ai").."/schematics/jungle_tree.mts"
   if self.schem == nil then
      local str = minetest.serialize_schematic(building, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}).." return(schematic)"
      
      local schematic = loadstring(str)()
      
      print(dump(schematic))
   end
end


cool : )
I'm not your buddy, guy...
 

User avatar
burli
Member
 
Posts: 1608
Joined: Fri Apr 10, 2015 13:18
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: how can I edit schematics?

by Sokomine » Sat Apr 01, 2017 03:48

If you want to edit a .mts file manually, just load it in your world. WorldEdit has //mtschemplace filename.mts, and my handle_schematics mod even offers a backup of the old landscape and rotates the schematic the same way you place the build chest.

The binary format is quite practical, small and handy. It is documented well and can be read easily. If you want to, you can convert it to another format. What would you consider more practical anyway?
A list of my mods can be found here.
 


Return to General Discussion



Who is online

Users browsing this forum: No registered users and 8 guests

cron