The idea is good. However, three nodes as markers are too much and overly complicated. I think we need one node out of which you can draw a second marker which will then mark the opposite end of the building. Height can be determined by either looking how large the structure extends upward (find one level where there's nothing but air) or by asking the player. Guessing how heigh someting is is usually easier than determining x and z correctly. The same apllies for depth. At least for small scale.
I'm working on something similar for my random_buildings mod. As good as my cottages may be, Minetest is about building, and players have to be able to extend the village with their own structures (saving them, adding copies of them, making enough buildings for entirely new villages). Another area where this functionality is desperately needed is node_ownership. It is annoying and difficult to get the corners of a to-be-protected-area right. Plus the ability to save the content to a file (and maybe send it to you as a mail) would be great. What I have to do once I find the time is to store the information of the starting node in the second marker, add the formspecs required etc.
Please use the de-facto-standard of the worldedit savefile format for your mod as well. Weather you take the newest or an older format is of limited importance. The older one - that does not save meta information - is very similar to your format except that saves param1 and param2 as well.
MirceaKitsune wrote:
Ideally you will be able to specify a folder of text files, and the mapgen will randomly spawn any building there in a given area. This will be perfect for implementing villages, cities, or places made of structures you build in your world.
Spawning buildings at mapgen time is the real trouble. It works - to a degree. Even those tiny lumberjack- and clay trader houses have to wait more often than not for their spawn space to "exist" completely (they do some checks first to make sure nothing important is destroyed by their spawning and to determine how high the platform for the building has to be). This is also a protection against griefs by mapgen which occoured at least in earlier versions of mapgen: Imported buildings where griefed because caves where created in them. Small buildings work relatively well (say, up to 20x20), but the 80x80 area of Gambits NPC village proved to be too large. At least on my computer, making sure that the entire area was loaded failed. Even when I was standing at the start of it. Spawning worked nevertheless, but this way it is far less safe.
For importing really huge structures, talk to Mauvebic. He may tell you how much pain it sometimes is to get something really large imported. He has found some workarounds. Still, importing e.g. a Minecraft classic map is sometimes limited by those factors.
Apart from the general trouble with importing large areas, there's also the factor of the smoothness of terrain. Even tiny houses need platforms to stand on because there's not enough flat land around. And you usually don't want completely flat maps (which would eliminiate the problem) because they would be too boring for this (=randomly spawned buildings) scenario.
If you want to experiment a bit with my random_buildings mod (as linked in the thread above), best install moretrees in your world. After all, what gets spawned are lumberjacks. Without moretrees, you do get only the standard wood traders, which is a bit boring. Clay traders spawn as well. Buildings for villages exsit, but due to the problems mentioned above they do not spawn by themshelves. You can build them in a similar way to towntest by using /giveme random_buildings:build to obtain a building chest. Place that chest and insert the materials as requested. The chest will construct a scaffolding structure where the building will later be. As soon as there is as much material of one type as required, all those blocks of that type are placed in one go. There is no NPC moving around like in towntest (that one goes through solid matter, which looks odd, but what would require a lot of computation time to avoid).